Good post. Slightly off-topic, but wanted to bring in discussion of
user-mode debugging with mdb.

I for one, would like to see basic source-level debugging added to mdb
(option 2 below) for use with user-mode binaries. A side-effect, I would
say, of making mdb both a good kernel AND user-mode debugger ;)

I see the feature on the wishlist -
http://www.opensolaris.org/os/community/mdb/future/

The reality is that mdb ships with Solaris, and thus is usually the only
debugger installed at a customer site. Yes, gdb does now ship as Solaris
add-on, or can be downloaded, but is an extra step that has to pass
through customer IT process (slow!). Moreover, gdb doesn't always work
well with SunStudio debug info.

And generally, dbx is out of the question, as it comes bundled with
SunStudio (yes, now free, but still a large install for just the
debugger).

Basically, I whole-heartedly put my vote in for mdb supporting the debug
formats output by SunStudio compiler chain, and producing a good
backtrace with source line numbers. Mdb wouldn't have to display source,
step through source; in other words, not a full-featured user-mode
debugger. Mostly for user-mode post-mortem analysis.

P.S. I do realize the Solaris10 generates core files with program text,
some symbol info, for much better "offline" core file analysis. However,
I believe the symbol info isn't the same as what SunStudio generates, so
perhaps the stack trace won't be complete. Please correct me if I am
wrong on this. Regardless, still would be a nice mdb feature.

Thanks, Ivan



-----Original Message-----
From: mdb-discuss-boun...@opensolaris.org
[mailto:mdb-discuss-bounces at opensolaris.org] On Behalf Of Michael
Shapiro
Sent: Friday, February 10, 2006 9:21 PM
To: Vin
Cc: mdb-discuss at opensolaris.org
Subject: Re: [mdb-discuss] source-level kernel debugging?


> Does kmdb support source-level kernel debugging? 
>
> Got out of Solaris work for quite sometime now, and just catching up, 
> with the latest developments. I know earlier debuggers like kadb had 
> only assembly-level kernel debugging.

Not sure what specifically you're looking for, but in general people
mean one or more of three different things when they say "source-level
debugging":

1. The ability to view data structures in a source-level view
corresponding
   to the data structure definitions of the source language.  Both mdb
   and kmdb offer this feature now.  The ::print command can be used to
   print types, e.g.

        0x12345678::print vnode_t

   and we have other commands like ::list that let you take advantage of
   source-level structure names, etc.  This is all for C only obviously.

2. The ability to correlate program counter offsets to source-level file
   names and line numbers.  We don't offer this feature in either mdb or
kmdb
   today.  Typically this feature isn't very useful in the kind of
low-level
   systems debugging we do in the kernel with kmdb and mdb because
you're
   dealing with optimized, production code and your compiler is free to
reorder
   things quite aggressively, making the assembly and source not closely
   correspond (it is for this reason that most compilers disable some or
all
   optimization when you compile -g to get the offset->line debug
information).
   That said, if someone wants to add DWARF processing for this in a way
which
   is reasonable I wouldn't be opposed to it.

3. The ability to perform simple breakpoints and breakpoint/step based
on
   source lines, implemented on top of #2.  This is pretty much entirely
out
   of whack with multi-threaded programming in general in my view, and
   certainly with the low-level MT systems debugging that mdb/kmdb are
designed
   for.  A much better way to approach this is with DTrace, where you
can
   dynamically examine MT systems behavior in a way that is infinitely
more
   flexible and sophisticated than breakpoint-based debugging.

In general, we use mdb for postmortem analysis and DTrace for live
system analysis.  Both of these tools and their accompanying techniques,
described in the respective docs.sun.com manuals, are worth investing
the time to learn.

-Mike

--
Mike Shapiro, Solaris Kernel Development. blogs.sun.com/mws/
_______________________________________________
mdb-discuss mailing list
mdb-discuss at opensolaris.org


Reply via email to