emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] emacs-25 8df2eb9: Fix invocation of Python and Guile inter


From: Eli Zaretskii
Subject: [Emacs-diffs] emacs-25 8df2eb9: Fix invocation of Python and Guile interpreters from gdb-mi
Date: Wed, 16 Dec 2015 10:41:33 +0000

branch: emacs-25
commit 8df2eb9dc599c9eb95eea51fe7d45e972cb275f1
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    Fix invocation of Python and Guile interpreters from gdb-mi
    
    * lisp/progmodes/gdb-mi.el (gdb-control-commands-regexp): Add
    commands for interactive Python and Guile interpreters.
    (gdb-send): Recognize various ways of exiting from Python and
    Guile interpreters and returning to GDB.  For details, see
    http://lists.gnu.org/archive/html/emacs-devel/2015-12/msg00693.html
    and http://stackoverflow.com/questions/31514741.
---
 lisp/progmodes/gdb-mi.el |   37 ++++++++++++++++++++++++-------------
 1 files changed, 24 insertions(+), 13 deletions(-)

diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el
index 16f82cc..bde030e 100644
--- a/lisp/progmodes/gdb-mi.el
+++ b/lisp/progmodes/gdb-mi.el
@@ -1766,7 +1766,8 @@ static char *magick[] = {
 (defvar gdb-control-commands-regexp
   (concat
    "^\\("
-   "commands\\|if\\|while\\|define\\|document\\|python\\|"
+   "commands\\|if\\|while\\|define\\|document\\|"
+   "python\\|python-interactive\\|pi\\|guile\\|guile-repl\\|gr\\|"
    "while-stepping\\|stepping\\|ws\\|actions"
    "\\)\\([[:blank:]]+.*\\)?$")
   "Regexp matching GDB commands that enter a recursive reading loop.
@@ -1782,21 +1783,27 @@ commands to be prefixed by \"-interpreter-exec 
console\".")
     (let ((inhibit-read-only t))
       (remove-text-properties (point-min) (point-max) '(face))))
   ;; mimic <RET> key to repeat previous command in GDB
-  (if (not (string= "" string))
-      (if gdb-continuation
-         (setq gdb-last-command (concat gdb-continuation
-                                        (gdb-strip-string-backslash string)
-                                        " "))
-       (setq gdb-last-command (gdb-strip-string-backslash string)))
-    (if gdb-last-command (setq string gdb-last-command))
-    (setq gdb-continuation nil))
-  (if (and (not gdb-continuation) (or (string-match "^-" string)
-         (> gdb-control-level 0)))
+  (when (= gdb-control-level 0)
+    (if (not (string= "" string))
+        (if gdb-continuation
+            (setq gdb-last-command (concat gdb-continuation
+                                           (gdb-strip-string-backslash string)
+                                           " "))
+          (setq gdb-last-command (gdb-strip-string-backslash string)))
+      (if gdb-last-command (setq string gdb-last-command))
+      (setq gdb-continuation nil)))
+  (if (and (not gdb-continuation)
+           (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"))
-       (if (and (string-match "^end$" string)
+       (if (and (string-match
+                  (concat "^\\("
+                          (if (eq system-type 'windows-nt) "\026" "\004")
+                          "\\|,q\\|,quit\\|end\\)$")
+                  string)
                 (> gdb-control-level 0))
            (setq gdb-control-level (1- gdb-control-level))))
     ;; CLI command
@@ -1812,7 +1819,11 @@ commands to be prefixed by \"-interpreter-exec 
console\".")
         (if gdb-enable-debug
             (push (cons 'mi-send to-send) gdb-debug-log))
         (process-send-string proc to-send))
-      (if (and (string-match "^end$" string)
+      (if (and (string-match
+                  (concat "^\\("
+                          (if (eq system-type 'windows-nt) "\026" "\004")
+                          "\\|,q\\|,quit\\|end\\)$")
+                  string)
               (> gdb-control-level 0))
          (setq gdb-control-level (1- gdb-control-level)))
       (setq gdb-continuation nil)))



reply via email to

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