Trying to use KGDB

Hi all,

I am testing the KGDB support on Jetson Orin AGX devkit and JetPack 5.1.2 using the guide from this doc: Debugging the Kernel — NVIDIA Jetson Linux Developer Guide 1 documentation

I recompiled the kernel with the additional CONFIGS definitions, this is the validation:

nvidia@ubuntu:~$ zcat /proc/config.gz | egrep 'CONFIG_KGDB|KDGB|CONFIG_FRAME_POINTER|CONFIG_WATCHDOG|IKCONFIG'                                                                                   
CONFIG_IKCONFIG=y                                                                                                                                                                                
CONFIG_IKCONFIG_PROC=y                                                                                                                                                                           
CONFIG_WATCHDOG=y                                                                                                                                                                                
CONFIG_WATCHDOG_CORE=y                                                                                                                                                                           
CONFIG_WATCHDOG_NOWAYOUT=y                                                                                                                                                                       
CONFIG_WATCHDOG_HANDLE_BOOT_ENABLED=y                                                                                                                                                            
CONFIG_WATCHDOG_OPEN_TIMEOUT=0                                                                                                                                                                   
# CONFIG_WATCHDOG_SYSFS is not set                                                                                                                                                               
# CONFIG_WATCHDOG_PRETIMEOUT_GOV is not set                                                                                                                                                      
CONFIG_FRAME_POINTER=y                                                                                                                                                                           
CONFIG_KGDB=y                                                                                                                                                                                    
CONFIG_KGDB_HONOUR_BLOCKLIST=y                                                                                                                                                                   
CONFIG_KGDB_SERIAL_CONSOLE=y                                                                                                                                                                     
# CONFIG_KGDB_TESTS is not set                                                                                                                                                                   
CONFIG_KGDB_KDB=y                                                                                                                                                                                
nvidia@ubuntu:~$ 

Now, I tried to enable the KGDB using sysfs as mentioned here: Debugging the Kernel — NVIDIA Jetson Linux Developer Guide 1 documentation

nvidia@ubuntu:~$ sudo su                                                                                                                                                                         
[sudo] password for nvidia:                                                                                                                                                                                                                                                                                                                                         
root@ubuntu:/home/nvidia# echo ttyAMA0,115200 > /sys/module/kgdboc/parameters/kgdboc                                                                                                                                                                                                                                                                                 
root@ubuntu:/home/nvidia# echo -n g > /proc/sysrq-trigger                                                                                                                                        
[  185.893987] sysrq: DEBUG                                                                                                                                                                      
                                                                                                                                                                                                 
Entering kdb (current=0xffff6dffc92ce740, pid 1789) on processor 0 due to Keyboard Entry                                                                                                         
[0]kdb> 

At this point, everything seems to be as expected from the documentation, however, once the board enters the kdb mode I am unable to write anything on the serial console, this is using the same serial port and terminal to set the KGD mode with sysfs.

Since it seems to be waiting for something I also tried using the GDB from the host as mentioned in the second section but fail.ed as well:

fallasg@pc:/opt/l4t-gcc-toolchain-64-bit/bin$ ./aarch64-linux-gdb /home/fallasg/jetpack/JetPack_5.1.2_Linux_JETSON_AGX_ORIN_TARGETS/Linux_for_Tegra/images/vmlinux
GNU gdb (GDB) 8.3.1
Copyright (C) 2019 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=x86_64-pc-linux-gnu --target=aarch64-buildroot-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"...
--Type <RET> for more, q to quit, c to continue without paging--
Reading symbols from /home/fallasg/jetpack/JetPack_5.1.2_Linux_JETSON_AGX_ORIN_TARGETS/Linux_for_Tegra/images/vmlinux...
(gdb) 
(gdb) set remotebaud 115200
No symbol "remotebaud" in current context.
(gdb) target remote /dev/ttyACM0
Remote debugging using /dev/ttyACM0

help
Ignoring packet error, continuing...
warning: unrecognized item "timeout" in "qSupported" response

help
Ignoring packet error, continuing...
Remote replied unexpectedly to 'vMustReplyEmpty': timeout
(gdb) 

Just wondering if I am setting something wrong.
Any help is appreciated and thanks in advance.

Hi greivin.fallas

For the KGDB, it seems we don’t support it in Jetpack 5. We are working on removing the related information in developer guide.
The reason is about Tegra Combined UART is implemented with interrupt. The KGDB needs it working with polling.
As a result, you have to use another UART interface to output debug message and implement KGDB on it with polling enabled.

1 Like

Hi KevinFFF,

So, will it work using an USB port and the serial output?

You have to re-direct the debug message to another UART interface first., but we haven’t verified this use case currently.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.