What debugger breakpoint features would you like?

From:

Neil Jerram

Subject:

What debugger breakpoint features would you like?

Date:

01 Feb 2002 16:30:05 +0000

User-agent:

Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7

Hi. I'm working on an enhanced Guile debugger, and I'm at the point
where I'm trying to map all the useful breakpoint features that I can
think of onto the traps provided by Guile's evaluator. So I'd like to
check whether the features that I've thought of are a complete set,
or, on the other hand, if there are any features in my list that could
be specified in a more useful way, or are not useful at all.
So, here's the list:
------------------------------------8<----------------------------------
##
Break when about to evaluate the expression that follows.
## is detected when reading in Scheme code. For example, when
typing in a definition at the Guile REPL, you could write
(define (add3 x)
(+ ##x 3))
to specify a breakpoint before the evaluation of `x'. Or, to help
in debugging code in a .scm file, you could temporarily insert ## in
useful places and then get Guile to reload that file.
(For Emacs users, cmuscheme.el and giguile.el provide functions that
make it easy to resend ##'d code to Guile without even having to
save the code in its modified form.)
## is the only command that works like this. All the following
commands are designed to be typed into the debugger's command loop.
break RANGE-OF-COORDS
Break on entry to any frame with source coordinates in the specified
range.
break PROCEDURE
Break when about to apply the specified procedure.
watch EXP
Break on exit from the first subsequent frame in which the value of
EXP changed.
finish [VALUE]
Continue until evaluation of the current frame is complete, and
print the result obtained.
If VALUE is specified, return VALUE to the frame above instead of
the actual result.
return VALUE
Return from the current frame immediately, giving VALUE to the frame
above.
step [COUNT]
Continue execution until the COUNT'th next frame entry, frame exit
or application. (I.e. until the next evaluator checkpoint of any
kind.) COUNT defaults to 1.
next [COUNT]
Given the file of the current source coordinates, continue execution
until the COUNT'th next frame entry with coordinates in the same
file. COUNT defaults to 1.
(Note: A different kind of `next' would be one whose effect was
equivalent to the combination of `finish' followed by `step'. Since
this can be achieved using `finish' and `step', I don't think it
needs its own command.)
Breakpoint properties
The breakpoints created by `##', `break' and `watch' all have the
following properties, which can be examined and changed from within
the debugger command loop (exact commands to be determined):
- Whether the breakpoint is enabled or disabled.
- An optional thunk that is called when the breakpoint is hit.
- Whether the breakpoint causes Guile to enter the debugger command
loop.
For example, the existing `trace' feature can be implemented as a
breakpoint that doesn't cause Guile to enter the debugger but has a
thunk to do the required tracing.
------------------------------------8<----------------------------------
Does this list give the features that you'd like when debugging Scheme
code? Any omissions, or improvements? All input gratefully received.
Neil