2 ms·
You can edit the source file and send it to the listener. Suppose I'm in my REPL and I do this: > (foo 'bar) I get dropped into the debugger because foo do
by Jtsummers 6y ago
You can edit the source file and send it to the listener.
Suppose I'm in my REPL and I do this:
> (foo 'bar)
I get dropped into the debugger because foo doesn't exist. So I switch over to my .lisp file in another buffer and I type:
(defun foo (symbol)
(format t "Baz ~A~%" symbol))
;; this will print "Baz BAR" in the example
With the cursor anywhere within that function definition I type C-c C-c, go to the debugger and restart it. It works now.
My source file and my Lisp image are both synchronized.
In the case of changing a variable. Say I'm somewhere deep in some code and this tries to run:
;; in context x = 0
(/ y x)
I'm dropped into the debugger. I know x was supposed to have a minimum of 1. I can do a couple things:
1. Examine the back trace in the debugger to see if I can locate where x got an incorrect value (maybe it was the line above, maybe 10 functions earlier). I make a note of what to fix, maybe I fix it now.
2. Change x to its proper minimum value and resume.
If I was able to trace how x got a wrong value, it's fixed already. If not, I'll have to explore more. But I don't have to restart way earlier, I can just restart at this point (assuming nothing else was broken by x having the wrong value here) and still get the result of my program (assuming x being wrong didn't break a lot of other things). Or I can quit back to the REPL and start exploring the problem.