Article View: gnu.emacs.bug
Article #99199init file debugging
From: David Anderson
Date: Wed, 17 Oct 1990 18:06
Date: Wed, 17 Oct 1990 18:06
70 lines
2662 bytes
2662 bytes
I've found these changes useful in tracking down bugs in init files, where
the normal debugging stuff doesn't work too well. The changes are to
18.55. There's probably a better way to do this, but I haven't found
it, although its packaging could be improved.
I lost the original version, so here's the changed line:
In startup.el:command-line, verbosify the initial error message.
Often this is enough to find the problem.
(condition-case error
...
(error (message "Error in init file: %s" error)))
In eval.c, include support for backtracing and entering a debugger
from init files.
119a120,124
> /* signal-internal debugger support, so you can find the bug without
> unwinding the stack. */
>
> Lisp_Object Vsignal_error_handler;
>
1019a1025
> static int in_signal_error_handler = 0;
1024a1031
> Lisp_Object args[3];
1030a1038,1047
> if (! EQ (XSYMBOL (Vsignal_error_handler)->value, Qnil) &&
> ! in_signal_error_handler){
> in_signal_error_handler = 1;
> args[0] = Vsignal_error_handler;
> args[1] = sig;
> args[2] = data;
> Fapply (3, args);
> in_signal_error_handler = 0;
> }
>
2100a2118,2123
>
> DEFVAR_LISP ("signal-error-handler", &Vsignal_error_handler,
> "Function to call from within signal under any circumstances.\n\
> This allows the full environment of the error to be used for\n\
> debugging. Args SIGNAL and DATA are values passed to signal or error.");
> Vsignal_error_handler = Qnil;
And then in your init file, near the top, turn it on
>(defun startup-backtrace (error data)
> (with-output-to-temp-buffer "*Backtrace*"
> (progn
> (princ error)
> (princ " ")
> (princ data)
> (princ "\n")
> (backtrace))))
>(defun startup-debug (error data)
> (backtrace-debug 0 t))
>
>(setq signal-error-handler 'startup-backtrace)
or...
>(setq signal-error-handler 'startup-debug)
and off at the end
>(setq signal-error-handler nil)
enjoy,
dca
"p
Technical Details
Message-ID:
<9010171806.AA13437@verity.com>Path:
arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!tut.cis.ohio-state.edu!VERITY.COM!dcaShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fb2f1,d1b274c38bf8bd7b,start X-Google-Attributes: gidfb2f1,public X-Google-ArrivalTime: 1990-10-17 11:06:39 PST Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!tut.cis.ohio-state.edu!VERITY.COM!dca From: dca@VERITY.COM (David Anderson) Newsgroups: gnu.emacs.bug Subject: init file debugging Message-ID: <9010171806.AA13437@verity.com> Date: 17 Oct 90 18:06:39 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 70 Approved: bug-gnu-emacs@prep.ai.mit.edu Posted: Wed Oct 17 19:06:39 1990