Chapter 6. kgdb and kdb interoperability

Table of Contents

Switching between kdb and kgdb
Switching from kgdb to kdb
Change from kdb to kgdb
Running kdb commands from gdb

It is possible to transition between kdb and kgdb dynamically. The debug core will remember which you used the last time and automatically start in the same mode.

Switching between kdb and kgdb

Switching from kgdb to kdb

There are two ways to switch from kgdb to kdb: you can use gdb to issue a maintenance packet, or you can blindly type the command $3#33. Whenever kernel debugger stops in kgdb mode it will print the message KGDB or $3#33 for KDB. It is important to note that you have to type the sequence correctly in one pass. You cannot type a backspace or delete because kgdb will interpret that as part of the debug stream.

  1. Change from kgdb to kdb by blindly typing:

    $3#33

  2. Change from kgdb to kdb with gdb

    maintenance packet 3

    NOTE: Now you must kill gdb. Typically you press control-z and issue the command: kill -9 %

Change from kdb to kgdb

There are two ways you can change from kdb to kgdb. You can manually enter kgdb mode by issuing the kgdb command from the kdb shell prompt, or you can connect gdb while the kdb shell prompt is active. The kdb shell looks for the typical first commands that gdb would issue with the gdb remote protocol and if it sees one of those commands it automatically changes into kgdb mode.

  1. From kdb issue the command:

    kgdb

    Now disconnect your terminal program and connect gdb in its place

  2. At the kdb prompt, disconnect the terminal program and connect gdb in its place.