[Ecls-list] stepper problem
Juan Jose Garcia-Ripoll
worm at arrakis.es
Wed Nov 26 11:49:04 UTC 2003
On Tuesday 25 November 2003 10:52, Juan Jose Garcia-Ripoll wrote:
> On Monday 24 November 2003 20:05, Robert Lehr wrote:
> > When I invoke the stepper, I get this error.
> >
> > > :step (myFunc "asdf")
> >
> > I attempted other invocations that yielded similar results. Again-
> > what am I doing wrong here?
>
> A stepper has not yet been implemented. It requires minor tweaks both in
> the bytecodes compiler and in the interpreter.
I have made a very simple implementation of STEP. It works as follows:
Whenever you want to step a form, it is bytecompiled with special flags (what
one would call "debug mode"), and breakpoints are inserted before and after
each form, provided it is complicated enough. (For instance, references to
variables, constant values, etc, are automatically stepped over).
At evaluation time, these breakpoints are recognized by the interpreter, and
the function SI:STEPPER is called to query the user about the expected
behavior. Furthermore, if the user decides to "step in" a function call, and
the definition for the function is available, this function is automatically
recompiled in "debug mode" and the user is able to step into it.
On each break point the user may query and modify the bindings of local and
special variables, and evaluate any lisp form using the lexical environment
which is available at that time. Sample session:
> (defun foo (x) (print x)) (step (foo 2))
FOO
Top level.
> (FOO 2) ->
(PRINT X) - :v
Block names: FOO.
Local variables:
X: 2
Broken at FOO.
(PRINT X) - (setf x 3)
3
Broken at FOO.
(PRINT X) - :v
Block names: FOO.
Local variables:
X: 3
Broken at FOO.
(PRINT X) -
3
3
Top level.
The good news about the implementation are that 1) functions are only compiled
with breakpoints while STEP is running, 2) when STEP finishes these
definitions are discarded, and 3) execution speed under normal conditions is
not affected.
I hope this works as people expected. If not, feel free to have a look at the
code. Implementing the debugger was less than 200 lines. Most of it lisp,
plus a few new opcodes for the interpreter.
As usual, available in CVS and as big patch file:
http://ecls.sf.net/patch-current-mp.gz
Since my windows machine is dead, there are many changes accumulated and
anonymous CVS access is lame, I think it is time for a release. I am now
checking that ECL builds on the different platforms I have, and expect to
build a package by the weekend.
Regards,
Juanjo
More information about the ecl-devel
mailing list