Commit 0438ce91 authored by Daniel Colascione's avatar Daniel Colascione
Browse files

Implement debug-on-event

parent 8f91bf93
2011-04-26 Daniel Colascione <>
* Document debug-on-event default behavior and utility for
2011-04-22 Noah Friedman <>
* emacs-buffer.gdb: Add trailing underscores to appropriate member
......@@ -405,6 +405,11 @@ stepping, you will see where the loop starts and ends. Also, examine
the data being used in the loop and try to determine why the loop does
not exit when it should.
You can also trying sending Emacs SIGUSR2, which, if `debug-on-event'
has its default value, will cause Emacs to attempt to break it out of
its current loop and into the Lisp debugger. This feature is useful
when a C-level debugger is not conveniently available.
** If certain operations in Emacs are slower than they used to be, here
is some advice for how to find out why.
2011-04-26 Daniel Colascione <>
* cus-start.el (all): Define customization for debug-on-event.
2011-04-26 Daniel Colascione <>
* subr.el (shell-quote-argument): Escape correctly under Windows.
......@@ -259,6 +259,11 @@ Leaving \"Default\" unchecked is equivalent with specifying a default of
(suggest-key-bindings keyboard (choice (const :tag "off" nil)
(integer :tag "time" 2)
(other :tag "on")))
(debug-on-event debug
(choice (const :tag "None" nil)
(const :tag "When sent SIGUSR1" sigusr1)
(const :tag "When sent SIGUSR2" sigusr2))
;; This is not good news because it will use the wrong
;; version-specific directories when you upgrade. We need
2011-04-26 Daniel Colascione <>
* lisp.h (Qdebug): List symbol.
* eval.c (Qdebug): restore global linkage.
* keyboard.c (debug-on-event): New variable.
(handle_user_signal): Break into debugger when debug-on-event
matches the current signal symbol.
2011-04-25 Dan Nicolaescu <>
* alloc.c (check_sblock, check_string_bytes)
......@@ -88,7 +88,7 @@ static Lisp_Object Qdebug_on_error;
static Lisp_Object Qdeclare;
Lisp_Object Qinternal_interpreter_environment, Qclosure;
static Lisp_Object Qdebug;
Lisp_Object Qdebug;
/* This holds either the symbol `run-hooks' or nil.
It is nil at an early stage of startup, and when Emacs
......@@ -7228,12 +7228,29 @@ handle_user_signal (int sig)
int old_errno = errno;
struct user_signal_info *p;
const char* special_event_name = NULL;
if (SYMBOLP (Vdebug_on_event))
special_event_name = SDATA (SYMBOL_NAME (Vdebug_on_event));
for (p = user_signals; p; p = p->next)
if (p->sig == sig)
if (special_event_name &&
strcmp (special_event_name, p->name) == 0)
/* Enter the debugger in many ways. */
debug_on_next_call = 1;
debug_on_quit = 1;
Vquit_flag = Qt;
Vinhibit_quit = Qnil;
/* Eat the event. */
#ifdef SIGIO
if (interrupt_input)
......@@ -12165,6 +12182,17 @@ text in the region before modifying the buffer. The next
`deactivate-mark' call uses this to set the window selection. */);
Vsaved_region_selection = Qnil;
DEFVAR_LISP ("debug-on-event",
doc: /* Enter debugger on this event. When Emacs
receives the special event specifed by this variable, it will try to
break into the debugger as soon as possible instead of processing the
event normally through `special-event-map'.
Currently, the only supported values for this
variable are `sigusr1' and `sigusr2'. */);
Vdebug_on_event = intern_c_string ("sigusr2");
/* Create the initial keyboard. */
initial_kboard = (KBOARD *) xmalloc (sizeof (KBOARD));
init_kboard (initial_kboard);
......@@ -2796,7 +2796,7 @@ extern void syms_of_lread (void);
/* Defined in eval.c. */
extern Lisp_Object Qautoload, Qexit, Qinteractive, Qcommandp, Qdefun, Qmacro;
extern Lisp_Object Qinhibit_quit, Qclosure;
extern Lisp_Object Qinhibit_quit, Qclosure, Qdebug;
extern Lisp_Object Qand_rest;
extern Lisp_Object Vautoload_queue;
extern Lisp_Object Vsignaling_function;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment