nil))
(setq backtrace-view (plist-put backtrace-view :show-flags t)
- backtrace-insert-header-function (lambda ()
- (debugger--insert-header args))
+ backtrace-insert-header-function
+ (lambda ()
+ (insert (format "Byte-code offset of error: %d\n" (car (last args))))
+ (debugger--insert-header args))
backtrace-print-function debugger-print-function)
(backtrace-print)
;; Place point on "stack frame 0" (bug#15101).
Threading provides a performance boost. These macros are how
we allow the code to be compiled both ways. */
#ifdef BYTE_CODE_THREADED
+#define UPDATE_OFFSET (backtrace_byte_offset = pc - bytestr_data);
/* The CASE macro introduces an instruction's body. It is
either a label or a case label. */
#define CASE(OP) insn_ ## OP
/* NEXT is invoked at the end of an instruction to go to the
next instruction. It is either a computed goto, or a
plain break. */
-#define NEXT goto *(targets[op = FETCH])
+#define NEXT UPDATE_OFFSET goto *(targets[op = FETCH])
/* FIRST is like NEXT, but is only used at the start of the
interpreter body. In the switch-based interpreter it is the
switch, so the threaded definition must include a semicolon. */
unbind_to (count, Qnil);
error ("binding stack not balanced (serious byte compiler bug)");
}
-
+ backtrace_byte_offset = -1;
Lisp_Object result = TOP;
SAFE_FREE ();
return result;
/* FIXME: We should probably get rid of this! */
Lisp_Object Vsignaling_function;
+int backtrace_byte_offset = -1;
+
/* These would ordinarily be static, but they need to be visible to GDB. */
bool backtrace_p (union specbinding *) EXTERNALLY_VISIBLE;
Lisp_Object *backtrace_args (union specbinding *) EXTERNALLY_VISIBLE;
redisplay, which necessarily leads to display problems. */
specbind (Qinhibit_eval_during_redisplay, Qt);
#endif
-
+ if (backtrace_byte_offset >= 0) {
+ arg = CALLN(Fappend, arg, list1(make_fixnum(backtrace_byte_offset)));
+ backtrace_byte_offset = -1;
+ }
val = apply1 (Vdebugger, arg);
/* Interrupting redisplay and resuming it later is not safe under
/* Like xsignal, but takes 0, 1, 2, or 3 args instead of a list. */
+void
+xsignal_with_offset (Lisp_Object error_symbol, Lisp_Object data, int bytecode_offset)
+{
+ backtrace_byte_offset = bytecode_offset;
+ xsignal(error_symbol, data);
+}
+
void
xsignal0 (Lisp_Object error_symbol)
{
extern Lisp_Object Vrun_hooks;
extern Lisp_Object Vsignaling_function;
extern Lisp_Object inhibit_lisp_code;
+extern int backtrace_byte_offset;
/* To run a normal hook, use the appropriate function from the list below.
The calling convention: