emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/emacs-24 r107872: Fix bug #11279 with sendi


From: Eli Zaretskii
Subject: [Emacs-diffs] /srv/bzr/emacs/emacs-24 r107872: Fix bug #11279 with sending command blocks to GDB.
Date: Fri, 20 Apr 2012 13:09:40 +0300
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 107872
fixes bug(s): http://debbugs.gnu.org/11279
committer: Eli Zaretskii <address@hidden>
branch nick: emacs-24
timestamp: Fri 2012-04-20 13:09:40 +0300
message:
  Fix bug #11279 with sending command blocks to GDB.
  
   lisp/progmodes/gdb-mi.el (gdb-control-level): New variable.
   (gdb): Make it buffer-local and init to zero.
   (gdb-control-commands-regexp): New variable.
   (gdb-send): Don't wrap in "-interpreter-exec console" if
   gdb-control-level is positive.  Increment gdb-control-level
   whenever the command matches gdb-control-commands-regexp, and
   decrement it each time the command is "end".  (Bug#11279)
modified:
  lisp/ChangeLog
  lisp/progmodes/gdb-mi.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2012-04-20 08:49:24 +0000
+++ b/lisp/ChangeLog    2012-04-20 10:09:40 +0000
@@ -1,3 +1,13 @@
+2012-04-20  Eli Zaretskii  <address@hidden>
+
+       * progmodes/gdb-mi.el (gdb-control-level): New variable.
+       (gdb): Make it buffer-local and init to zero.
+       (gdb-control-commands-regexp): New variable.
+       (gdb-send): Don't wrap in "-interpreter-exec console" if
+       gdb-control-level is positive.  Increment gdb-control-level
+       whenever the command matches gdb-control-commands-regexp, and
+       decrement it each time the command is "end".  (Bug#11279)
+
 2012-04-20  Martin Rudalics  <address@hidden>
 
        * window.el (adjust-window-trailing-edge, enlarge-window)

=== modified file 'lisp/progmodes/gdb-mi.el'
--- a/lisp/progmodes/gdb-mi.el  2012-04-20 07:13:25 +0000
+++ b/lisp/progmodes/gdb-mi.el  2012-04-20 10:09:40 +0000
@@ -603,6 +603,8 @@
         (set (make-local-variable 'gud-marker-filter) #'gud-gdb-marker-filter))
       (funcall filter proc string))))
 
+(defvar gdb-control-level 0)
+
 ;;;###autoload
 (defun gdb (command-line)
   "Run gdb on program FILE in buffer *gud-FILE*.
@@ -677,6 +679,7 @@
     (set-process-filter proc #'gdb--check-interpreter))
 
   (set (make-local-variable 'gud-minor-mode) 'gdbmi)
+  (set (make-local-variable 'gdb-control-level) 0)
   (setq comint-input-sender 'gdb-send)
   (when (ring-empty-p comint-input-ring) ; cf shell-mode
     (let ((hfile (expand-file-name (or (getenv "GDBHISTFILE")
@@ -1700,6 +1703,16 @@
   :group 'gdb)
 
 
+(defvar gdb-control-commands-regexp
+  (concat
+   "^\\("
+   "commands\\|if\\|while\\|define\\|document\\|python\\|"
+   "while-stepping\\|stepping\\|ws\\|actions"
+   "\\)\\([[:blank:]]+.*\\)?$")
+  "Regexp matching GDB commands that enter a recursive reading loop.
+As long as GDB is in the recursive reading loop, it does not expect
+commands to be prefixed by \"-interpreter-exec console\".")
+
 (defun gdb-send (proc string)
   "A comint send filter for gdb."
   (with-current-buffer gud-comint-buffer
@@ -1709,11 +1722,15 @@
   (if (not (string= "" string))
       (setq gdb-last-command string)
     (if gdb-last-command (setq string gdb-last-command)))
-  (if (string-match "^-" string)
-      ;; MI command
+  (if (or (string-match "^-" string)
+         (> gdb-control-level 0))
+      ;; Either MI command or we are feeding GDB's recursive reading loop.
       (progn
        (setq gdb-first-done-or-error t)
-       (process-send-string proc (concat string "\n")))
+       (process-send-string proc (concat string "\n"))
+       (if (and (string-match "^end$" string)
+                (> gdb-control-level 0))
+           (setq gdb-control-level (1- gdb-control-level))))
     ;; CLI command
     (if (string-match "\\\\$" string)
        (setq gdb-continuation (concat gdb-continuation string "\n"))
@@ -1724,7 +1741,12 @@
         (if gdb-enable-debug
             (push (cons 'mi-send to-send) gdb-debug-log))
         (process-send-string proc to-send))
-      (setq gdb-continuation nil))))
+      (if (and (string-match "^end$" string)
+              (> gdb-control-level 0))
+         (setq gdb-control-level (1- gdb-control-level)))
+      (setq gdb-continuation nil)))
+  (if (string-match gdb-control-commands-regexp string)
+      (setq gdb-control-level (1+ gdb-control-level))))
 
 (defun gdb-mi-quote (string)
   "Return STRING quoted properly as an MI argument.


reply via email to

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