1

I'm trying to debug the infamous Unrecognized entry in undo list undo-tree-canary, and after having Emacs debugger triggered on error, I want to move back and forth between stack frames and to examine state of variables. Sort of what frame 3 command in gdb would do.

Unfortunately I haven't found this question asked before, and searching through Emacs documentation haven't been fruitful for me.

3

Simply move point in the *Backtrace* buffer to the corresponding line of the frame you're interested in.

examine state of variables

Then press v (debugger-toggle-locals) to show local variables in the frame, or e (debugger-eval-expression) to evaluate an expression in the frame's context. Note that you won't have access to lexical variables when the function is byte compiled.

  • Doesn't seem to work. For example, the trace shows values of arguments that primitive-undo was called with, in particular "list" arg is set to "(undo-tree-canary)" text. But when I move point in *Backtrace* buffer over this line and evaluate list expecting to see its value, I get "void variable list". Same happens if I additionally press enter over the function, thus getting redirected to the source. The source of simple.el isn't byte-compiled for me. – Hi-Angel Jun 9 at 16:32
  • I just figured I should use e to inspect variables in *Backtrace* buffer (I've used M-: instead). Still, for every possible stack frame, when I evaluate with e the argument that the function in frame was called with, I get "void variable", even though I can see value of the argument inside the backtrace. – Hi-Angel Jun 9 at 16:48
  • @Hi-Angel Are you stopping in primitive-undo using debug-on-entry? I noticed it seems to mess up the frames so the debugger gets a bit confused. – npostavs Jun 9 at 18:15
  • I use toggle-debug-on-error, can it have a similar problem? Btw, thanks for the hint about v, when I press it over primitive-undo, I get only 2 local variables, and none of them are arguments of the function, screenshot. I guess this is a bug in Emacs itself, right? – Hi-Angel Jun 9 at 18:24
  • @Hi-Angel, hmm sort of works for me, I'm seeing the arguments to the function, but I can only evaluate them in the frame below that, screenshot – npostavs Jun 9 at 18:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.