Here's a common debugging scenario: I am investigating a failure and for whatever reason I cannot instrument the relevant code with edebug. I can, however, in most cases get a backtrace via toggle-debug-on-error
, or debug-on-entry
. In the backtrace, I can jump to code along the call stack, but how does one get the values or arguments or variables? Here's an simple example:
(define-error 'test-signal
"Test signal" 'error)
(setq myvar 42)
(defun foo (arg)
(signal 'test-signal '(1 2 3)))
(provide 'foo)
Now Imagine I have debug-on-error turned on, and do M-x eval
(foo 123)
.
Once I'm in the debugger, what commands do I need to issue to see that the value of arg
is 123 and of myvar
is 42? debugger-eval-expression
always seems to return "Symbol's value as variable is void".