diff options
| author | Alan Mackenzie | 2022-02-02 20:35:39 +0000 |
|---|---|---|
| committer | Alan Mackenzie | 2022-02-02 20:35:39 +0000 |
| commit | aa795a6223c31ec8804f2824c435dba3091c115f (patch) | |
| tree | 3ab30ccf54019c835d584ae9ae72ec6341e2b123 /src | |
| parent | b6a51e05c9714827737708ce7fb2068f285005ce (diff) | |
| download | emacs-aa795a6223c31ec8804f2824c435dba3091c115f.tar.gz emacs-aa795a6223c31ec8804f2824c435dba3091c115f.zip | |
New file lisp/emacs-lisp/debug-early.el for backtraces in early bootstrap
This is also used in batch mode in general.
* lisp/debug-early.el (debug-early-backtrace, debug-early): New functions.
* lisp/loadup.el (top level): Load debug-early.el as first file.
* src/eval.c (signal_or_quit): Remove the condition in the batch mode section
of not being in dumping or bootstrap, since it is no longer needed. Test that
'debug-early's symbol-function is bound. Ensure there is enough working space
in specpdl and eval_depth.
(syms_of_eval): New DEFSYM for Qdebug_early. Initialise Vdebugger to
Qdebug_early rather than Qnil.
Diffstat (limited to 'src')
| -rw-r--r-- | src/eval.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/eval.c b/src/eval.c index 3e648ed6216..c87b1bc704c 100644 --- a/src/eval.c +++ b/src/eval.c | |||
| @@ -1873,18 +1873,19 @@ signal_or_quit (Lisp_Object error_symbol, Lisp_Object data, bool keyboard_quit) | |||
| 1873 | } | 1873 | } |
| 1874 | 1874 | ||
| 1875 | /* If we're in batch mode, print a backtrace unconditionally to help | 1875 | /* If we're in batch mode, print a backtrace unconditionally to help |
| 1876 | with debugging. Make sure to use `debug' unconditionally to not | 1876 | with debugging. Make sure to use `debug-early' unconditionally |
| 1877 | interfere with ERT or other packages that install custom | 1877 | to not interfere with ERT or other packages that install custom |
| 1878 | debuggers. Don't try to call the debugger while dumping or | 1878 | debuggers. */ |
| 1879 | bootstrapping, it wouldn't work anyway. */ | ||
| 1880 | if (!debugger_called && !NILP (error_symbol) | 1879 | if (!debugger_called && !NILP (error_symbol) |
| 1881 | && (NILP (clause) || EQ (h->tag_or_ch, Qerror)) | 1880 | && (NILP (clause) || EQ (h->tag_or_ch, Qerror)) |
| 1882 | && noninteractive && backtrace_on_error_noninteractive | 1881 | && noninteractive && backtrace_on_error_noninteractive |
| 1883 | && !will_dump_p () && !will_bootstrap_p () | 1882 | && NILP (Vinhibit_debugger) |
| 1884 | && NILP (Vinhibit_debugger)) | 1883 | && !NILP (Ffboundp (Qdebug_early))) |
| 1885 | { | 1884 | { |
| 1885 | max_ensure_room (&max_lisp_eval_depth, lisp_eval_depth, 100); | ||
| 1886 | max_ensure_room (&max_specpdl_size, SPECPDL_INDEX (), 200); | ||
| 1886 | ptrdiff_t count = SPECPDL_INDEX (); | 1887 | ptrdiff_t count = SPECPDL_INDEX (); |
| 1887 | specbind (Qdebugger, Qdebug); | 1888 | specbind (Qdebugger, Qdebug_early); |
| 1888 | call_debugger (list2 (Qerror, Fcons (error_symbol, data))); | 1889 | call_debugger (list2 (Qerror, Fcons (error_symbol, data))); |
| 1889 | unbind_to (count, Qnil); | 1890 | unbind_to (count, Qnil); |
| 1890 | } | 1891 | } |
| @@ -4399,6 +4400,7 @@ before making `inhibit-quit' nil. */); | |||
| 4399 | DEFSYM (Qclosure, "closure"); | 4400 | DEFSYM (Qclosure, "closure"); |
| 4400 | DEFSYM (QCdocumentation, ":documentation"); | 4401 | DEFSYM (QCdocumentation, ":documentation"); |
| 4401 | DEFSYM (Qdebug, "debug"); | 4402 | DEFSYM (Qdebug, "debug"); |
| 4403 | DEFSYM (Qdebug_early, "debug-early"); | ||
| 4402 | 4404 | ||
| 4403 | DEFVAR_LISP ("inhibit-debugger", Vinhibit_debugger, | 4405 | DEFVAR_LISP ("inhibit-debugger", Vinhibit_debugger, |
| 4404 | doc: /* Non-nil means never enter the debugger. | 4406 | doc: /* Non-nil means never enter the debugger. |
| @@ -4453,7 +4455,7 @@ If due to frame exit, args are `exit' and the value being returned; | |||
| 4453 | If due to error, args are `error' and a list of the args to `signal'. | 4455 | If due to error, args are `error' and a list of the args to `signal'. |
| 4454 | If due to `apply' or `funcall' entry, one arg, `lambda'. | 4456 | If due to `apply' or `funcall' entry, one arg, `lambda'. |
| 4455 | If due to `eval' entry, one arg, t. */); | 4457 | If due to `eval' entry, one arg, t. */); |
| 4456 | Vdebugger = Qnil; | 4458 | Vdebugger = Qdebug_early; |
| 4457 | 4459 | ||
| 4458 | DEFVAR_LISP ("signal-hook-function", Vsignal_hook_function, | 4460 | DEFVAR_LISP ("signal-hook-function", Vsignal_hook_function, |
| 4459 | doc: /* If non-nil, this is a function for `signal' to call. | 4461 | doc: /* If non-nil, this is a function for `signal' to call. |