aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDaniel Colascione2011-04-26 04:26:05 -0700
committerDaniel Colascione2011-04-26 04:26:05 -0700
commit0438ce915d3408496eae848c351c2c7dde896b7b (patch)
treed45f273d397b1e8cc89068b320a2ee2d5b8e9d67 /src
parent8f91bf934523d47a9f57919733d6093b2484e284 (diff)
downloademacs-0438ce915d3408496eae848c351c2c7dde896b7b.tar.gz
emacs-0438ce915d3408496eae848c351c2c7dde896b7b.zip
Implement debug-on-event
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog8
-rw-r--r--src/eval.c2
-rw-r--r--src/keyboard.c30
-rw-r--r--src/lisp.h2
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 @@
12011-04-26 Daniel Colascione <dan.colascione@gmail.com>
2
3 * lisp.h (Qdebug): List symbol.
4 * eval.c (Qdebug): restore global linkage.
5 * keyboard.c (debug-on-event): New variable.
6 (handle_user_signal): Break into debugger when debug-on-event
7 matches the current signal symbol.
8
12011-04-25 Dan Nicolaescu <dann@ics.uci.edu> 92011-04-25 Dan Nicolaescu <dann@ics.uci.edu>
2 10
3 * alloc.c (check_sblock, check_string_bytes) 11 * 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;
88static Lisp_Object Qdeclare; 88static Lisp_Object Qdeclare;
89Lisp_Object Qinternal_interpreter_environment, Qclosure; 89Lisp_Object Qinternal_interpreter_environment, Qclosure;
90 90
91static Lisp_Object Qdebug; 91Lisp_Object Qdebug;
92 92
93/* This holds either the symbol `run-hooks' or nil. 93/* This holds either the symbol `run-hooks' or nil.
94 It is nil at an early stage of startup, and when Emacs 94 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)
7228{ 7228{
7229 int old_errno = errno; 7229 int old_errno = errno;
7230 struct user_signal_info *p; 7230 struct user_signal_info *p;
7231 const char* special_event_name = NULL;
7231 7232
7232 SIGNAL_THREAD_CHECK (sig); 7233 SIGNAL_THREAD_CHECK (sig);
7233 7234
7235 if (SYMBOLP (Vdebug_on_event))
7236 special_event_name = SDATA (SYMBOL_NAME (Vdebug_on_event));
7237
7234 for (p = user_signals; p; p = p->next) 7238 for (p = user_signals; p; p = p->next)
7235 if (p->sig == sig) 7239 if (p->sig == sig)
7236 { 7240 {
7241 if (special_event_name &&
7242 strcmp (special_event_name, p->name) == 0)
7243 {
7244 /* Enter the debugger in many ways. */
7245 debug_on_next_call = 1;
7246 debug_on_quit = 1;
7247 Vquit_flag = Qt;
7248 Vinhibit_quit = Qnil;
7249
7250 /* Eat the event. */
7251 break;
7252 }
7253
7237 p->npending++; 7254 p->npending++;
7238#ifdef SIGIO 7255#ifdef SIGIO
7239 if (interrupt_input) 7256 if (interrupt_input)
@@ -12165,6 +12182,17 @@ text in the region before modifying the buffer. The next
12165`deactivate-mark' call uses this to set the window selection. */); 12182`deactivate-mark' call uses this to set the window selection. */);
12166 Vsaved_region_selection = Qnil; 12183 Vsaved_region_selection = Qnil;
12167 12184
12185 DEFVAR_LISP ("debug-on-event",
12186 Vdebug_on_event,
12187 doc: /* Enter debugger on this event. When Emacs
12188receives the special event specifed by this variable, it will try to
12189break into the debugger as soon as possible instead of processing the
12190event normally through `special-event-map'.
12191
12192Currently, the only supported values for this
12193variable are `sigusr1' and `sigusr2'. */);
12194 Vdebug_on_event = intern_c_string ("sigusr2");
12195
12168 /* Create the initial keyboard. */ 12196 /* Create the initial keyboard. */
12169 initial_kboard = (KBOARD *) xmalloc (sizeof (KBOARD)); 12197 initial_kboard = (KBOARD *) xmalloc (sizeof (KBOARD));
12170 init_kboard (initial_kboard); 12198 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);
2796 2796
2797/* Defined in eval.c. */ 2797/* Defined in eval.c. */
2798extern Lisp_Object Qautoload, Qexit, Qinteractive, Qcommandp, Qdefun, Qmacro; 2798extern Lisp_Object Qautoload, Qexit, Qinteractive, Qcommandp, Qdefun, Qmacro;
2799extern Lisp_Object Qinhibit_quit, Qclosure; 2799extern Lisp_Object Qinhibit_quit, Qclosure, Qdebug;
2800extern Lisp_Object Qand_rest; 2800extern Lisp_Object Qand_rest;
2801extern Lisp_Object Vautoload_queue; 2801extern Lisp_Object Vautoload_queue;
2802extern Lisp_Object Vsignaling_function; 2802extern Lisp_Object Vsignaling_function;