Required kernel configuration
Enable the following Kconfig options and rebuild the kernel:Serial setup
KGDB communicates over a serial port using thekgdboc (KGDB over console)
driver.
Kernel command-line parameters
Add the following toKERNEL_CMDLINE_EXTRA in
meta-qcom/conf/machine/include/qcom-<SoC>.conf:
Disable the watchdog
The Qualcomm SoC watchdog resets the device if the kernel stops responding. Disable it before starting a KGDB session to prevent unexpected resets:Enter debug mode
Choose one of the following methods to pause the kernel and activate the KGDB stub.Method 1: kgdbwait (boot-time)
Whenkgdbwait is present on the kernel command line, the kernel stops during
boot and prints the following message on the serial console:
Method 2: Magic SysRq (runtime)
From a shell on the target:Method 3: Compile-time breakpoint
Insert a hard breakpoint in driver source code:Method 4: Kernel panic (exception-driven)
The kernel automatically enters KGDB mode when an unhandled exception or panic occurs. To deliberately trigger a crash for testing:Connect GDB from the host
Installgdb-multiarch on the host machine:
Linux host
Windows host
On Windows, set the COM port number above 16 in Device Manager and use the\\.\comN path syntax:
GDB debug session
Essential GDB commands
Table: GDB command referenceLoad module symbols
To debug a dynamically loaded kernel module, retrieve the.text section
address from the target:

