KernelDebugRef - Entering the Debugger
Reprint Courtesy of International Business Machines Corporation, © International Business Machines Corporation
There are various ways to enter the debugger. The first way is during initialization. If the following keys are pressed at the debugger's console, the debugger is entered:
- r - (lowercase r) enters the debugger at the beginning of system kernel initialization in real mode. This is very early in system initialization.
- p - enters the debugger after going into protected mode for the first time. Symbols have not been loaded yet.
- <space-bar> - enters the debugger after most of the kernel has been initialized. Symbols for the system kernel have been loaded.
After initialization is complete, the debugger can be entered at any time by pressing Ctrl+C at the debugger's console. The debugger is entered when and where the next timer tick occurs after the keys were pressed. This is the most commonly used method to enter the debugger.
An NMI (non-maskable interrupt) switch allows you to enter the debugger even if interrupts are disabled. Pressing Ctrl+C does not allow this.
An INT 3 in the kernel or in a program will also cause the debugger to stop.
A kernel panic is an event where the OS/2 kernel enters a state where it cannot continue to run the system with pure integrity.
When a kernel panic occurs, a message is sent to both the screen and the debugger port. Before sending the message to the screen, the screen is cleared and set to text mode. This can be a problem if you need to see how far a test case got before stopping. If you set the byte flag fDebugOnly to nonzero, the message goes to the debug port only, and the screen is left unchanged.
After symbols are loaded, an initialization file named KDB.INI is read and executed. KDB.INI is a plain text file that, if used, resides in the root directory of the startup drive. Any debugger command or list of debugger commands can be in the KDB.INI file. A G command should be at the end of the commands unless you want the debugger to stop after the KDB.INI file is executed.