bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#14847: 24.1; gdb-mi.el does not handle backslashes as quotes


From: Sergio Durigan Junior
Subject: bug#14847: 24.1; gdb-mi.el does not handle backslashes as quotes
Date: Fri, 12 Jul 2013 12:51:24 -0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1 (gnu/linux)

On Friday, July 12 2013, Eli Zaretskii wrote:

> Your patch doesn't seem to work for me.  I tried on GNU/Linux and on
> MS-Windows, and in both cases I get the same error.  Here's the recipe
> I tried (after applying your latest patch and rebuilding Emacs):
>
>  emacs -Q
>  M-x gdb RET
>  gdb -i=mi ./src/emacs RET
>  (gdb) break main
>  (gdb) run \
>  -Q
>
> When I type RET after "-Q", I get an error:
>
>   Undefined MI command: Q
>
> What am I doing wrong?

Hi Eli,

Thanks for testing!  You're doing nothing wrong, the patch is the
culprit.  `gdb-send' checks for commands starting with "-", but this
check should be disabled when a command is being continued.

Could you please try the following version?

Thanks,

-- 
Sergio

diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el
index 2c4d6a0..10472ec 100644
--- a/lisp/progmodes/gdb-mi.el
+++ b/lisp/progmodes/gdb-mi.el
@@ -1759,6 +1759,9 @@ static char *magick[] = {
 As long as GDB is in the recursive reading loop, it does not expect
 commands to be prefixed by \"-interpreter-exec console\".")
 
+(defun gdb-strip-string-backslash (string)
+  (replace-regexp-in-string "\\\\$" "" string))
+
 (defun gdb-send (proc string)
   "A comint send filter for gdb."
   (with-current-buffer gud-comint-buffer
@@ -1766,10 +1769,15 @@ commands to be prefixed by \"-interpreter-exec 
console\".")
       (remove-text-properties (point-min) (point-max) '(face))))
   ;; mimic <RET> key to repeat previous command in GDB
   (if (not (string= "" string))
-      (setq gdb-last-command string)
-    (if gdb-last-command (setq string gdb-last-command)))
-  (if (or (string-match "^-" string)
-         (> gdb-control-level 0))
+      (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)
@@ -1779,10 +1787,13 @@ commands to be prefixed by \"-interpreter-exec 
console\".")
            (setq gdb-control-level (1- gdb-control-level))))
     ;; CLI command
     (if (string-match "\\\\$" string)
-       (setq gdb-continuation (concat gdb-continuation string "\n"))
+       (setq gdb-continuation
+             (concat gdb-continuation (gdb-strip-string-backslash
+                                       string)
+                     " "))
       (setq gdb-first-done-or-error t)
       (let ((to-send (concat "-interpreter-exec console "
-                             (gdb-mi-quote string)
+                             (gdb-mi-quote (concat gdb-continuation string " 
"))
                              "\n")))
         (if gdb-enable-debug
             (push (cons 'mi-send to-send) gdb-debug-log))





reply via email to

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