I've created a function (defun tester () ...) that does almost what I want - but its not totally correct. I would like to use the slime debugger to start this function and single step through its various parts to see where the mistake is. How do I do that with slime?
I am using slime-1.0 and cmucl-19a.
Thanks for any help. -Ram
ramb@sonic.net writes:
I've created a function (defun tester () ...) that does almost what I want - but its not totally correct. I would like to use the slime debugger to start this function and single step through its various parts to see where the mistake is. How do I do that with slime?
The support for stepping is, unfortunately, not very good. I usually insert a call to BREAK at the beginning of the function like:
(defun tester () (break) ...)
recompile the function, and then run the function. The debugger will pop up and you can use `s' for stepping.
`s' inserts a breakpoint at the next "interesting" code location(s) and continues. The debugger will usually pop up again at the next breakpoint.
Interesting code locations are: beginning of blocks, call-sites, and return points. I think "block" means a sequence of instructions without branches in CMUCL terminology.
There are also sldb-break and sldb-break-on-return commands, but inserting an explicit BREAK works better in my experience.
Here are some limitations of the current support:
- Sometimes two code locations are at the same source location, i.e., the same position in the Emacs buffer. This can be a bit confusing, but hasn't annoyed me enough yet to fix it. The problem is more severe if your code contains a lot of macros.
- There's currently no support for a gdb-like "step into" command, i.e., the ability to continue stepping in a called function.
- I think there's also a problem/bug when stepping through unwind-protect code which can cause segfaults. (Segfaults on CMUCL/x86 are currently serious show stoppers because the signal handler trashes the control stack.)
- Another (minor) problem are stale breakpoints. Breakpoints are sometimes not properly deleted and are still there if you execute the same function later.
Helmut.
Helmut Eller e9626484@stud3.tuwien.ac.at writes:
ramb@sonic.net writes:
I've created a function (defun tester () ...) that does almost what I want - but its not totally correct. I would like to use the slime debugger to start this function and single step through its various parts to see where the mistake is. How do I do that with slime?
The support for stepping is, unfortunately, not very good. I usually insert a call to BREAK at the beginning of the function like:
(defun tester () (break) ...)
recompile the function, and then run the function. The debugger will pop up and you can use `s' for stepping.
Thanks for this tip - it works ok.
Is the limitation a function of slime or does it have to do with CMUCL or some other part? Not that I would be able to help but I wonder - if the limitation is in slime then maybe a clever lisp hacker would be able to make stepping work better.
Thank you again. -Ram
ramb@sonic.net writes:
Is the limitation a function of slime or does it have to do with CMUCL or some other part? Not that I would be able to help but I wonder - if the limitation is in slime then maybe a clever lisp hacker would be able to make stepping work better.
A bit of both. The problem with multiple code locations at the same force location is a SLIME problem. There should be a command to explicitly step to the next source location ala "next-line" in gdb.
The other problems are basically also present in CMUCL's default stepper. The problem with unwind-protect sounds like a bug CMUCL's breakpoint machinery, but could be hard to fix.
A command to continue stepping in a called function needs a way to figure out which function is actually called at the call site breakpoint. CMUCL has currently no such way, but the called function object is probably accessible in some (not-so-)well known register.
The CMUCL internals manual also mentions somewhere that it should be possible to step backward. That would be cool, but I'm not sure if they were serious; they also write that "steppers are for weenies". :-)
Helmut.