GNU bug report logs -
#42499
[PATCH] Add Bytecode Offset information to Backtrace
Previous Next
Reported by: Zach Shaftel <zshaftel <at> gmail.com>
Date: Thu, 23 Jul 2020 23:31:01 UTC
Severity: normal
Tags: moreinfo, patch
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
This patch adds the offset in a bytecode function's execution where an
error occurs to the *Backtrace* buffer, like this:
Debugger entered--Lisp error: (wrong-type-argument stringp t)
string-match(t t nil)
13 test-condition-case()
load("/home/zach/.repos/bench-compare.el/test/test-debug...")
78 byte-recompile-file("/home/zach/.repos/bench-compare.el/test/test-debug..." nil 0 t)
35 emacs-lisp-byte-compile-and-load()
funcall-interactively(emacs-lisp-byte-compile-and-load)
call-interactively(emacs-lisp-byte-compile-and-load record nil)
101 command-execute(emacs-lisp-byte-compile-and-load record)
If you disassemble one of the annotated functions, you can find the
instruction where the error occured.
A 'bytecode_offset' field is added to the 'specbinding.bt' struct, which
holds the offset in the execution of that frame's bytecode function. The
offset for the function being executed is stored in a field of the
'thread_state' struct, and updated from within 'exec_byte_code' before a
funcall. Then 'record_in_backtrace', called by Ffuncall, finds the last
frame and stores the offset there. The frame's offset is added to the
FLAGS plist argument passed by 'mapbacktrace'.
See further discussion about the limitations of the attached
implementation here:
https://lists.gnu.org/archive/html/emacs-devel/2020-07/msg00365.html
My copyright assignment is still pending so I assume this can't be
merged until I hear back from copyright-clerk. The patch attached is a
simple diff without commit messages. I can add NEWS and Changelog
entries/commit messages if this ends up going through, but I may not be
able to get to that until next week.
-Zach
[bytecode-offset-in-backtrace.patch (text/x-patch, attachment)]
This bug report was last modified 3 years and 343 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.