aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJim Blandy2012-02-26 17:38:45 +0800
committerChong Yidong2012-02-26 17:38:45 +0800
commit4fd9655790324ce4b0a321ddae45e98af3953fe1 (patch)
tree9423541146950219b11ef924122cc082b4086fc0
parentfa9a08553937a87d6162bb0a7b21dfd3b3f47164 (diff)
downloademacs-4fd9655790324ce4b0a321ddae45e98af3953fe1.tar.gz
emacs-4fd9655790324ce4b0a321ddae45e98af3953fe1.zip
Fix handling of commands containing double quotes in gdb-mi
* lisp/progmodes/gdb-mi.el (gdb-mi-quote): New function. (gdb-send): Apply it to the operand of the '-interpreter-exec console' command, so that we can pass arguments with (say) quotes in them. Store exact string sent in gdb-debug-log (Bug#10765).
-rw-r--r--lisp/ChangeLog7
-rw-r--r--lisp/progmodes/gdb-mi.el18
2 files changed, 21 insertions, 4 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 9f1c4e71444..a6783b87baa 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,10 @@
12012-02-26 Jim Blandy <jimb@red-bean.com>
2
3 * progmodes/gdb-mi.el (gdb-mi-quote): New function.
4 (gdb-send): Apply it to the operand of the '-interpreter-exec
5 console' command, so that we can pass arguments with (say) quotes
6 in them. Store exact string sent in gdb-debug-log (Bug#10765).
7
12012-02-26 Chong Yidong <cyd@gnu.org> 82012-02-26 Chong Yidong <cyd@gnu.org>
2 9
3 * help-fns.el (describe-function-1): Clarify description of 10 * help-fns.el (describe-function-1): Clarify description of
diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el
index 301714ec55f..0c45c3f5e5d 100644
--- a/lisp/progmodes/gdb-mi.el
+++ b/lisp/progmodes/gdb-mi.el
@@ -1672,8 +1672,6 @@ static char *magick[] = {
1672 (if (not (string= "" string)) 1672 (if (not (string= "" string))
1673 (setq gdb-last-command string) 1673 (setq gdb-last-command string)
1674 (if gdb-last-command (setq string gdb-last-command))) 1674 (if gdb-last-command (setq string gdb-last-command)))
1675 (if gdb-enable-debug
1676 (push (cons 'mi-send (concat string "\n")) gdb-debug-log))
1677 (if (string-match "^-" string) 1675 (if (string-match "^-" string)
1678 ;; MI command 1676 ;; MI command
1679 (progn 1677 (progn
@@ -1683,10 +1681,22 @@ static char *magick[] = {
1683 (if (string-match "\\\\$" string) 1681 (if (string-match "\\\\$" string)
1684 (setq gdb-continuation (concat gdb-continuation string "\n")) 1682 (setq gdb-continuation (concat gdb-continuation string "\n"))
1685 (setq gdb-first-done-or-error t) 1683 (setq gdb-first-done-or-error t)
1686 (process-send-string proc (concat "-interpreter-exec console \"" 1684 (let ((to-send (concat "-interpreter-exec console "
1687 gdb-continuation string "\"\n")) 1685 (gdb-mi-quote string)
1686 "\n")))
1687 (if gdb-enable-debug
1688 (push (cons 'mi-send to-send) gdb-debug-log))
1689 (process-send-string proc to-send))
1688 (setq gdb-continuation nil)))) 1690 (setq gdb-continuation nil))))
1689 1691
1692(defun gdb-mi-quote (string)
1693 "Return STRING quoted properly as an MI argument.
1694The string is enclosed in double quotes.
1695All embedded quotes, newlines, and backslashes are preceded with a backslash."
1696 (setq string (replace-regexp-in-string "\\([\"\\]\\)" "\\\\\\&" string))
1697 (setq string (replace-regexp-in-string "\n" "\\n" string t t))
1698 (concat "\"" string "\""))
1699
1690(defun gdb-input (command handler-function) 1700(defun gdb-input (command handler-function)
1691 "Send COMMAND to GDB via the MI interface. 1701 "Send COMMAND to GDB via the MI interface.
1692Run the function HANDLER-FUNCTION, with no arguments, once the command is 1702Run the function HANDLER-FUNCTION, with no arguments, once the command is