[ILUG] Kernel Debugger

Kenn Humborg kenn at linux.ie
Thu Sep 7 22:54:43 IST 2000


On Thu, Sep 07, 2000 at 09:52:16AM +0100, Damian O'Sullivan wrote:
> I'd just love to know what the harm is in having a kernel debugger..

He thinks that it makes programmers lazy.  He wants kernel hackers to
write obviously, provably, correct kernel code, not code that works
when you step through it.

He does have a point, to a certain degree.  Once you start dealing with
SMP or asynchronous stuff like interrupts, no debugger is going to give
you an accurate picture of how the code will behave in the real world.
It's better to _think_ about every line of code and say 'What if I get
an interrupt _here_?  What if another CPU does _that_ in between _these_
two lines of code?' and deal with all the horrible (albeit rare) cases
that arise.  Paranoia rules.  (I really wish more programmers understood
this...)

However, I think he goes a little overboard on this issue.  He must have
known some luser coder during his formative years that leaned a bit too
heavily on a debugger without really understanding what the code was
doing.  It's understandable, especially in these days where source-level
debuggers and IDEs make it _very_ easy to get lulled into a false sense
of security that the code will always behave the way it does in the
debugger.  I've dealt with low-level debugging tools where it was pretty
much a toss-up as to whether it was quicker to learn the debugger or
to stick in a few debug printf()-equivalents and do a few 
compile-boot-crash-reboot cycles :-)

Later,
Kenn





More information about the ILUG mailing list