How to debug a custom Linux Kernel on a remote machine?
I have a remote machine with a custom-built Linux Kernel originally from 5.6.8. The system under the kernel is running into problems which I want to fix. The kgdb-related options are
CONFIG_KGDB=y
CONFIG_KGDB_SERIAL_CONSOLE=y
# CONFIG_KGDB_TESTS is not set
CONFIG_KGDB_LOW_LEVEL_TRAP=y
CONFIG_KGDB_KDB=y
The kgdboc
module is compiled builtin. The documentation of kgdb describes how to use terminal with a serial port. Here is how it is configured on the remote machine:
root@remote-pc:# cat /sys/module/kgdboc/parameters/kgdboc
ttyS0,115200
Using ssh
I issued
root@remote-pc:~# echo g > /proc/sysrq-trigger
And after running gdb vminux
what port should I use to connect to the remote Kernel?
(gdb) target remote remote-pc:__what_port?__
kgdboe
? – Cheatahkgdboe
(onlykgdboc
is not documented under the doc page I linked) – Some Name