jacob navia wrote:
> We know from my last installments, [... aggrieved rant snipped ...]
>
> Now, question for the people that keep a small part of common sense
> here:
>
> Is *reading* a program the *same* as *DEBUGGING* a program?
No, it is not the *same* (emphasis yours and mine alike).
> Are serious people here willing to believe this stories of people
> debugging huge code bases without a debugger?
Yes. Perhaps this defines me as "non-serious" in your
estimation, but my employers seem to disagree with you and
I'm not giving back forty years' worth of paychecks on your
say-so.
> I stay by my position:
>
> A code base bigger than 1500 lines is no longer debuggable in an
> abstract sense just by reading code. It needs a debugger.
No, that's folly. For some programs, even for some programs
shorter than 1500 lines, a debugger can be helpful. But for
most programs, even for some many times longer, interactive
debuggers are a waste of time.
> Note that we suppose a real-time, event-driven code execution,
> where you can have faulty libraries, faulty interrupts servicing
> programs, etc. ANYTHING.
In my experience, software debuggers are even less useful
for this class of problem than for most. (Hardware debuggers
are a different breed of cat altogether.) If you're looking
for a race condition or other timing-dependent glitch, the
"probe effect" of a breakpoint or watchpoint is too disruptive
to be of use; the timing is altered and the problem scurries
away from your gaze. Also, such problems are, by their nature,
hard to reproduce: By the time you realize the problem exists
and start prodding it with a debugger, the moving finger has
moved on.
For such nasties, I've had better success with a two-part
approach: I try to construct proofs of correctness for crucial
sections (the degree of formality of the "proof" may vary),
and I build in some kind of event trace to assist post-mortem
analysis. That is, I use a combination of "reading the code"
and "printf debugging," and I find it more effective than
trying to get a debugger to deliver something useful.
Interactive debuggers are occasionally helpful, sometimes
invaluable. But they are certainly not the only debugging
tools in the chest, nor even the sharpest.
--
Eric Sosman
lid