KGDB timeout error with Jetson Nano

Hi, everyone.

I’m trying to debug the linux kernel for Jetson nano with KGDB.

I’ve opened the following configs:
CONFIG_MAGIC_SYSRQ=y
CONFIG_KGDB=y
CONFIG_KGDB_SERIAL_CONSOLE=y

I’ve rebuilt the linux kernel and update the image for Jetson Nano.

I’ve connected Jetson Nano’s and Ubuntu Host PC with uart line.

I executed the following commands in Jetson Nano:
sudo su root
echo ttyS0,115200 > /sys/module/kgdboc/parameters/kgdboc
echo -n g > /proc/sysrq-trigger

I executed the following commands in Ubuntu Host PC:
aarch64-linux-gnu-gdb vmlinux

The messges are as follows:

aarch64-linux-gnu-gdb vmlinux

GNU gdb (Linaro_GDB-2018.05) 8.1.0.20180612-git
Copyright © 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type “show copying”
and “show warranty” for details.
This GDB was configured as “–host=i686-pc-linux-gnu --target=aarch64-linux-gnu”.
Type “show configuration” for configuration details.
For bug reporting instructions, please see:
http://www.gnu.org/software/gdb/bugs/.
Find the GDB manual and other documentation resources online at:
http://www.gnu.org/software/gdb/documentation/.
For help, type “help”.
Type “apropos word” to search for commands related to “word”…
Reading symbols from vmlinux…done.

(gdb) set remotebaud 115200
No symbol “remotebaud” in current context.

(gdb) target remote /dev/ttyUSB0
Remote debugging using /dev/ttyUSB0
Ignoring packet error, continuing…
warning: unrecognized item “XEQ” in “qSupported” response
Ignoring packet error, continuing…
Remote replied unexpectedly to ‘vMustReplyEmpty’: timeout

At last, I have the timeout error.

Should below command line modify to ttyUSB0?

echo ttyUSB0,115200 > /sys/module/kgdboc/parameters/kgdboc

ehco ttyS0, 115200 > /sys/module/kgdboc/parameters/kgdboc is correct.

Could you have install the ddd on your host to try.
sudo apt-get install ddd

Also have enable CONFIG_KGDB_KDB=Y

Thank you very much, ShaneCCC.
But my problem seems to still exist.

Now I have the following configs with the help of “make menuconfig”:

CONFIG_MAGIC_SYSRQ=y
CONFIG_KGDB=y
CONFIG_KGDB_SERIAL_CONSOLE=y
CONFIG_KGDB_KDB=Y

Then I rebuilt the linux kernel, and flash the Image to Jetson Nano.

Jetson Nano:

sudo su root
echo ttyS0,115200 > /sys/module/kgdboc/parameters/kgdboc
echo -n g > /proc/sysrq-trigger

Ubuntu Host:

aarch64-linux-gnu-gdb vmlinux

After executed the above command, the following messages came out:

aarch64-linux-gnu-gdb vmlinux
GNU gdb (Linaro_GDB-2018.05) 8.1.0.20180612-git
Copyright © 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type “show copying”
and “show warranty” for details.
This GDB was configured as “–host=i686-pc-linux-gnu --target=aarch64-linux-gnu”.
Type “show configuration” for configuration details.
For bug reporting instructions, please see:
http://www.gnu.org/software/gdb/bugs/.
Find the GDB manual and other documentation resources online at:
http://www.gnu.org/software/gdb/documentation/.
For help, type “help”.
Type “apropos word” to search for commands related to “word”…
Reading symbols from vmlinux…done.
(gdb)

Then I typed the following commands:
set serial baud 115200
target remote /dev/ttyUSB0

And the following messages came out:

(gdb) set serial baud 115200
(gdb) target remote /dev/ttyUSB0
Remote debugging using /dev/ttyUSB0
Ignoring packet error, continuing…
warning: unrecognized item “timeout” in “qSupported” response
Ignoring packet error, continuing…
Remote replied unexpectedly to ‘vMustReplyEmpty’: timeout
(gdb)

And as you mentioned, I’ve installed the ddd on my ubuntu host
sudo apt-get install ddd

Have a check with below link if can fix the your problem.

http://quabr.com:8182/58789028/how-to-fix-remote-replied-unexpectedly-to-vmustreplyempty