<?Pub CX solbook(?><chapter id="intro-1"><?Pub Tag atict:info tracking="off" ref="4"?><?Pub Tag atict:user
user="ae149097" fullname="Alta Elstad"?><title>Modular Debugger Overview</title><highlights><para>The Modular Debugger (MDB) is a general purpose debugging tool for the
Solaris OS whose primary feature is its extensibility.  This book describes
how to use MDB to debug complex software systems, with a particular emphasis
on the facilities available for debugging the Solaris kernel and associated
device drivers and modules.  The book also includes a complete reference for
and discussion of the MDB language syntax, debugger features, and MDB Module
Programming API.</para>
</highlights><sect1 id="chapter-2"><title>Introduction</title><para>Debugging is the process of analyzing the execution and state of a software
program in order to remove defects.  Traditional debugging tools provide facilities
for execution control so that programmers can execute programs in a controlled
environment and display the current state of program data or evaluate expressions
in the source language used to develop the program. Unfortunately, these techniques
are often inappropriate for debugging complex software systems such as:</para><itemizedlist><listitem><para>An operating system, where bugs might not be reproducible
and program state is massive and distributed</para>
</listitem><listitem><para>Programs that are highly optimized or have had their debug
information removed</para>
</listitem><listitem><para>Programs that are themselves low-level debugging tools</para>
</listitem><listitem><para>Customer situations where the developer can only access post-mortem
information</para>
</listitem>
</itemizedlist><para>MDB provides a completely customizable environment for debugging these
programs and scenarios, including a dynamic module facility that you can use
to implement your own debugging commands to perform program-specific analysis.
Each MDB module can be used to examine the program in several different contexts,
including live and post-mortem. The Solaris OS includes a set of MDB modules
that help you debug the Solaris kernel and related device drivers and kernel
modules. Third-party developers might want to develop and deliver their own
debugging modules for supervisor or user software.</para>
</sect1><sect1 id="chapter-8"><title>MDB Features</title><para>MDB provides an extensive collection of features for analyzing the Solaris
kernel and other target programs. You can do the following tasks in MDB:</para><itemizedlist><listitem><para>Perform post-mortem analysis of Solaris kernel crash dumps
and user process core dumps. MDB includes a collection of debugger modules
that facilitate sophisticated analysis of kernel and process state, in addition
to standard data display and formatting capabilities.  These debugger modules
enable you to formulate complex queries to investigate kernel and process
state in the following ways:</para><itemizedlist><listitem><para>Locate all the memory allocated by a particular thread</para>
</listitem><listitem><para>Print a visual picture of a kernel STREAM</para>
</listitem><listitem><para>Determine what type of structure a particular address refers
to</para>
</listitem><listitem><para>Locate leaked memory blocks in the kernel</para>
</listitem><listitem><para>Analyze memory to locate stack traces</para>
</listitem>
</itemizedlist>
</listitem><listitem><para>Use a first-class programming API to implement your own debugger
commands and analysis tools without having to recompile or modify MDB. In
MDB, debugging support is implemented as a set of loadable modules (shared
libraries that the debugger can open with the <olink targetdoc="refman3a" targetptr="dlopen-3c" remap="external"><citerefentry><refentrytitle>dlopen</refentrytitle><manvolnum>3C</manvolnum></citerefentry></olink> function), each of which
provides a set of commands that extends the capabilities of MDB. MDB provides
an API of core services, such as the ability to read and write memory and
access symbol table information. MDB provides a framework for you to implement
debugging support for your own drivers and modules. Your command and tools
can then be made available for everyone to use.</para>
</listitem><listitem><para>Learn to use MDB if you are already familiar with the legacy
debugging tools <command>adb</command> and <command>crash</command>. MDB provides
backward compatibility with these existing debugging solutions. The MDB language
is a superset of the <command>adb</command> language. All existing <command>adb</command> macros
and commands work within MDB. Thus, developers who use <command>adb</command> can
immediately use MDB without knowing any MDB-specific commands.  MDB also provides
commands that surpass the functionality available from the <command>crash</command> utility.</para>
</listitem><listitem><para>Benefit from enhanced usability features.  MDB provides many
usability features, including the following:</para><itemizedlist><listitem><para>Command-line editing</para>
</listitem><listitem><para>Command history</para>
</listitem><listitem><para>Built-in output pager</para>
</listitem><listitem><para>Syntax error checking and handling</para>
</listitem><listitem><para>Online help</para>
</listitem><listitem><para>Interactive session logging</para>
</listitem>
</itemizedlist>
</listitem>
</itemizedlist>
</sect1><sect1 id="intro-27"><title>Using MDB</title><para>MDB is available on Solaris systems as two commands that share common
features: <command>mdb</command> and <command>kmdb</command>. You can use
the <command>mdb</command> command interactively or in scripts to debug live
user processes, user process core files, kernel crash dumps, the live operating
system, object files, and other files. You can use the <command>kmdb</command> command
to debug the live operating system kernel and device drivers when you also
need to control and halt the execution of the kernel. To start <command>mdb</command>,
use the <command>mdb</command> command as described in the <olink targetdoc="refman1" targetptr="mdb-1" remap="external"><citerefentry><refentrytitle>mdb</refentrytitle><manvolnum>1</manvolnum></citerefentry></olink> man page. To start <command>kmdb</command>,
boot the system as described in the <olink targetdoc="refman1" targetptr="kmdb-1" remap="external"><citerefentry><refentrytitle>kmdb</refentrytitle><manvolnum>1</manvolnum></citerefentry></olink> man
page, or execute the <command>mdb</command> command with the <option>K</option> option.</para>
</sect1><sect1 id="chapter-26"><title>Future Enhancements</title><para>MDB provides a stable foundation for developing advanced post-mortem
analysis tools. Each Solaris release includes additional MDB modules that
provide even more sophisticated functionality for debugging the kernel and
other software programs. You can use MDB to debug existing software programs,
and you can develop your own modules to improve your ability to debug your
own Solaris drivers and applications.</para>
</sect1>
</chapter><?Pub *0000007229 0?>