emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r104015: Implement debug-on-event


From: Daniel Colascione
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r104015: Implement debug-on-event
Date: Tue, 26 Apr 2011 04:26:05 -0700
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 104015
committer: Daniel Colascione <address@hidden>
branch nick: trunk
timestamp: Tue 2011-04-26 04:26:05 -0700
message:
  Implement debug-on-event
modified:
  etc/ChangeLog
  etc/DEBUG
  lisp/ChangeLog
  lisp/cus-start.el
  src/ChangeLog
  src/eval.c
  src/keyboard.c
  src/lisp.h
=== modified file 'etc/ChangeLog'
--- a/etc/ChangeLog     2011-04-22 23:29:02 +0000
+++ b/etc/ChangeLog     2011-04-26 11:26:05 +0000
@@ -1,3 +1,8 @@
+2011-04-26  Daniel Colascione  <address@hidden>
+
+       * Document debug-on-event default behavior and utility for
+       debugging.
+
 2011-04-22  Noah Friedman  <address@hidden>
 
        * emacs-buffer.gdb: Add trailing underscores to appropriate member

=== modified file 'etc/DEBUG'
--- a/etc/DEBUG 2011-01-25 04:08:28 +0000
+++ b/etc/DEBUG 2011-04-26 11:26:05 +0000
@@ -405,6 +405,11 @@
 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.
 

=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2011-04-26 10:44:03 +0000
+++ b/lisp/ChangeLog    2011-04-26 11:26:05 +0000
@@ -1,3 +1,7 @@
+2011-04-26  Daniel Colascione  <address@hidden>
+
+       * cus-start.el (all): Define customization for debug-on-event.
+
 2011-04-26  Daniel Colascione <address@hidden>
 
        * subr.el (shell-quote-argument): Escape correctly under Windows.

=== modified file 'lisp/cus-start.el'
--- a/lisp/cus-start.el 2011-03-27 10:55:07 +0000
+++ b/lisp/cus-start.el 2011-04-26 11:26:05 +0000
@@ -259,6 +259,11 @@
             (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))
+                             "24.1")
 
 ;; This is not good news because it will use the wrong
 ;; version-specific directories when you upgrade.  We need

=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2011-04-25 21:36:06 +0000
+++ b/src/ChangeLog     2011-04-26 11:26:05 +0000
@@ -1,3 +1,11 @@
+2011-04-26  Daniel Colascione <address@hidden>
+
+       * 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  <address@hidden>
 
        * alloc.c (check_sblock, check_string_bytes)

=== modified file 'src/eval.c'
--- a/src/eval.c        2011-04-25 08:04:22 +0000
+++ b/src/eval.c        2011-04-26 11:26:05 +0000
@@ -88,7 +88,7 @@
 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

=== modified file 'src/keyboard.c'
--- a/src/keyboard.c    2011-04-16 20:27:04 +0000
+++ b/src/keyboard.c    2011-04-26 11:26:05 +0000
@@ -7228,12 +7228,29 @@
 {
   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 @@
 `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);

=== modified file 'src/lisp.h'
--- a/src/lisp.h        2011-04-23 10:33:28 +0000
+++ b/src/lisp.h        2011-04-26 11:26:05 +0000
@@ -2796,7 +2796,7 @@
 
 /* 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;


reply via email to

[Prev in Thread] Current Thread [Next in Thread]