comparison src/cmdloop.c @ 4841:3465c3161fea

when `debug', abort when lisp error during loadup loadup.el: When featurep `debug-xemacs' (configure --with-debug), set debug-on-error, so that we get an exit-to-debugger/assertion failure upon Lisp error during loadup. Unset before dumping. cmdloop.c: During really-early-error-handler, exit to the debugger and abort if an error occurs and lisp.h: extern Vdebug_on_error.
author Ben Wing <ben@xemacs.org>
date Wed, 13 Jan 2010 01:55:56 -0600
parents facf3239ba30
children 838630c0734f
comparison
equal deleted inserted replaced
4840:17b3dc5500b0 4841:3465c3161fea
1 /* Editor command loop. 1 /* Editor command loop.
2 Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc. 2 Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc.
3 Copyright (C) 1995, 1996, 2001, 2002, 2003 Ben Wing. 3 Copyright (C) 1995, 1996, 2001, 2002, 2003, 2005 Ben Wing.
4 4
5 This file is part of XEmacs. 5 This file is part of XEmacs.
6 6
7 XEmacs is free software; you can redistribute it and/or modify it 7 XEmacs is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by the 8 under the terms of the GNU General Public License as published by the
135 stderr_out ("*** Error in XEmacs initialization"); 135 stderr_out ("*** Error in XEmacs initialization");
136 Fprint (x, Qexternal_debugging_output); 136 Fprint (x, Qexternal_debugging_output);
137 stderr_out ("*** Backtrace\n"); 137 stderr_out ("*** Backtrace\n");
138 Fbacktrace (Qexternal_debugging_output, Qt); 138 Fbacktrace (Qexternal_debugging_output, Qt);
139 stderr_out ("*** Killing XEmacs\n"); 139 stderr_out ("*** Killing XEmacs\n");
140 #ifdef DEBUG_XEMACS
141 /* When configured --with-debug, and debug-on-error is set, exit to the
142 debugger and abort. This will happen during loadup/dumping. There is
143 also code in signal_call_debugger() to do the same whenever running
144 noninteractively. That's intended for use debugging e.g. batch byte
145 compilation, AFTER dumping has already happened, where the XEMACSDEBUG
146 variable can be set to '(setq debug-on-error t)' to trigger the
147 behavior.
148
149 Why do we need to duplicate the bomb-out check here? Well,
150 signal_call_debugger() doesn't want to bomb out unless it has an
151 uncaught error, and in this case, we've installed a
152 call-with-condition-case handler, and so signal_call_debugger() can't
153 bomb out before calling us. If we returned and let the error be
154 processed further, it *would* trigger the bomb-out-to-debugger
155 behavior, but in fact it never gets there because we do `kill-emacs'.
156 Therefore, we have to provide the bomb-to-debugger feature
157 ourselves. */
158 if (!NILP (Vdebug_on_error))
159 {
160 stderr_out ("XEmacs exiting to debugger.\n");
161 Fforce_debugging_signal (Qt);
162 }
163 #endif
140 #ifdef HAVE_MS_WINDOWS 164 #ifdef HAVE_MS_WINDOWS
141 Fmswindows_message_box (build_msg_string ("Initialization error"), 165 Fmswindows_message_box (build_msg_string ("Initialization error"),
142 Qnil, Qnil); 166 Qnil, Qnil);
143 #endif 167 #endif
144 Fkill_emacs (make_int (-1)); 168 Fkill_emacs (make_int (-1));