The Modular Debugger (MDB) is a highly extensible, general purpose debugging tool for the illumosTM Operating System. The Modular Debugger Guide describes how to use MDB to debug complex software systems, with a particular emphasis on the facilities available for debugging the illumos kernel and associated device drivers and modules. It also includes a complete reference for and discussion of the MDB language syntax, debugger features, and MDB Module Programming API.

This illumos release supports systems that use the SPARCTM and x86 families of processor architectures: UltraSPARCTM, SPARC64, AMD64, Pentium, and Xeon EM64T. In this document the term “x86” refers to 64-bit and 32-bit systems manufactured using processors compatible with the AMD64 or Intel Xeon/Pentium product families. For supported systems, see the illumos Hardware Compatibility Lists. This document cites any implementation differences between the platform types.

What's New in MDB

Aug 2012 kmdb supports ttyc and ttyd

May 2012 Added tab completion support

Mar 2012 ::printf dcmd added

Aug 2011 Added 16-bit disassembler support

Who Should Use This Book

If you were a detective and were investigating at the scene of a crime, you might interview the witnesses and ask them to describe what happened and who they saw. However, if there were no witnesses or these descriptions proved insufficient, you might consider collecting fingerprints and forensic evidence that could be examined for DNA to help solve the case. Often, software program failures divide into analogous categories: problems that can be solved with source-level debugging tools, and problems that require low-level debugging facilities, examination of core files, and knowledge of assembly language to diagnose and correct. MDB facilitates analysis of this second class of problems.

MDB is most useful when you are programming a complex low-level software system such as an operating system. The MDB debugging framework allows you to construct your own custom analysis tools to aid in the diagnosis of these low-level problems. MDB also provides a powerful set of built-in commands that enable you to analyze the state of your program at the assembly language level.

Before You Read This Book

If you are not familiar with assembly language programming and debugging, Related Books and Papers provides references to materials that you might find useful.

You should disassemble various functions of interest in the programs you will be debugging in order to familiarize yourself with the relationship between your program's source code and the corresponding assembly language code. If you are planning to use MDB for debugging illumos kernel software, read carefully Kernel Debugging Modules and Debugging With the Kernel Memory Allocator. These chapters provide more detailed information on the MDB commands and facilities provided for debugging illumos kernel software.

How This Book Is Organized

Modular Debugger Overview provides an overview of the debugger.

Debugger Concepts describes the MDB architecture and explains the terminology for the debugger concepts used throughout this book.

MDB Language Syntax describes the syntax, operators and evaluation rules for the MDB language.

Using MDB Commands Interactively describes the MDB interactive command-line editing facilities and output pager.

Built-In Commands describes the set of built-in debugger commands that are always available.

Execution Control describes the MDB facilities for controlling the execution of live running programs. This chapter is intended for application developers and device driver developers. Execution control features might also be useful for system administrators.

Kernel Execution Control describes the MDB facilities for controlling the execution of the live operating system kernel that are specific to kmdb. This chapter is intended for operating system kernel developers and device driver developers.

Kernel Debugging Modules describes the set of loadable debugger commands that are provided for debugging the illumos kernel. This chapter is intended for users who intend to examine illumos kernel crash dumps and for kernel software developers.

Debugging With the Kernel Memory Allocator describes the debugging features of the illumos kernel memory allocator and the MDB commands provided to take advantage of these features. This chapter is intended for advanced programmers and kernel software developers.

Module Programming API describes the facilities for writing loadable debugger modules. This chapter is intended for advanced programmers and software developers who intend to develop custom debugging support for MDB.

Options provides a reference for MDB command-line options.

Notes provides warnings and notes about using the debugger.

Transition From adb and kadb provides a reference for adb commands and their MDB equivalents. The adb command is implemented by mdb.

Transition From crash provides a reference for crash commands and their MDB equivalents. The crash command is no longer present in illumos.

Related Books and Papers

The following books and papers are recommended and related to the tasks that you need to perform:

Third-party URLs are referenced in this document and provide additional, related information.

Sun is not responsible for the availability of third-party web sites mentioned in this document. Sun does not endorse and is not responsible or liable for any content, advertising, products, or other materials that are available on or through such sites or resources. Sun will not be responsible or liable for any actual or alleged damage or loss caused or alleged to be caused by or in connection with use of or reliance on any such content, goods, or services that are available on or through such sites or resources.

Typographic Conventions

The following table describes the typographic conventions that are used in this book.

Typographic Conventions





The names of commands, files, and directories, and onscreen computer output

Edit your .login file.

Use ls -a to list all files.

machine_name% you have mail.


What you type, contrasted with onscreen computer output

machine_name% su



Placeholder: replace with a real name or value

The command to remove a file is rm filename.


Book titles, new terms, and terms to be emphasized

Read Chapter 6 in the User's Guide.

A cache is a copy that is stored locally.

Do not save the file.

Note: Some emphasized items appear bold online.

Shell Prompts in Command Examples

The following table shows the default UNIXTM system prompt and superuser prompt for the C shell, Bourne shell, and Korn shell.

Shell Prompts



C shell


C shell for superuser


Bourne shell and Korn shell


Bourne shell and Korn shell for superuser