Kernel parameter: kgdboc

Using kgdboc

The kgdboc driver was originally an abbreviation meant to stand for "kgdb over console". Kgdboc is designed to work with a single serial port. It was meant to cover the circumstance where you wanted to use a serial console as your primary console as well as using it to perform kernel debugging. Of course you can also use kgdboc without assigning a console to the same port.

Using kgdboc

You can configure kgdboc via sysfs or a module or kernel boot line parameter depending on if you build with CONFIG_KGDBOC as a module or built-in.

  1. From the module load or build-in

    kgdboc=<tty-device>,[baud]

    The example here would be if your console port was typically ttyS0, you would use something like kgdboc=ttyS0,115200 or on the ARM Versatile AB you would likely use kgdboc=ttyAMA0,115200

  2. From sysfs

    echo ttyS0 > /sys/module/kgdboc/parameters/kgdboc

NOTE: Kgdboc does not support interrupting the target via the gdb remote protocol. You must manually send a sysrq-g unless you have a proxy that splits console output to a terminal problem and has a separate port for the debugger to connect to that sends the sysrq-g for you.

When using kgdboc with no debugger proxy, you can end up connecting the debugger for one of two entry points. If an exception occurs after you have loaded kgdboc a message should print on the console stating it is waiting for the debugger. In case you disconnect your terminal program and then connect the debugger in its place. If you want to interrupt the target system and forcibly enter a debug session you have to issue a Sysrq sequence and then type the letter g. Then you disconnect the terminal session and connect gdb. Your options if you don't like this are to hack gdb to send the sysrq-g for you as well as on the initial connect, or to use a debugger proxy that allows an unmodified gdb to do the debugging.