Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ kadb(1M) — SunOS 5.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

adb(1)

boot(1M)

kadb(1M)

NAME

kadb − a kernel debugger

SYNOPSIS

> run kadb [ −d ] [ b-flags ]

AVAILABILITY

SUNWcar

DESCRIPTION

kadb is an interactive debugger with a user interface similar to that of adb(1), the assembly language debugger.  kadb must be loaded prior to the standalone program it is to debug.  It runs with the same environment as that of the standalone program, so it shares many resources with that program.  The debugger is cognizant of and able to control multiple processors, should they be present in a system. 

Unlike adb, kadb runs in the same supervisor virtual address space as the program being debugged — although it maintains a separate context.  The debugger runs as a co-process that cannot be killed (no ‘:k’) or rerun (no ‘:r’).  There is no signal control (no ‘:i’, ‘:t’, or ‘$i’), although the keyboard facilities (CTRL−C, CTRL−S, and CTRL−Q) are simulated. 

In the case of the UNIX system kernel, the keyboard abort sequence (CTRL-ALT-d for console ) will suspend kernel operations and break into the debugger.  kadb gives a prompt as:

kadb[#] where # is the CPU it is currently executing on. 

Since the kernel is really made up of the core image file (/kernel/unix) and the set of loadable modules already in memory, kadb has the capability of debugging all of these by traversing special data structures.  kadb makes use of this feature to allow it to reference any kernel data structure, even if it resides in a loadable module.  kadb will set the ’−d’ flag by default so the program being debugged can tell it is being watched.  If this flag is not given, kadb will load and immediately run the default kernel (/kernel/unix). 

Most adb commands function as expected.  The verbs ?  and / are equivalent in kadb since there is really only one address space in use. 

Additional Or Different Commands

kadb has the following additional commands.  (Note: for the general syntax of adb commands, see adb(1).) 

[ Like :e in adb(1), but requires only one keystroke and no RETURN character. 

] Like :s in adb(1), but requires only one keystroke and no RETURN character. 

/v Like /w in adb(1), but writes only bytes at a time. 

:a Sets a hardware access breakpoint using the processor hardware facilities. The syntax and action for this is the same as :b in adb(1), with the following exceptions.  First, the length of a hardware breakpoint when set must match the length during an access. See $l below for setting the length of a hardware breakpoint.  Second, for an access to be detected it must complete the instruction that caused the access. This means that this breakpoint will stop after the access not before.  Third, there are a limited number of hardware breakpoint registers and when set this will use one. Last, since this breakpoint does not modify memory locations this will work on locations that are not in core at the time the breakpoint is set. 

:w Like :a above, but will only breakpoint on a write to the specified address. 

:p Like :a above, but will only breakpoint when an instruction at the specified address is run. Note that the $l operation has no effect on this type of breakpoint. 

$l Sets the default data length for an access or write breakpoint.  The syntax for this command is [length]$l.  Length can be set to one for byte, two for short and 4 for long word accesses. If length is left off byte will be assumed.  Once set this value will affect any newly set access or write breakpoints. But will not affect ones set before this operation. 

$b Has two additional columns that adb(1) does not have. The first is the type column which indicates soft for a normal breakpoint, access for an access hardware breakpoint, write for a write hardware breakpoint, and inst for an instruction hardware breakpoint.  The second is the len column which for access and write breakpoints indicate the length of the operation to break on. 

:i will input a byte for display from the address specified io port.  For example 330:i will input from address port 330. 

:o will output a byte to the address specified io port.  [address],[data]:o will output data byte to address io port.  For example 330,80:o will output 80 to address port 330. 

OPTIONS

−d If this flag is given, kadb will stop after it is loaded and wait for the user to enter the name of a program to debug.  The default name will be given in square brackets ([]).

boot-flags
See the appropriate manual page for flags (args) used by boot(1M). 

USAGE

Kernel Macros

As with adb, macros can be compiled and used with kadb, but they must be linked into kadb directly and not read from a file at runtime.  The $M command lists macros currently complied into kadb. 

FILES

/kadb the debugger itself

/kernel/unix the default kernel

SEE ALSO

adb(1), boot(1M)

DIAGNOSTICS

kadb gives the same cryptic response as adb. 

BUGS

kadb does not support the floating-point processor at this time.  kadb has no way of displaying built in macros. 
 

SunOS 5.1  —  Last change: 31 May 1993

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026