Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

adb(1)

boot(8S)

KADB(8S)  —  MAINTENANCE COMMANDS

NAME

kadb − adb-like kernel and standalone-program debugger

SYNOPSIS

L1-A
> b kadb [ −d ] [ boot-flags ]

DESCRIPTION

kadb is an interactive debugger that is similar in operation to adb(1), and runs as a standalone program under the PROM monitor.  You can use kadb to debug the UNIX kernel, or to debug the standalone program of your choice. 

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 coprocess that cannot be killed (no :k) or rerun (no :r).  There is no signal control (no :i, :t, or $i), although the UNIX keyboard facilities (^C,^S and ^Q) are simulated. 

While the kernel is running under kadb, the abort sequence (L1-A or BREAK) causes UNIX to drop into kadb for debugging — as will a system panic.  With other standalone programs, you can invoke kadb from the monitor (after entering the abort sequence) by jumping to the starting address for kadb found in <debug/debug.h> (currently this can be done for both Sun-2 and Sun-3 machines by typing the command g fd00000).  kadb’s user interface is similar to adb, except that kadb prompts with

kadb>

Most adb commands work as expected.  Typing an abort sequence in response to the prompt returns you to the PROM monitor, from which you can examine control spaces that aren’t accessible within adb or kadb.  The monitor command c returns you to kadb. As with “adb −k”, $p works when debugging UNIX kernels (by actually mapping in new user pages).  The adb verbs ?  and / are equivalent, since there is only one address space in use. 

KERNEL MACROS

As with adb, kernel macros are supported.  With kadb, however the macros are compiled into the debugger itself, rather than being read in from the file system.  The kadb command $M lists macros known to kadb. 

AUTOMATIC REBOOTING WITH KADB

You can set up a Sun-3 to automatically reboot kadb by patching the “vmunix” variable in /boot with the string “kadb” instead of “vmunix”.  (Refer to adb in Program Debugging Tools for the Sun Workstation for details on how to patch executables.)  If, however, your Workstation is set up to boot over the network from a partition other than pub0, then you must patch the short kadb variable “ndbootdev” to be “0x0”, for the private nd partition, or “0x41” for the pub1 nd partition. 

OPTIONS

kadb is booted from the PROM monitor as a standalone program.  If you omit the −d flag, kadb automatically loads and runs vmunix from the filesystem kadb was loaded from.  The kadb “vmunix” variable can be patched to change the default program to be loaded. 

−d Interactive startup.  Prompts with

kadb:

for a file to be loaded.  From here, you can enter a boot sequence line to load a standalone program.  Boot flags entered in response to this prompt are included with those already set and passed to the program.  If you type a carriage return only, kadb loads vmunix (from the filesystem that kadb was loaded from). 

boot-flags
You can specify boot flags as arguments when invoking kadb.  Note that kadb always sets the −d (debug) boot flag, and passes it to the program being debugged. 

SETTING BREAKPOINTS

Self-relocating programs such as the Sun-3 kernel need to be relocated before breakpoints can be used.  To set the first breakpoint for such a program, start it with :s; kadb is then entered after the program is relocated (when UNIX initializes its interrupt vectors).  Thereafter, :s single-steps as with adb.  Otherwise, use :c to start up the program. 

USAGE

Refer to adb in Program Debugging Tools for the Sun Workstation . 

FILES

/vmunix
/boot
/kadb
/usr/include/debug/debug.h

SEE ALSO

adb(1), boot(8S)
Program Debugging Tools for the Sun Workstation
Writing Device Drivers for the Sun Workstation

BUGS

There is no floating-point support. 

kadb cannot reliably single-step over instructions that change the status register. 

When sharing the keyboard with UNIX the monitor’s input routines can leave the keyboard in a confued state.  If this should happen, disconnect the keybooard momentarily and then reconnect it.  This forces the keyboard to reset as well as initiating an abort sequence. 

Most of the bugs listed in adb(1) also apply to kadb.

Sun Release 3.2  —  Last change: 2 July 1986

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