KGDB — User Commands
NAME
kgdb − A kernel debugger based on GDB
SYNOPSIS
kgdb [-mtm] [gdb options] [kernel]
OPTIONS
−mtmInvoke the debugger for the target machine given by tm. If specified, this option must proceed all other options. The list of available target machines include sun2, sun3, sun4, and spur.
See the GNU GDB documentation for information about the rest of the available options.
DESCRIPTION
Kgdb is a version of the GNU gdb debugger modified to debug Sprite kernels. This manual page only describes the parts of kgdb that differ from gdb. The reader is referred to the GNU GDB documentation and gdb manual page for a complete description of gdb.
DIFFERENCES FROM GDB
The "attach" and "detach" commands of kgdb differ from those of gdb.
attach machine
The attach command of kgdb takes as an argument the hostname or internet address of a Sprite machine to debug. The command assumes that the specified machine is in the kernel debugging stub and will wait for the machine to enter the debugger. Once the connection to the machine is established, the trap condition and any unprinted syslog messages are displayed.
detach [cont]
The detach command breaks the connection between kgdb and the currently attached machine. If any argument is specified, the machine is continued before the connection is detached. When used with the "attach" command, the "detach" command allows debugging multiple machines from the same kgdb session.
ADDITIONS TO GDB
Kgdb supports several commands not found in gdb. The commands are:
pid proc-id
The pid command sets the focus of the debugger on the process whose process id is proc-id. Once a process is choosen with the pid command, all stack reference commands such as "backtrace" and "frame" will reference this process’s stack. For example, the command "pid 0xa1139" followed by the "backtrace" command will display a stack backtrace of the process with pid of 0xa1139. Note that proc-id can be any expression supported by kgdb.
reboot [string]
The reboot command reboots the current attached machine. The optional argument string is passed to the kernel routine Mach_MonReboot. Note that this command is the same as typing "print Mach_MonReboot(string)" followed by a break and a detach command except that the reboot command will work even if no symbol table is loaded.
version
The version command prints the kernel version string of the attached machine. This command outputs the same information as the command "print SpriteVersion()" but like the "reboot" command doesn’t require a symbol table to be loaded.
debug hostname
The debug command is similar to the attach command differing only in the case when the specified machine is not already in the debugging stub. Rather than waiting for the machine to enter the debugger like the attach command, the debug command will force the machine into the debugger using the kmsg program. In order for this command to work, the kmsg program must be available in the current search path of kgdb. Because of its anti-social possiblities, caution is urged in the use of the debug command.
DELETIONS FROM GDB
Several features of gdb are not available in kgdb because they don’t apply to kernel debugging. Missing features include the ability to start and kill programs with the "run" and "kill" commands; to change the program’s environment and terminal characteristics with the "set-env", "unset-env", "set-args", and "tty" commands; and to handle signals with "handle" and "signal" commands. Additionaly, gdb’s core file processing such as the core command are also not available in kgdb.
KEYWORDS
gdb, kernel, debugging, kmsg
Sprite version 1.0 — October 18, 1990