3

The builtin elisp debugger (i.e. the regular one, debug, not edebug) has a default binding of s to command backtrace-goto-source.

When I try to use it, it says: Source code location not known

You can see what I mean by doing this:

  1. Set contents of /tmp/blah.el to be:
(defun abc ()
  (error "hello"))
  1. Run the command emacs -Q --eval '(progn (setq debug-on-error t) (load-file "/tmp/blah.el") (abc))'

  2. Highlight fourth line in buffer, the one that reads abc()

  3. Press s key, the error says Source code location not known

The docs for backtrace-goto-source say:

If its location is known, jump to the source code for the frame at point

I checked the builtin info documentation for section 18.1 The Lisp Debugger, but i couldn't really find a setting for what i want. How do I make a symbol's location known to the debugger so it jumps to the source location when I press s?

Interesting note: the behavior of pressing mouse-1 is completely different from pressing s, and sometimes navigates to bundled source location gzs for me, but also sometimes opens an "Open File" dialog (GUI).

8
  • Please provide a recipe to repro what you describe. Which debugger? etc.
    – Drew
    May 20 at 15:16
  • @drew Ok i added a recipe.
    – nate
    May 21 at 16:35
  • Please don't pose multiple questions in a single post, or your post risks being closed. Some of the questions you pose here are related, so OK as background to your problem. But a question like your last one belongs as a separate post. Thx.
    – Drew
    May 21 at 19:48
  • @Drew I didn't mean it as multiple questions. I meant it all as one question (how to get the debugger to find symbols) where i preferred the answer to work across multiple projects at once. I have updated the question, nonetheless, to make it easier for people trying to home in on what i'm actually asking here. Is it ok now?
    – nate
    May 23 at 11:18
1

s is bound to a new function that was recently added, and indeed it appears to be non–functional. I took a look at the source code, and it does attempt to pull file and line number from the stack frame, but none of the stack frames have any file and line number information :)

It then tries to run hook functions, but the list of hook functions is empty. Those hooks are the ones that are supposed to open the correct source file.

It would be helpful if you could open a bug report about this (use M-x report-emacs-bug). It may be that some part of the implementation was left out, or that it was never finished. Probably the best fix is to simply remove the key binding until the problem is fixed.

In the mean time, hitting enter (or left clicking) on any line in the stack trace will take you to the definition of the named function, if it can find it. On most code this will work just fine, but it isn’t very helpful in some situations, such as when someone has called eval. In those cases you can jump to the definition of eval or to any of the functions that the evaluated code calls, but there’s no way to jump to the code it is evaluating.

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.