Eric Schrock's Blog

Month: May 2005

Dave Powell and myself have arrived at FISL, an open source conference in Brazil, along with a crowd of other Sun folks. Dave and I (with introduction from Sun VP Tom Goguen) will be hosting a 4 hour OpenSolaris pre-event tomorrow, June 1st. We’ll be talking about all the cool features available in OpenSolaris, as well as how Solaris development works today and how we hope it will work in the future. If you’re attending the conference, be sure to stop by to learn about OpenSolaris, and what makes Solaris (and Solaris developers) tick. We’ll also be hanging around the Sun booth during the rest of the conference, giving mini-presentations, demos, answering questions, and chatting with anyone who will listen. We’re happy to talk about OpenSolaris, Solaris, Sun, or your favorite scenes from Monty Python and the Holy Grail. Oh yeah, there will be lots of T-shirts and Solaris 10 DVDs as well.

So it looks like my blog made it over to the frontpage of news.com in this article about slipping Solaris 10 features. Don’t get your hopes up – I’m not going to refute Genn’s claims; we certainly are not scheduled for a specific update at the moment. But pay attention to the details: ZFS and Janus will be available in an earlier Solaris Express release. I also find it encouraging that engineers like myself have a voice that actually gets picked up by the regular press (without being blown out of proportion or slashdotted).

I would like to point out that I putback the last major chunk of command redesign to the ZFS gate yesterday 😉 There are certainly some features left to implement, but the fact that I re-whacked all of the userland components (within six weeks, no less) should not be interpreted as any statement of schedule plans. Hopefully I can get into some of the details of what we’re doing but I don’t want to be seen as promoting vaporware (even though we have many happy beta customers) or exposing unfinished interfaces which are subject to change.

I also happen to be involved with the ongoing Janus work, but that’s another story altogether. I swear there’s no connection between myself and slipping products (at least not one where I’m the cause).

Update: So much for not getting blown out of proportion. Leave it to the second tier news sites to turn “not scheduled for an update” into “delayed indefinitely over deficiencies”. Honestly, rewriting 5% of the code should hardly be interpreted as “delayed indefinitely” – so much for legitimate journalism. Please keep in mind that all features will hit Software Express before a S10 Update, and OpenSolaris even sooner.

In past comments, it has been pointed out that a transition guide between GDB and MDB would be useful to some developers out there. A full comparison would also cover dbx(1), but I’ll defer this to a later point. Given the number of available commands, I’ll be dividing up this post into at least two pieces.

Before diving into too much detail, it should be noted that MDB and GDB have slightly different design goals. MDB (and KMDB) replaced the aging adb(1) and crash(1M), and was designed primarily for post-mortem analysis and live kernel analysis. To this end, MDB presents the same interface when debugging a crash dump as when examining a live kernel. Solaris corefiles have been enhanced so that all the information for the process (including library text and type information) is present in the corefile. MDB can examine and run live processes, but lacks some of the features (source level debugging, STABS/DWARF support, conditional breakpoints, scripting language) that are standard for developer-centric tools like GDB (or dbx). GDB was designed for interactive process debugging. While you can use GDB on corefiles (and even LKCD crash dumps or Linux kernels – locally and remotely), you often need the original object files to take advantage of GDB’s features.

Before going too far into MDB, be sure to check out Jonathan’s MDB Cheatsheet as a useful quick reference guide, with some examples of stringing together commands into pipelines. Seeing as how I’m not the most accomplished GDB user in the world, I’ll be basing this comparison off the equivalent GDB reference card.

GDB MDB Description

Starting Up

gdb program mdb path
mdb -p pid
Start debugging a command or running process. GDB will treat numeric arguments as pids, while mdb explicitly requires the ‘-p’ option
gdb program core mdb [ program ] core Debug a corefile associated with ‘program’. For MDB, the program is optional and is generally unnecessary given the corefile enhancements made during Solaris 10.

Exiting

quit ::quit Both programs also exit on Ctrl-D.

Getting Help

help
help command
::help
::help dcmd
::dcmds
::walkers
In mdb, you can list all the available walkers or dcmds, as well as get help on a specific dcmd. Another useful trick is ::dmods -l module which lists walkers and dcmds provided by a specific module.

Running Programs

run arglist ::run arglist Runs the program with the given arguments. If the target is currently running, or is a corefile, MDB will restart the program if possible.
kill ::kill Forcibly kill and release target.
show env ::getenv Display current environment.
set env var string ::setenv var=string Set an environment variable.
get env var ::getenv var Get a specific environment variable.

Shell Commands

shell cmd !
cmd
Execute the given shell command.

Breakpoints and Watchpoints

break func
break *addr
addr::bp Set a breakpoint at the given
address or function.
break file:line - Break at the given line of the file. MDB does not
support source level debugging.
break ... if expr - Set a conditional breakpoint. MDB doesn’t support
conditional breakpoints, though you can get a close approximation via the
-c option (though its complicated enough to warrant its own
post).
watch expr addr::wp -rwx [-L size] Set a watchpoint on the given region of memory.
info break
info watch
::events Display active watchpoints
and breakpoints. MDB will show you signal events as well.
delete [n] ::delete n Delete the given breakpoint or
watchpoints.

I think that's enough for now; hopefully the table is at least readable. More to come in a future post.

Recent Posts

April 21, 2013
February 28, 2013
August 14, 2012
July 28, 2012

Archives