carbon2-commit: when `debug', abort when lisp error during loadup
Ben Wing
ben at xemacs.org
Sun Feb 7 12:39:05 EST 2010
changeset: 4889:3465c3161fea
user: Ben Wing <ben at xemacs.org>
date: Wed Jan 13 01:55:56 2010 -0600
files: lisp/ChangeLog lisp/loadup.el src/ChangeLog src/cmdloop.c src/lisp.h
description:
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.
diff -r 17b3dc5500b0 -r 3465c3161fea lisp/ChangeLog
--- a/lisp/ChangeLog Tue Jan 12 23:19:13 2010 -0600
+++ b/lisp/ChangeLog Wed Jan 13 01:55:56 2010 -0600
@@ -1,3 +1,12 @@
+2010-01-13 Ben Wing <ben at xemacs.org>
+
+ * loadup.el:
+ * loadup.el (featurep):
+ * loadup.el (member):
+ 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.
+
2010-01-10 Ben Wing <ben at xemacs.org>
* mule/mule-cmds.el (get-native-coding-system-from-language-environment):
diff -r 17b3dc5500b0 -r 3465c3161fea lisp/loadup.el
--- a/lisp/loadup.el Tue Jan 12 23:19:13 2010 -0600
+++ b/lisp/loadup.el Wed Jan 13 01:55:56 2010 -0600
@@ -2,7 +2,7 @@
;; Copyright (C) 1985, 1986, 1992, 1994, 1997 Free Software Foundation, Inc.
;; Copyright (C) 1996 Richard Mlynarik.
-;; Copyright (C) 1995, 1996, 2003 Ben Wing.
+;; Copyright (C) 1995, 1996, 2003, 2005 Ben Wing.
;; Maintainer: XEmacs Development Team
;; Keywords: internal, dumped
@@ -44,6 +44,12 @@
;; Help debug problems.
(setq stack-trace-on-error t
load-always-display-messages t)
+(when (featurep 'debug-xemacs)
+ ;; Immediately dump core upon an unhandled error, rather than just quitting
+ ;; the program. This can also be achieved by setting an environment variable
+ ;; XEMACSDEBUG to contain '(setq debug-on-error t)', e.g.
+ ;; export XEMACSDEBUG='(setq debug-on-error t)'
+ (setq debug-on-error t))
;(princ (format "command-line-args: %s\n" command-line-args))
;(princ (format "configure-lisp-directory: %S\n" configure-lisp-directory))
@@ -239,7 +245,8 @@
(really-free))
;; Make sure we don't dump with debugging messages turned on.
(setq stack-trace-on-error nil
- load-always-display-messages nil)
+ load-always-display-messages nil
+ debug-on-error nil)
(dump-emacs
(cond
((featurep 'infodock) "infodock")
diff -r 17b3dc5500b0 -r 3465c3161fea src/ChangeLog
--- a/src/ChangeLog Tue Jan 12 23:19:13 2010 -0600
+++ b/src/ChangeLog Wed Jan 13 01:55:56 2010 -0600
@@ -1,3 +1,10 @@
+2010-01-13 Ben Wing <ben at xemacs.org>
+
+ * cmdloop.c:
+ During really-early-error-handler, exit to the debugger and abort
+ if an error occurs and
+ * lisp.h: extern Vdebug_on_error.
+
2010-01-12 Ben Wing <ben at xemacs.org>
* sheap.c:
diff -r 17b3dc5500b0 -r 3465c3161fea src/cmdloop.c
--- a/src/cmdloop.c Tue Jan 12 23:19:13 2010 -0600
+++ b/src/cmdloop.c Wed Jan 13 01:55:56 2010 -0600
@@ -1,6 +1,6 @@
/* Editor command loop.
Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc.
- Copyright (C) 1995, 1996, 2001, 2002, 2003 Ben Wing.
+ Copyright (C) 1995, 1996, 2001, 2002, 2003, 2005 Ben Wing.
This file is part of XEmacs.
@@ -137,6 +137,30 @@
stderr_out ("*** Backtrace\n");
Fbacktrace (Qexternal_debugging_output, Qt);
stderr_out ("*** Killing XEmacs\n");
+#ifdef DEBUG_XEMACS
+ /* When configured --with-debug, and debug-on-error is set, exit to the
+ debugger and abort. This will happen during loadup/dumping. There is
+ also code in signal_call_debugger() to do the same whenever running
+ noninteractively. That's intended for use debugging e.g. batch byte
+ compilation, AFTER dumping has already happened, where the XEMACSDEBUG
+ variable can be set to '(setq debug-on-error t)' to trigger the
+ behavior.
+
+ Why do we need to duplicate the bomb-out check here? Well,
+ signal_call_debugger() doesn't want to bomb out unless it has an
+ uncaught error, and in this case, we've installed a
+ call-with-condition-case handler, and so signal_call_debugger() can't
+ bomb out before calling us. If we returned and let the error be
+ processed further, it *would* trigger the bomb-out-to-debugger
+ behavior, but in fact it never gets there because we do `kill-emacs'.
+ Therefore, we have to provide the bomb-to-debugger feature
+ ourselves. */
+ if (!NILP (Vdebug_on_error))
+ {
+ stderr_out ("XEmacs exiting to debugger.\n");
+ Fforce_debugging_signal (Qt);
+ }
+#endif
#ifdef HAVE_MS_WINDOWS
Fmswindows_message_box (build_msg_string ("Initialization error"),
Qnil, Qnil);
diff -r 17b3dc5500b0 -r 3465c3161fea src/lisp.h
--- a/src/lisp.h Tue Jan 12 23:19:13 2010 -0600
+++ b/src/lisp.h Wed Jan 13 01:55:56 2010 -0600
@@ -4574,6 +4574,7 @@
...) PRINTF_ARGS (3, 4);
extern int backtrace_with_internal_sections;
+extern Lisp_Object Vdebug_on_error;
extern Lisp_Object Vstack_trace_on_error;
/* Defined in event-stream.c */
More information about the XEmacs-Patches
mailing list