Im very New to KGDB, Im getting problem when im connecting the target from Host, Getting The following Error.
(gdb) target remote /dev/ttyUSB0 Remote debugging using /dev/ttyUSB0 Ignoring packet error, continuing... warning: unrecognized item "swreak" in "qSupported" response warning: unrecognized item "ReloInsn" in "qSupported" response warning: unrecognized item "QTread' [3]kdb> " in "qSupported" response Bogus trace status reply from target: qTStatus ...#
The Procedure Im following is :
#[Target] stty -F /dev/ttyS0 115200 [Host] stty -F /dev/ttyUSB0 115200
Make sure the serial connection works on both direction. You can use:
[Host] cat /dev/ttyUSB0 [Target] echo 'from TARGET to HOST' > /dev/ttyS0 [Target] cat /dev/ttyS0 [Host] echo 'from HOST to TARGET' > /dev/ttyUSB0
You should see the messages on both side of machine. If not, there might be some problems on the cable or driver.
Compile Kernel
Enable KGDB* , KGDB_SERIAL*, KGDB_USB*, DEBUG_INFO, DEBUG_INFO_DWARF4, MAGIC_SYSRQ in the kernel config. Compile and install on the TARGET.
The main purpose here is to enable KGDB feature & preserve debug information in vmlinux.
agent-proxy Setup
agent-proxy acts as a proxy for the TARGET's serial port. It splits up the serial port for multiplexing. One for primary console I/O, the other for GDB session. Thus, we can work on both simultaneously. You should run the agent-proxy on HOST machine.
git clone http://git.kernel.org/pub/scm/utils/kernel/kgdb/agent-proxy.git cd agent-proxy ; make ./agent-proxy 5550^5551 0 /dev/ttyUSB0,115200
This will redirect:
- TARGET's console to HOST:5550
- TARGET's kgdb listening port to HOST:5551
Start To Debug
First, open the primary console:
[Host] telnet localhost 5550
Entering the kdb mode, either by:
[Target] echo ttyS0,115200 > /sys/module/kgdboc/parameters/kgdboc [Target] dmesg | tail
(you should see KGDB: Registered I/O driver kgdboc, otherwise it failed)
[Target] echo g >/proc/sysrq-trigger Host> gdb vmlinux (gdb) target remote localhost:5551 Remote debugging using localhost:5551 kgdb_breakpoint () at kernel/debug/debug_core.c:1072 1072 wmb(); /* Sync point after breakpoint */ (gdb)
when i type kgdb in target mission it is getting error as Permission denied as shown below
[3]kdb> kgdb diag: -22: Permission denied
..., I would appreciate the clear answer in steps..., Thanks in advance
That error means that access to debugger functions is prohibited by default in you kernel. In order to unlock debugger you need exec this command:
or add a Kernel Boot Parameter:
More info here