From: Zach Shaftel Date: Wed, 22 Jul 2020 23:55:15 +0000 (-0400) Subject: Only store offset when executing bytecode X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=54b94af19d371f55f8a5f60352a14791de0d3e97;p=emacs.git Only store offset when executing bytecode * src/eval.c (record_in_backtrace): Use 'backtrace_top' instead of 'backtrace_next', and check that 'backtrace_byte_offset' > 0 before calling it, so the specbinding stack isn't scanned just to store an invalid offset. --- diff --git a/src/eval.c b/src/eval.c index 73ad3d3bc90..b9640f6ab7a 100644 --- a/src/eval.c +++ b/src/eval.c @@ -2154,10 +2154,11 @@ record_in_backtrace (Lisp_Object function, Lisp_Object *args, ptrdiff_t nargs) specpdl_ptr->bt.function = function; current_thread->stack_top = specpdl_ptr->bt.args = args; specpdl_ptr->bt.nargs = nargs; - union specbinding *nxt = specpdl_ptr; - nxt = backtrace_next(nxt); - if (nxt->kind == SPECPDL_BACKTRACE) - nxt->bt.bytecode_offset = backtrace_byte_offset; + if (backtrace_byte_offset > 0) { + union specbinding *nxt = backtrace_top (); + if (backtrace_p (nxt) && nxt->kind == SPECPDL_BACKTRACE) + nxt->bt.bytecode_offset = backtrace_byte_offset; + } grow_specpdl (); return count;