> 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/

Reply via email to