diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 8 | ||||
| -rw-r--r-- | src/eval.c | 2 | ||||
| -rw-r--r-- | src/keyboard.c | 30 | ||||
| -rw-r--r-- | src/lisp.h | 2 |
4 files changed, 39 insertions, 3 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 1985cdc3768..04f2e6a5752 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,11 @@ +2011-04-26 Daniel Colascione <dan.colascione@gmail.com> + + * 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 <dann@ics.uci.edu> * alloc.c (check_sblock, check_string_bytes) diff --git a/src/eval.c b/src/eval.c index d1f327021e6..8716ad78468 100644 --- a/src/eval.c +++ b/src/eval.c @@ -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 diff --git a/src/keyboard.c b/src/keyboard.c index c601649ebca..11cdeaf469c 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -7228,12 +7228,29 @@ handle_user_signal (int sig) { int old_errno = errno; struct user_signal_info *p; + const char* special_event_name = NULL; SIGNAL_THREAD_CHECK (sig); - + + 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. */ + break; + } + p->npending++; #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", + Vdebug_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); diff --git a/src/lisp.h b/src/lisp.h index 07b2cb0b1ef..44df38e9fa6 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -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; |
