OpenSolaris

You are not signed in. Sign in or register.

MDB Tips and Tricks

This page will serve as a repository of useful tools, documentation, procedures, or anything else relating to MDB. If you have a favorite dcmd invocation, a new MDB module, or a script built around MDB, please post the information to the MDB forum and we'll make sure to archive it here.

MDB Cheatsheet

A great quick reference put together by Jonathan Adams. You can find the PDF version here, and a postscript version here.

Stack Munger

munges is a neat shell script written by Dave Powell to coalesce similar stacks. See it in action:

> ::walk thread | ::findstack
stack pointer for thread fffffffffbc21c40: fffffffffbc44050
[ fffffffffbc44050 _resume_from_idle+0xde() ]
  fffffffffbc44080 swtch+0xdf()
  fffffffffbc44120 sched+0x8ef()
  fffffffffbc44170 main+0x478()
  fffffffffbc44180 _start+0x95()
stack pointer for thread fffffe8000005c80: fffffe8000005ae0
  fffffe8000005b30 _interrupt+0x190()
  fffffe8000005b70 lock_set_spl+0x1d()
  fffffe8000005bc0 restore_mstate+0xc7()
…
> ::walk thread | ::findstack ! munges
73      ##################################  tp: fffffe800000bc80
    swtch+0xdf()
    cv_wait+0x6a()
    taskq_thread+0x1ef()
    thread_start+8()
53      ##################################  tp: fffffe80fded0000
    swtch+0xdf()
    cv_wait_sig_swap_core+0x177()
    cv_wait_sig_swap+0xb()
    cv_waituntil_sig+0xd7()
    poll_common+0x52b()
    pollsys+0xbe()
    sys_syscall32+0x1ff()
…

This is incredibly useful when diagnosing system hangs (as threads tend to pile up on the same locks) or eliminating unnecessary output.

Useful Blog Entries

Here's a list of MDB-related blog entries. This is a combination of manual searching and Technorati Tags. To get your blog on this radar for the future, make sure to include a Technorati MDB tag in your post. Just click on the 'Date' link below to get to the associated post. If you have an old post that should be featured here, email Eric dot Schrock at sun dot com.

DateAuthorTitle
7/18/07John LevonSolaris Xen Update
5/20/07JJMoraBuceando en el Kernel con mdb (III)
1/10/07Peter Harveypfiles(1), locked files and a pinch of salt
12/16/06Chris GerhardHow to shoot yourself in the foot with MDB
3/8/06Eric LoweExamining the Anatomy of a Process
3/6/06Eric LoweExamining the Solaris Kernel
6/24/05Fintan RyanMDB ::eval
6/24/05Eric SchrockMDB puzzle, take two
6/23/05Eric SchrockMDB puzzle
6/17/05Eric SchrockGDB to MDB migration, part two
6/17/05Ashish MehtaA race erased
6/15/05Rich McDougallAdding your own performance statistics to Solaris
6/15/05Alexander KolbasovMDB for STREAMS
6/14/05Mike ShapiroSendmail Died in a Two SIGALRM Fire
6/14/05Matt SimmonsKMDB design
6/14/05Adam LeventhalDebugging cross calls on Solaris
6/14/05Jonathan AdamsThe implementation of ::findleaks
6/14/05Will FiveashPlaying with Solaris memory debuggers
6/14/05Jan ParcelMy mdb-writing adventure
6/14/05Eric KustarzNFSv4 Client's Recovery Messages
6/14/05Alok AggarwalDebugging on SPARC
6/14/05Stephen Hahnlibuutil and designing for debuggability
6/14/05Eric SaxeDebugging Solaris Scheduling Problems
6/14/05Bart SmaaldersDoing the jitter bug
6/8/05Yu XiangningHellow world in a KMDB module
5/24/05Saurabh Mishra::cpupart -v for mdb(1m)
5/11/05Eric SchrockGDB to MDB migration, part one
4/1/05MrBenchmarkMemory page coalescing update and Solaris 10
2/15/05Fintan Ryanmdb core
2/2/05Eric Schrock::whatthread and MDB modules
11/19/05Eric SchrockDebugging on AMD64 – Part Two
10/7/04Jonathan Adamsmdb(1) background, intro, and cheatsheet
10/3/04Alan CoopersmithAn idle hack
9/30/04comandLearn mdb in 30 minutes
9/23/04Eric SchrockDebugging hard problems
9/15/04Stacey Marshallmdb: drilling sigsegv; by way of an introduction
8/19/04Eric SchrockKernel debugging with KMDB
7/13/04Adam LeventhalNumber 11 of 20: libumem
6/23/04Dave MarquardtUsing MDB to figure out mysterious program behavior
6/20/04Eric SchrockMy kingdom for a crash dump
6/16/04Alan HargreavesKmdb replaces kadb as of build 61