mdb(1) on Solnix vs Linux and the BSDs
mdb is the illumos modular debugger at /usr/bin/mdb. It is a different tool from gdb and lldb, not a drop-in replacement. It takes commands in the adb(1) syntax plus dcmds, walkers and loadable dmods, and it can inspect the live kernel and crash dumps. Command-line habits from gdb and lldb do not carry over.
The manual pages
- Solnix: mdb(1) from
pkgs.solnix.illumos-world-man· illumos.org - Linux: gdb(1) gdb-17.2 (different command, similar job)
- FreeBSD: lldb(1) 15.1-RELEASE (different command, similar job)
What Solnix runs
A default Solnix system runs the illumos mdb at /usr/bin/mdb. No other variants are shipped. The bundle does not say whether gdb or lldb are installed on Solnix.
Differences
| Compared with | Topic | What differs |
|---|---|---|
| Linux, FreeBSD | command language | mdb reads commands from standard input in an adb-compatible syntax: an expression sets dot, then a dcmd such as / ? = > $ or ::name runs on it. gdb uses commands like break, run, bt and print. The lldb page in the bundle does not describe its commands. Source: Solnix mdb(1) DESCRIPTION, Syntax and Commands; Linux gdb(1) DESCRIPTION (frequently needed commands); FreeBSD lldb(1) DESCRIPTION |
| Linux, FreeBSD | -e meaning | Solnix mdb -e takes an expression to evaluate. gdb -e takes an executable file. lldb -e is an alias for --editor and opens source in an external editor. The same flag does three unrelated things.Source: Solnix mdb(1) SYNOPSIS (-e expr); Linux gdb(1) --exec, -e file; FreeBSD lldb(1) --editor, -e |
| Linux, FreeBSD | -s meaning | Solnix mdb -s takes a distance. gdb -s file reads a symbol table from a file. lldb -s is not in the extracted lldb flags.Source: Solnix mdb(1) SYNOPSIS (-s distance); Linux gdb(1) --symbols, -s file; FreeBSD lldb(1) OPTIONS |
| Linux | attach to a process | Both mdb and gdb accept -p pid to attach to a running process. gdb also accepts the pid as a second argument after the program name. The mdb synopsis shows -p pid, or an optional object/core argument.Source: Solnix mdb(1) SYNOPSIS (-p pid); Linux gdb(1) SYNOPSIS and DESCRIPTION (gdb -p 1234, gdb program 1234) |
| Linux, FreeBSD | core files | On Solnix the core is a positional argument: [object [core] | core | suffix]. gdb also takes it positionally, or with --core/-c file. lldb is given the core with --core/-c filename and the program as the executable argument.Source: Solnix mdb(1) SYNOPSIS; Linux gdb(1) SYNOPSIS, --core; FreeBSD lldb(1) SYNOPSIS, --core |
| Linux, FreeBSD | target types | Solnix mdb documents these targets: user processes, process core files, live bhyve VMs, the live OS (via /dev/kmem and /dev/ksyms), kernel crash dumps, user process images inside a crash dump, ELF object files and raw binary files. The gdb and lldb pages in the bundle describe program and core debugging only. Source: Solnix mdb(1) DESCRIPTION, Definitions; Linux gdb(1) DESCRIPTION; FreeBSD lldb(1) DESCRIPTION |
| Linux, FreeBSD | extension model | mdb is extended with dmods, which are dynamically loaded libraries of dcmds and walkers. mdb tries to load dmods matching the target's load objects at start-up, and you can load or unload them at any time. The bundle's gdb and lldb text describes no equivalent. Source: Solnix mdb(1) DESCRIPTION, Definitions (walker, dmod) |
| Linux, FreeBSD | pipelines and shell escape | A pipeline in mdb with | is not a set of processes: the dcmds run in order inside the debugger, and the pipeline aborts if one fails. A trailing ! sends the last dcmd's output to $SHELL -c with the remaining words.Source: Solnix mdb(1) DESCRIPTION, Syntax and Commands (pipeline, ! word) |
| Linux | scripting and startup files | gdb has --batch, -x file and -ex command, and exits nonzero if a command fails. It also reads .gdbinit files unless -n or --nh is given. The visible mdb text offers -e expr and adb-compatible macro files. It does not say whether mdb reads a startup file.Source: Linux gdb(1) --batch, --command, --eval-command, --nx; Solnix mdb(1) SYNOPSIS (-e expr), DESCRIPTION (macro file) |
| Linux, FreeBSD | expression width | An mdb expression always evaluates to a 64-bit unsigned integer. Expressions in gdb and lldb use source-language semantics. The bundle does not give their integer rules. Source: Solnix mdb(1) DESCRIPTION (expression); Linux gdb(1) DESCRIPTION (print expr) |
Everyday tasks
| Task | Solnix | Linux | FreeBSD |
|---|---|---|---|
| examine a core file | mdb object core | gdb program core | lldb --core filename executable |
| attach to a running process | mdb -p pid | gdb -p pid | — |
| run one command non-interactively | mdb -e expr | gdb --batch -ex command | — |
| run commands from a file | macro files (adb-compatible) | gdb -x file | — |
| inspect the live kernel | mdb with the -k option (live OS target via /dev/kmem and /dev/ksyms) | — | — |
Standards
- POSIX: mdb is not a POSIX.1-2024 utility.
Writing portable scripts
- Do not share debugger command lines between mdb, gdb and lldb:
-eand-smean different things, and the command languages differ. Keep a separate script per tool.
Every difference here is taken from the manual pages linked above: Solnix's published page, Linux (man-pages and the GNU and util-linux manuals), FreeBSD, OpenBSD and NetBSD. Each row names its source. Where a manual is silent, this page is too. Compiled 2026-10-26. Found a mistake? Mail hackers@lists.solnix.io.