* (How) can I position information backtraces?
@ 2017-09-18 16:45 Rocky Bernstein
2017-09-18 21:53 ` Helmut Eller
0 siblings, 1 reply; 2+ messages in thread
From: Rocky Bernstein @ 2017-09-18 16:45 UTC (permalink / raw)
To: emacs-devel
[-- Attachment #1: Type: text/plain, Size: 221 bytes --]
I've been looking at Emacs Lisp code and the C source. I don't see
how/where execution position is stored.
I've also noticed that backtrace information rarely (if ever?) shows
position information.
What gives?
Thanks.
[-- Attachment #2: Type: text/html, Size: 333 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: (How) can I position information backtraces?
2017-09-18 16:45 (How) can I position information backtraces? Rocky Bernstein
@ 2017-09-18 21:53 ` Helmut Eller
0 siblings, 0 replies; 2+ messages in thread
From: Helmut Eller @ 2017-09-18 21:53 UTC (permalink / raw)
To: emacs-devel; +Cc: Rocky Bernstein
On Mon, Sep 18 2017, Rocky Bernstein wrote:
> I've been looking at Emacs Lisp code and the C source. I don't see
> how/where execution position is stored.
I suppose you want to know how Emacs stores the source position
(filename and line number) of Lisp code and in particular how the
debugger can take you from a stack frame in the backtrace to the source
position.
Emacs doesn't store such information in a nice uniform table -- sorry to
disappoint you -- instead Emacs has a bunch of heuristics to
guess/search the source position. One heuristic goes like this: first
determine the filename by searching the name of the function in the list
`load-history' or for subrs use the file etc/DOC. The line number is
not stored anywhere and is usually determined by some regexp search in
the source file.
Those heuristics work quite well for "normal" code, but are too limited
if lambdas or complex macros are involved.
There is also no nice API for this. E.g. look at
`elisp--xref-find-definitions' for the messy code that is needed for
this kind of task.
Ideally, the compiler/intepreter would generate source maps and attach
them to functions/lambdas in some way. But it seems that the motivation
for doing that (I guess it would be quite a big project) is limited,
given that the current heuristics work good enough for the simple cases.
Actually, the current approach works suprisingly well, considering how
little information is kept around.
Helmut
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-09-18 21:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-18 16:45 (How) can I position information backtraces? Rocky Bernstein
2017-09-18 21:53 ` Helmut Eller
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).