Building Blocks
The target is the program being inspected by the debugger. MDB currently
provides support for the following types of targets:
User processes
User process core files
Live operating system without kernel execution control (through /dev/kmem and /dev/ksyms)
Live operating system with kernel execution control (through the kmdb(1) command)
Operating system crash dumps
User process images recorded inside an operating system crash dump
ELF object files
Raw data files
Each target exports a standard set of properties, including one or more address
spaces, one or more symbol tables, a set of load objects, and
a set of threads. Figure 2-1 shows an overview of the MDB architecture, including two
of the built-in targets and a pair of sample modules.
A debugger command, or dcmd (pronounced dee-command) in MDB terminology, is a
routine in the debugger that can access any of the properties of the
current target. MDB parses commands from standard input, then executes the corresponding
dcmds. Each dcmd can also accept a list of string or numerical
arguments, as shown in Syntax. MDB contains a set of built-in dcmds that
are always available. These built-in dcmds are described in Chapter 5, Built-In Commands. You
can also extend the capabilities of MDB by writing dcmds using a programming
API provided with MDB.
A walker is a set of routines that describe how to walk, or
iterate, through the elements of a particular program data structure. A walker
encapsulates the data structure's implementation from dcmds and from MDB. You can
use walkers interactively, or you can use walkers as primitives to build other
dcmds or walkers. As with dcmds, you can extend MDB by implementing
additional walkers as part of a debugger module.
A debugger module, or dmod (pronounced dee-mod), is a dynamically loaded library
that contains a set of dcmds and walkers. During initialization, MDB attempts
to load dmods corresponding to the load objects present in the target.
You can subsequently load or unload dmods at any time while running MDB.
MDB provides a set of standard dmods for debugging the Solaris kernel.
A macro file is a text file that contains a set of commands to
execute. Macro files are typically used to automate the process of displaying a
simple data structure. MDB provides complete backward compatibility for the execution of
macro files written for adb. The set of macro files
provided with the Solaris installation can therefore be used with either tool.
Figure 2-1 MDB architecture