From Linux PARISC Wiki
Revision as of 17:55, 4 April 2019 by Sven Schnelle (Talk | contribs)

Jump to: navigation, search

NOTE: kgdb is not merged upstream yet

Required configuration to use KGDB/KDB for kernel debugging

Make sure your .config contains:


If you want to be able to use KDB (a KGDB frontend running on the console):


To enable kdb/kgdb, you need to pass the device you want to use to kgdb, either via sysfs file or palo. My palo configuration looks like this:

0/vmlinuz HOME=/ root=/dev/sda5 panic_timeout=60 panic=10 console=ttyS0,115200 kgdboc=ttyS0,115200
 0: 0/vmlinuz
 1: HOME=/
 2: root=/dev/sda5
 3: panic_timeout=60
 4: panic=10
 5: console=ttyS0,115200
 6: kgdboc=ttyS0,115200
<#>    edit the numbered field
'b'    boot with this command line
'r'    restore command line
'l'    list dir
'x'    reset and reboot machine
? 0

If you want to enable kgdb via sysfs, do

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

Most of the PA-RISC machines have at least two serial ports, so you could also use ttyS1. In my examples i'm using ttyS0, which is also the console port.

Entering kdb

There are several ways to enter kgdb:

  • via 'echo g >/proc/sysrq-trigger
  • sending a break g on the serial console, with minicom that is Ctrl-A f g
  • It will also show up on a kernel crash, as long as there's no panic command line option used

When entered, kdb will look like this:

Entering kdb (current=0xefcccdb0, pid 0) on processor 1 due to Keyboard Entry

The [1] before the kdb prompt is the processor number kdb is currently on.


help shows you the command list:

[1]kdb> help
Command         Usage                Description
md              <vaddr>             Display Memory Contents, also mdWcN, e.g. md8c1
mdr             <vaddr> <bytes>     Display Raw Memory
mdp             <paddr> <bytes>     Display Physical Memory
mds             <vaddr>             Display Memory Symbolically
mm              <vaddr> <contents>  Modify Memory Contents
go              [<vaddr>]           Continue Execution
rd                                  Display Registers
rm              <reg> <contents>    Modify Registers
ef              <vaddr>             Display exception frame
bt              [<vaddr>]           Stack traceback
btp             <pid>               Display stack for process <pid>
bta             [D|R|S|T|C|Z|E|U|I|M|A]
                                   Backtrace all processes matching state flag
btc                                 Backtrace current process on each cpu
btt             <vaddr>             Backtrace process given its struct task address
env                                 Show environment variables
set                                 Set environment variables
help                                Display Help Message
?                                   Display Help Message
cpu             <cpunum>            Switch to new cpu
kgdb                                Enter kgdb mode
ps              [<flags>|A]         Display active task list
pid             <pidnum>            Switch to another task
reboot                              Reboot the machine immediately
lsmod                               List loaded kernel modules
sr              <key>               Magic SysRq key
dmesg           [lines]             Display syslog buffer
defcmd          name "usage" "help" Define a set of commands, down to endefcmd
kill            <-signal> <pid>     Send a signal to a process
summary                             Summarize the system
per_cpu         <sym> [<bytes>] [<cpu>]
                                   Display per_cpu variables
grephelp                            Display help on | grep
bp              [<vaddr>]           Set/Display breakpoints
bl              [<vaddr>]           Display breakpoints
bc              <bpnum>             Clear Breakpoint
be              <bpnum>             Enable Breakpoint
bd              <bpnum>             Disable Breakpoint
ss                                  Single Step
dumpcommon                          Common kdb debugging
dumpall                             First line debugging 
dumpcpu                             Same as dumpall but only tasks on cpus
ftdump          [skip_#lines] [cpu] Dump ftrace log
Personal tools