From 48215c41d16fadb69e85121b3baca0dfca82cc44 Mon Sep 17 00:00:00 2001 From: Alan Mackenzie Date: Thu, 11 Aug 2022 19:31:09 +0000 Subject: New debugging facility: backtraces from errors in Lisp called from redisplay Setting backtrace-on-redisplay-error to non-nil enables the generation of a Lisp backtrace in buffer *Redisplay-trace* following an error in Lisp called from redisplay. * doc/lispref/debugging.texi (Debugging Redisplay): New subsection. (Error Debugging): Reference to the new subsection. * etc/NEWS: New entry for the new facility. * src/eval.c (redisplay_deep_handler): New variable. (init_eval): Initialize redisplay_deep_handler. (call_debugger): Don't throw to top-level after calling debug-early (internal_condition_case_n): "Bind" redisplay_deep_handler to the current handler. (backtrace_yet): New boolean variable. (signal_or_quit): New code section to handle Lisp errors occurring in redisplay. (syms_of_eval): New DEFVAR_BOOL backtrace-on-redisplay-error. * src/keyboard.c (command_loop_1): Set backtrace_yet to false each time around the loop. (safe_run_hooks_error): Allow args to be up to four Lisp_Objects long. (safe_run_hooks_2): New function. * src/lisp.h (top level): declare as externs backtrace_yet and safe_run_hooks_2. * src/xdisp.c (run_window_scroll_functions): Replace a call to run_hook_with_args_2 with one to safe_run_hooks_2. --- src/lisp.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/lisp.h') diff --git a/src/lisp.h b/src/lisp.h index fe6e98843d1..2f73ba4c617 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -4530,6 +4530,7 @@ extern Lisp_Object Vrun_hooks; extern Lisp_Object Vsignaling_function; extern Lisp_Object inhibit_lisp_code; extern bool signal_quit_p (Lisp_Object); +extern bool backtrace_yet; /* To run a normal hook, use the appropriate function from the list below. The calling convention: @@ -4831,6 +4832,7 @@ extern bool detect_input_pending_ignore_squeezables (void); extern bool detect_input_pending_run_timers (bool); extern void safe_run_hooks (Lisp_Object); extern void safe_run_hooks_maybe_narrowed (Lisp_Object, struct window *); +extern void safe_run_hooks_2 (Lisp_Object, Lisp_Object, Lisp_Object); extern void cmd_error_internal (Lisp_Object, const char *); extern Lisp_Object command_loop_2 (Lisp_Object); extern Lisp_Object read_menu_command (void); -- cgit v1.2.1