To use KGDB, it must be enabled in the kernel configuration. To do this, use one of the Linux Kernel Configuration tools, for example:

host% make ARCH=sh CROSS_COMPILE=sh4-linux- xconfig

Select the KGDB option

Kernel hacking ---> KGDB: kernel debugging with remote gdb

Then select how the host is to connect to KGDB, by choosing either:

Method for KGDB Communication (NEW) ---> KGDB: On STASC serial port

or

Method for KGDB Communication (NEW) ---> KGDB: On ethernet

If the ethernet on your target is reliable, then that is the better recommended communication mechanism to use. Debug performance over ethernet is considerably faster than using a serial port.

There is several other KGDB kernel configuration options:

KGDB: Console messages through gdb

redirects the system console through the debugger,

KGDB: Wait for debugger to attach on an unknown exception

will cause the kernel to stop and wait for a debugger to attach using KGDB if a panic or unknown exception occurs, and

Simple selection of KGDB serial port

allows the serial port and baud rate to be set. They can also be set using kernel parameters at boot time.