Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ kadb(8S) — SunOS 3.4

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

> 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 any standalone program. 

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.  When running other standalone programs under kadb , the abort sequence will pass control to the PROM monitor.  kadb is then invoked from the monitor 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 with the monitor command g fd00000).  kadb’s user interface is similar to adb. Note that kadb prompts with

kadb>

Most adb commands function in kadb 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 PROM monitor command c will return control to kadb. As with “adb −k”, $p works when debugging UNIX kernels (by actually mapping in new user pages).  The verbs ?  and / are equivalent in kadb , since there is only one address space in use. 

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. 

USAGE

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

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 filesystem.  The kadb command $M lists macros known to kadb. 

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. 

Automatic Rebooting with Kadb

You can set up your workstation 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.) 

Kadb on a Diskless Workstation

If your workstation is set up to boot over the network from a partition other than pub0, then you should patch the short kadb variable “ndbootdev” to be “0x0”, for the private nd partition, or “0x41”, for the pub1 nd partition.  This will insure that the file to be debugged and kadb come from the same nd filesystem. 

If “ndbootdev” is not patched, then you must be explicit when booting with kadb.  Use the command

> b kadb -d

so that kadb will prompt for the program to be debugged.  At the prompt use the commmand

kadb: device( , , p)filename

where p is “0x1” for the pub1 nd partition or “0x40” for the private nd partition.  Note that these values for p (partition) will work if the file to be debugged is in the same filesystem as kadb. 

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.4  —  Last change: 7 April 1987

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