aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Colascione2011-04-26 04:26:05 -0700
committerDaniel Colascione2011-04-26 04:26:05 -0700
commit0438ce915d3408496eae848c351c2c7dde896b7b (patch)
treed45f273d397b1e8cc89068b320a2ee2d5b8e9d67
parent8f91bf934523d47a9f57919733d6093b2484e284 (diff)
downloademacs-0438ce915d3408496eae848c351c2c7dde896b7b.tar.gz
emacs-0438ce915d3408496eae848c351c2c7dde896b7b.zip
Implement debug-on-event
-rw-r--r--etc/ChangeLog5
-rw-r--r--etc/DEBUG5
-rw-r--r--lisp/ChangeLog4
-rw-r--r--lisp/cus-start.el5
-rw-r--r--src/ChangeLog8
-rw-r--r--src/eval.c2
-rw-r--r--src/keyboard.c30
-rw-r--r--src/lisp.h2
8 files changed, 58 insertions, 3 deletions
diff --git a/etc/ChangeLog b/etc/ChangeLog
index 24f44b9d0e8..73cee7763db 100644
--- a/etc/ChangeLog
+++ b/etc/ChangeLog
@@ -1,3 +1,8 @@
12011-04-26 Daniel Colascione <dan.colascione@gmail.com>
2
3 * Document debug-on-event default behavior and utility for
4 debugging.
5
12011-04-22 Noah Friedman <friedman@splode.com> 62011-04-22 Noah Friedman <friedman@splode.com>
2 7
3 * emacs-buffer.gdb: Add trailing underscores to appropriate member 8 * emacs-buffer.gdb: Add trailing underscores to appropriate member
diff --git a/etc/DEBUG b/etc/DEBUG
index c8fd48c6bfa..625a76ac952 100644
--- a/etc/DEBUG
+++ b/etc/DEBUG
@@ -405,6 +405,11 @@ stepping, you will see where the loop starts and ends. Also, examine
405the data being used in the loop and try to determine why the loop does 405the data being used in the loop and try to determine why the loop does
406not exit when it should. 406not exit when it should.
407 407
408You can also trying sending Emacs SIGUSR2, which, if `debug-on-event'
409has its default value, will cause Emacs to attempt to break it out of
410its current loop and into the Lisp debugger. This feature is useful
411when a C-level debugger is not conveniently available.
412
408** If certain operations in Emacs are slower than they used to be, here 413** If certain operations in Emacs are slower than they used to be, here
409is some advice for how to find out why. 414is some advice for how to find out why.
410 415
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index de7379149e8..0bf790e7137 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,7 @@
12011-04-26 Daniel Colascione <dan.colascione@gmail.com>
2
3 * cus-start.el (all): Define customization for debug-on-event.
4
12011-04-26 Daniel Colascione <dan.colascione@gmail.com> 52011-04-26 Daniel Colascione <dan.colascione@gmail.com>
2 6
3 * subr.el (shell-quote-argument): Escape correctly under Windows. 7 * subr.el (shell-quote-argument): Escape correctly under Windows.
diff --git a/lisp/cus-start.el b/lisp/cus-start.el
index 1188d37150a..6113a4321c5 100644
--- a/lisp/cus-start.el
+++ b/lisp/cus-start.el
@@ -259,6 +259,11 @@ Leaving \"Default\" unchecked is equivalent with specifying a default of
259 (suggest-key-bindings keyboard (choice (const :tag "off" nil) 259 (suggest-key-bindings keyboard (choice (const :tag "off" nil)
260 (integer :tag "time" 2) 260 (integer :tag "time" 2)
261 (other :tag "on"))) 261 (other :tag "on")))
262 (debug-on-event debug
263 (choice (const :tag "None" nil)
264 (const :tag "When sent SIGUSR1" sigusr1)
265 (const :tag "When sent SIGUSR2" sigusr2))
266 "24.1")
262 267
263;; This is not good news because it will use the wrong 268;; This is not good news because it will use the wrong
264;; version-specific directories when you upgrade. We need 269;; version-specific directories when you upgrade. We need
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;