Subject: Re: Emacs vs VI, the final solution
From: rpw3@rpw3.org (Rob Warnock)
Date: Sun, 01 Feb 2009 04:38:23 -0600
Newsgroups: comp.lang.lisp
Message-ID: <uJ6dnYB-HMkC5hjUnZ2dnUVZ_rPinZ2d@speakeasy.net>
Kaz Kylheku  <kkylheku@gmail.com> wrote:
+---------------
| Rob Warnock <rpw3@rpw3.org> wrote:
| > - I'm not sure what you mean by "source-integrated debugging"; can you
| >   unpack that a bit more?
| 
| It's that feature that lets you single step through running code
| while source code is shown on the screen, along with an indication
| of where you are in the source in relation to the executing code.
| 
| Never heard of it?
+---------------

Not until Tobias mentioned it [see parallel replies]. His example
seemed kind of weak, given that the CMUCL debugger [and presumably
others] will print both the current form and the file the current
function is in. You've probably already got 

Anyway, I've never been much of one for single-stepping, myself.
Always seemed like a waste of time, to me. [And, yes, I am aware
that liking single-stepping is another one of those near-binary
preferences that some have, and some don't. I'm one of the "don't"s.]

I'm more the sort that instruments with lots of debug printouts, and
then when an assert or breakpoint is hit look at what's happened so far,
then read the source code *very* closely and try to figure out how
the hell we got here. As Kenny pointed out with his two blog posts
on "Solve the First Problem/Failure First", it's often something
that was overlooked *way* earlier than the point where the actual
assert or breakpoint was hit, so single-stepping does you no good at
that point [and is too expensive to do all the way from the beginning].

To say it another way, I'm a great believer/practitioner of "debug
by binary partition" (loosely defined). It looks like it's working 
at the beginning; it's definitely off the rails at the assert/breakpoint;
so look for a point roughly halfway (40-60%) between those two and
see if it had already gone sour there, too. Wash, rinse, & repeat
until "start" == "end".

Sprinkling "N" debug printouts between the current "start" and "end"
(rather than just one) lets you find the problem a little faster,
but not much. It's the difference between (log (length program) 2)
and (log (length program) N).


-Rob

-----
Rob Warnock			<rpw3@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607