* bug#10765: 24.0.93; gdb-mi cannot transmit commands containing double quotes
@ 2012-02-08 20:56 Jim Blandy
2012-02-08 21:04 ` bug#10765: Patch to fix this bug Jim Blandy
0 siblings, 1 reply; 6+ messages in thread
From: Jim Blandy @ 2012-02-08 20:56 UTC (permalink / raw)
To: 10765
When I start debugging a program with M-x gdb, and type the command:
(gdb) print "fleen"
The following message appears in the minibuffer:
Problem parsing arguments: interpreter-exec console "print "fleen""
This problem occurs because gdb-send fails to properly quote the
arguments to the "-interpreter-exec console" MI packet it sends.
In GNU Emacs 24.0.93.2 (x86_64-unknown-linux-gnu, GTK+ Version 2.20.1)
of 2012-02-08 on fyodor
Windowing system distributor `The X.Org Foundation', version 11.0.10706000
Configured using:
`configure '--prefix=/home/jimb/emacs' 'CFLAGS=-g3 -O0''
Important settings:
value of $LC_ALL: nil
value of $LC_COLLATE: nil
value of $LC_CTYPE: nil
value of $LC_MESSAGES: nil
value of $LC_MONETARY: nil
value of $LC_NUMERIC: nil
value of $LC_TIME: nil
value of $LANG: en_US.utf8
value of $XMODIFIERS: @im=ibus
locale-coding-system: utf-8-unix
default enable-multibyte-characters: t
Major mode: Emacs-Lisp
Minor modes in effect:
erc-track-mode: t
erc-track-minor-mode: t
erc-ring-mode: t
erc-notify-mode: t
erc-networks-mode: t
erc-netsplit-mode: t
erc-menu-mode: t
erc-match-mode: t
erc-list-mode: t
erc-pcomplete-mode: t
erc-button-mode: t
erc-fill-mode: t
erc-stamp-mode: t
erc-autojoin-mode: t
erc-irccontrols-mode: t
erc-noncommands-mode: t
erc-move-to-prompt-mode: t
erc-readonly-mode: t
tooltip-mode: t
mouse-wheel-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
blink-cursor-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
line-number-mode: t
transient-mark-mode: t
Recent input:
<return> <switch-frame> <switch-frame> <switch-frame>
C-x C-f e m a c s / e m a c s / . g i t / c o n f i
g <return> <switch-frame> <switch-frame> M-x m a n
<return> g i t - p u s h <return> C-x 0 <switch-frame>
<switch-frame> q <switch-frame> <switch-frame> <switch-frame>
<switch-frame> q <switch-frame> <switch-frame> C-x
C-y C-x C-y <switch-frame> <switch-frame> <switch-frame>
<switch-frame> <switch-frame> <switch-frame> C-x C-f
e m a c s <tab> e m a s c <tab> l i <backspace> <backspace>
<backspace> <backspace> c s / l i s <tab> p r o <tab>
g <backspace> g m <tab> g d b - m <tab> <return> C-v
C-v C-v C-s - g d b - q u <backspace> <backspace> <backspace>
<backspace> C-a C-s g d b - m i - q u o t e C-s C-a
<switch-frame> <switch-frame> C-x C-v <return> C-s
g d b - m i - q u o t e C-a M-x e v a l - b u f f <tab>
<return> <switch-frame> M-x g d b <return> <M-backspace>
<M-backspace> ~ / m o z / d b g / j s / s r c / o b
j ~ / j s <return> p r i n t SPC " f l e e n " <return>
C-x 2 C-x o C-x b * M e s <tab> <return> <switch-frame>
M-x m <backspace> e m a c s - r e <tab> <M-backspace>
<M-backspace> r e p o <tab> r t - e m <tab> <return>
C-g M-x e m a c s - r e <tab> <backspace> <backspace>
<tab> b u <tab> <tab> <M-backspace> <M-backspace> b
u g <tab> <M-backspace> r e p o r t <tab> <return>
Recent messages:
Loading vc-git...done
Invoking man git-push in the background
Please wait: formatting the git-push man page...
git-push man page formatted
Making completion list...
Mark saved where search started [3 times]
Problem parsing arguments: interpreter-exec console "print "fleen""
Making completion list...
Quit
Making completion list... [2 times]
Load-path shadows:
/home/jimb/elisp/psvn hides /usr/share/emacs/site-lisp/psvn
/home/jimb/moz/elisp/diff-mode hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/vc/diff-mode
/home/jimb/elisp/rst hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/textmodes/rst
/home/jimb/.emacs.d/org-7.5/lisp/org-faces hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/org-faces
/home/jimb/.emacs.d/org-7.5/lisp/ob-keys hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/ob-keys
/home/jimb/.emacs.d/org-7.5/lisp/org-taskjuggler hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/org-taskjuggler
/home/jimb/.emacs.d/org-7.5/lisp/ob-C hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/ob-C
/home/jimb/.emacs.d/org-7.5/lisp/org-capture hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/org-capture
/home/jimb/.emacs.d/org-7.5/lisp/org-freemind hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/org-freemind
/home/jimb/.emacs.d/org-7.5/lisp/org-datetree hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/org-datetree
/home/jimb/.emacs.d/org-7.5/lisp/org-publish hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/org-publish
/home/jimb/.emacs.d/org-7.5/lisp/ob-exp hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/ob-exp
/home/jimb/.emacs.d/org-7.5/lisp/ob-js hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/ob-js
/home/jimb/.emacs.d/org-7.5/lisp/ob-ocaml hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/ob-ocaml
/home/jimb/.emacs.d/org-7.5/lisp/org-ctags hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/org-ctags
/home/jimb/.emacs.d/org-7.5/lisp/ob-R hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/ob-R
/home/jimb/.emacs.d/org-7.5/lisp/org-footnote hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/org-footnote
/home/jimb/.emacs.d/org-7.5/lisp/ob-gnuplot hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/ob-gnuplot
/home/jimb/.emacs.d/org-7.5/lisp/org-remember hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/org-remember
/home/jimb/.emacs.d/org-7.5/lisp/org-irc hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/org-irc
/home/jimb/.emacs.d/org-7.5/lisp/org-clock hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/org-clock
/home/jimb/.emacs.d/org-7.5/lisp/ob-calc hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/ob-calc
/home/jimb/.emacs.d/org-7.5/lisp/org-docbook hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/org-docbook
/home/jimb/.emacs.d/org-7.5/lisp/org-timer hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/org-timer
/home/jimb/.emacs.d/org-7.5/lisp/ob-emacs-lisp hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/ob-emacs-lisp
/home/jimb/.emacs.d/org-7.5/lisp/org-table hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/org-table
/home/jimb/.emacs.d/org-7.5/lisp/ob-ruby hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/ob-ruby
/home/jimb/.emacs.d/org-7.5/lisp/org-info hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/org-info
/home/jimb/.emacs.d/org-7.5/lisp/org-vm hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/org-vm
/home/jimb/.emacs.d/org-7.5/lisp/org-pcomplete hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/org-pcomplete
/home/jimb/.emacs.d/org-7.5/lisp/ob-css hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/ob-css
/home/jimb/.emacs.d/org-7.5/lisp/ob-tangle hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/ob-tangle
/home/jimb/.emacs.d/org-7.5/lisp/org-install hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/org-install
/home/jimb/.emacs.d/org-7.5/lisp/ob-ledger hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/ob-ledger
/home/jimb/.emacs.d/org-7.5/lisp/org-archive hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/org-archive
/home/jimb/.emacs.d/org-7.5/lisp/org hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/org
/home/jimb/.emacs.d/org-7.5/lisp/org-beamer hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/org-beamer
/home/jimb/.emacs.d/org-7.5/lisp/org-colview hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/org-colview
/home/jimb/.emacs.d/org-7.5/lisp/org-latex hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/org-latex
/home/jimb/.emacs.d/org-7.5/lisp/org-wl hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/org-wl
/home/jimb/.emacs.d/org-7.5/lisp/org-habit hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/org-habit
/home/jimb/.emacs.d/org-7.5/lisp/ob-lob hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/ob-lob
/home/jimb/.emacs.d/org-7.5/lisp/org-bibtex hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/org-bibtex
/home/jimb/.emacs.d/org-7.5/lisp/ob-python hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/ob-python
/home/jimb/.emacs.d/org-7.5/lisp/org-exp hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/org-exp
/home/jimb/.emacs.d/org-7.5/lisp/org-indent hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/org-indent
/home/jimb/.emacs.d/org-7.5/lisp/ob-scheme hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/ob-scheme
/home/jimb/.emacs.d/org-7.5/lisp/ob-sh hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/ob-sh
/home/jimb/.emacs.d/org-7.5/lisp/org-mobile hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/org-mobile
/home/jimb/.emacs.d/org-7.5/lisp/ob hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/ob
/home/jimb/.emacs.d/org-7.5/lisp/org-gnus hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/org-gnus
/home/jimb/.emacs.d/org-7.5/lisp/org-compat hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/org-compat
/home/jimb/.emacs.d/org-7.5/lisp/org-mhe hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/org-mhe
/home/jimb/.emacs.d/org-7.5/lisp/org-w3m hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/org-w3m
/home/jimb/.emacs.d/org-7.5/lisp/org-src hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/org-src
/home/jimb/.emacs.d/org-7.5/lisp/ob-lisp hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/ob-lisp
/home/jimb/.emacs.d/org-7.5/lisp/org-docview hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/org-docview
/home/jimb/.emacs.d/org-7.5/lisp/ob-screen hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/ob-screen
/home/jimb/.emacs.d/org-7.5/lisp/org-list hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/org-list
/home/jimb/.emacs.d/org-7.5/lisp/ob-eval hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/ob-eval
/home/jimb/.emacs.d/org-7.5/lisp/ob-haskell hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/ob-haskell
/home/jimb/.emacs.d/org-7.5/lisp/org-exp-blocks hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/org-exp-blocks
/home/jimb/.emacs.d/org-7.5/lisp/org-id hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/org-id
/home/jimb/.emacs.d/org-7.5/lisp/org-attach hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/org-attach
/home/jimb/.emacs.d/org-7.5/lisp/org-rmail hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/org-rmail
/home/jimb/.emacs.d/org-7.5/lisp/ob-latex hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/ob-latex
/home/jimb/.emacs.d/org-7.5/lisp/org-mouse hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/org-mouse
/home/jimb/.emacs.d/org-7.5/lisp/ob-octave hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/ob-octave
/home/jimb/.emacs.d/org-7.5/lisp/ob-comint hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/ob-comint
/home/jimb/.emacs.d/org-7.5/lisp/ob-ref hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/ob-ref
/home/jimb/.emacs.d/org-7.5/lisp/org-special-blocks hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/org-special-blocks
/home/jimb/.emacs.d/org-7.5/lisp/ob-sql hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/ob-sql
/home/jimb/.emacs.d/org-7.5/lisp/ob-table hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/ob-table
/home/jimb/.emacs.d/org-7.5/lisp/org-mks hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/org-mks
/home/jimb/.emacs.d/org-7.5/lisp/org-plot hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/org-plot
/home/jimb/.emacs.d/org-7.5/lisp/ob-mscgen hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/ob-mscgen
/home/jimb/.emacs.d/org-7.5/lisp/org-mew hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/org-mew
/home/jimb/.emacs.d/org-7.5/lisp/org-icalendar hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/org-icalendar
/home/jimb/.emacs.d/org-7.5/lisp/ob-clojure hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/ob-clojure
/home/jimb/.emacs.d/org-7.5/lisp/org-inlinetask hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/org-inlinetask
/home/jimb/.emacs.d/org-7.5/lisp/ob-dot hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/ob-dot
/home/jimb/.emacs.d/org-7.5/lisp/org-agenda hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/org-agenda
/home/jimb/.emacs.d/org-7.5/lisp/org-protocol hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/org-protocol
/home/jimb/.emacs.d/org-7.5/lisp/org-entities hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/org-entities
/home/jimb/.emacs.d/org-7.5/lisp/ob-asymptote hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/ob-asymptote
/home/jimb/.emacs.d/org-7.5/lisp/ob-sqlite hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/ob-sqlite
/home/jimb/.emacs.d/org-7.5/lisp/org-feed hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/org-feed
/home/jimb/.emacs.d/org-7.5/lisp/org-ascii hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/org-ascii
/home/jimb/.emacs.d/org-7.5/lisp/ob-matlab hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/ob-matlab
/home/jimb/.emacs.d/org-7.5/lisp/ob-org hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/ob-org
/home/jimb/.emacs.d/org-7.5/lisp/org-bbdb hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/org-bbdb
/home/jimb/.emacs.d/org-7.5/lisp/org-xoxo hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/org-xoxo
/home/jimb/.emacs.d/org-7.5/lisp/org-macs hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/org-macs
/home/jimb/.emacs.d/org-7.5/lisp/org-mac-message hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/org-mac-message
/home/jimb/.emacs.d/org-7.5/lisp/ob-ditaa hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/ob-ditaa
/home/jimb/.emacs.d/org-7.5/lisp/org-html hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/org-html
/home/jimb/.emacs.d/org-7.5/lisp/org-jsinfo hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/org-jsinfo
/home/jimb/.emacs.d/org-7.5/lisp/ob-sass hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/ob-sass
/home/jimb/.emacs.d/org-7.5/lisp/org-crypt hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/org-crypt
/home/jimb/.emacs.d/org-7.5/lisp/ob-perl hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/ob-perl
/home/jimb/.emacs.d/org-7.5/lisp/ob-plantuml hides
/home/jimb/emacs/share/emacs/24.0.93/lisp/org/ob-plantuml
Features:
(shadow sort gnus-cite mail-extr gnus-msg gnus-art mm-uu mml2015
epg-config mm-view mml-smime smime dig gnus-sum nnoo gnus-group
gnus-undo nnmail mail-source gnus-start gnus-spec gnus-int gnus-range
gnus-win message rfc822 mml mml-sec mm-decode mm-bodies mm-encode
mail-parse rfc2231 mailabbrev gmm-utils mailheader gnus gnus-ems
nnheader emacsbug gdb-mi help-fns derived bindat json gud easy-mmode
multi-isearch help-mode view tabify man vc-git conf-mode newcomment
gnutls network-stream starttls tls erc-track erc-ring erc-notify
erc-networks erc-netsplit erc-menu easymenu erc-match erc-pcomplete
pcomplete comint ring erc-button erc-fill erc-stamp wid-edit erc-join
erc-goodies erc erc-backend erc-compat format-spec thingatpt pp sendmail
rfc2047 rfc2045 ietf-drums mail-utils patchutils jimb-patch page-ext
server alt-dired-view dired diff-find-mq-file mozilla-c-style
google-c-style cc-styles cc-align cc-engine cc-vars cc-defs regexp-opt
jimb-frames ffap org-install bugzilla url url-proxy url-privacy
url-expand url-methods url-history url-cookie url-util url-parse
auth-source eieio byte-opt bytecomp byte-compile cconv macroexp assoc
gnus-util password-cache url-vars mm-util mail-prsvr mailcap jimb-js
edmacro kmacro mercurial-queues cl js2-mode-autoloads package reporter
time-date tooltip ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd
tool-bar dnd fontset image fringe lisp-mode register page menu-bar
rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax
facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak
czech european ethiopic indian cyrillic chinese case-table epa-hook
jka-cmpr-hook help simple abbrev minibuffer loaddefs button faces
cus-face files text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget hashtable-print-readable backquote
make-network-process dbusbind dynamic-setting system-font-setting
font-render-setting move-toolbar gtk x-toolkit x multi-tty emacs)
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#10765: Patch to fix this bug
2012-02-08 20:56 bug#10765: 24.0.93; gdb-mi cannot transmit commands containing double quotes Jim Blandy
@ 2012-02-08 21:04 ` Jim Blandy
2012-02-08 21:32 ` Andreas Schwab
0 siblings, 1 reply; 6+ messages in thread
From: Jim Blandy @ 2012-02-08 21:04 UTC (permalink / raw)
To: 10765
[-- Attachment #1: Type: text/plain, Size: 37 bytes --]
Attached is a patch to fix this bug.
[-- Attachment #2: gdb-mi-quotes.patch --]
[-- Type: text/x-patch, Size: 2257 bytes --]
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index be12a73..00cd7db 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -156,6 +156,13 @@
* ido.el (ido-find-file): Doc fix (ido-toggle-vc not on any key).
+2012-02-04 Jim Blandy <jimb@red-bean.com>
+
+ * 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.
+
2012-02-03 Glenn Morris <rgm@gnu.org>
* image.el (image-animated-p): Doc fix. Use image-animated-types.
diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el
index 301714e..6ffb67e 100644
--- a/lisp/progmodes/gdb-mi.el
+++ b/lisp/progmodes/gdb-mi.el
@@ -1672,8 +1672,6 @@ static char *magick[] = {
(if (not (string= "" string))
(setq gdb-last-command string)
(if gdb-last-command (setq string gdb-last-command)))
- (if gdb-enable-debug
- (push (cons 'mi-send (concat string "\n")) gdb-debug-log))
(if (string-match "^-" string)
;; MI command
(progn
@@ -1683,10 +1681,23 @@ static char *magick[] = {
(if (string-match "\\\\$" string)
(setq gdb-continuation (concat gdb-continuation string "\n"))
(setq gdb-first-done-or-error t)
- (process-send-string proc (concat "-interpreter-exec console \""
- gdb-continuation string "\"\n"))
+ (let ((to-send (concat "-interpreter-exec console "
+ (gdb-mi-quote string)
+ "\n")))
+ (if gdb-enable-debug
+ (push (cons 'mi-send to-send) gdb-debug-log))
+ (process-send-string proc to-send))
(setq gdb-continuation nil))))
+(defun gdb-mi-quote (string)
+ "Return STRING quoted properly as an MI argument.
+The string is enclosed in double quotes.
+All embedded quotes are replaced with \"\\\"\".
+All embedded newlines are replaced with \"\\n\"."
+ (let* ((quotes (replace-regexp-in-string "\"" "\\\"" string t t))
+ (newlines (replace-regexp-in-string "\n" "\\n" quotes t t)))
+ (concat "\"" newlines "\"")))
+
(defun gdb-input (command handler-function)
"Send COMMAND to GDB via the MI interface.
Run the function HANDLER-FUNCTION, with no arguments, once the command is
^ permalink raw reply related [flat|nested] 6+ messages in thread
* bug#10765: Patch to fix this bug
2012-02-08 21:04 ` bug#10765: Patch to fix this bug Jim Blandy
@ 2012-02-08 21:32 ` Andreas Schwab
2012-02-09 19:14 ` Jim Blandy
0 siblings, 1 reply; 6+ messages in thread
From: Andreas Schwab @ 2012-02-08 21:32 UTC (permalink / raw)
To: Jim Blandy; +Cc: 10765
Jim Blandy <jimb@red-bean.com> writes:
> +(defun gdb-mi-quote (string)
> + "Return STRING quoted properly as an MI argument.
> +The string is enclosed in double quotes.
> +All embedded quotes are replaced with \"\\\"\".
> +All embedded newlines are replaced with \"\\n\"."
What about backslashes?
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#10765: Patch to fix this bug
2012-02-08 21:32 ` Andreas Schwab
@ 2012-02-09 19:14 ` Jim Blandy
2012-02-26 9:39 ` Chong Yidong
0 siblings, 1 reply; 6+ messages in thread
From: Jim Blandy @ 2012-02-09 19:14 UTC (permalink / raw)
To: Andreas Schwab; +Cc: 10765
[-- Attachment #1: Type: text/plain, Size: 145 bytes --]
On Wed, Feb 8, 2012 at 1:32 PM, Andreas Schwab <schwab@linux-m68k.org> wrote:
> What about backslashes?
Duh --- thanks. Revised patch attached.
[-- Attachment #2: gdb-mi-quotes.patch --]
[-- Type: text/x-patch, Size: 1967 bytes --]
lisp/ChangeLog:
2012-02-04 Jim Blandy <jimb@red-bean.com>
* 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 the exact string sent in gdb-debug-log.
diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el
index 301714e..0c45c3f 100644
--- a/lisp/progmodes/gdb-mi.el
+++ b/lisp/progmodes/gdb-mi.el
@@ -1672,8 +1672,6 @@ static char *magick[] = {
(if (not (string= "" string))
(setq gdb-last-command string)
(if gdb-last-command (setq string gdb-last-command)))
- (if gdb-enable-debug
- (push (cons 'mi-send (concat string "\n")) gdb-debug-log))
(if (string-match "^-" string)
;; MI command
(progn
@@ -1683,10 +1681,22 @@ static char *magick[] = {
(if (string-match "\\\\$" string)
(setq gdb-continuation (concat gdb-continuation string "\n"))
(setq gdb-first-done-or-error t)
- (process-send-string proc (concat "-interpreter-exec console \""
- gdb-continuation string "\"\n"))
+ (let ((to-send (concat "-interpreter-exec console "
+ (gdb-mi-quote string)
+ "\n")))
+ (if gdb-enable-debug
+ (push (cons 'mi-send to-send) gdb-debug-log))
+ (process-send-string proc to-send))
(setq gdb-continuation nil))))
+(defun gdb-mi-quote (string)
+ "Return STRING quoted properly as an MI argument.
+The string is enclosed in double quotes.
+All embedded quotes, newlines, and backslashes are preceded with a backslash."
+ (setq string (replace-regexp-in-string "\\([\"\\]\\)" "\\\\\\&" string))
+ (setq string (replace-regexp-in-string "\n" "\\n" string t t))
+ (concat "\"" string "\""))
+
(defun gdb-input (command handler-function)
"Send COMMAND to GDB via the MI interface.
Run the function HANDLER-FUNCTION, with no arguments, once the command is
^ permalink raw reply related [flat|nested] 6+ messages in thread
* bug#10765: Patch to fix this bug
2012-02-09 19:14 ` Jim Blandy
@ 2012-02-26 9:39 ` Chong Yidong
2012-02-27 19:05 ` Jim Blandy
0 siblings, 1 reply; 6+ messages in thread
From: Chong Yidong @ 2012-02-26 9:39 UTC (permalink / raw)
To: Jim Blandy; +Cc: Andreas Schwab, 10765
Jim Blandy <jimb@red-bean.com> writes:
> On Wed, Feb 8, 2012 at 1:32 PM, Andreas Schwab <schwab@linux-m68k.org> wrote:
>> What about backslashes?
>
> Duh --- thanks. Revised patch attached.
Committed, thanks.
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#10765: Patch to fix this bug
2012-02-26 9:39 ` Chong Yidong
@ 2012-02-27 19:05 ` Jim Blandy
0 siblings, 0 replies; 6+ messages in thread
From: Jim Blandy @ 2012-02-27 19:05 UTC (permalink / raw)
To: Chong Yidong; +Cc: Andreas Schwab, 10765
Thank you!
On Sun, Feb 26, 2012 at 1:39 AM, Chong Yidong <cyd@gnu.org> wrote:
> Jim Blandy <jimb@red-bean.com> writes:
>
>> On Wed, Feb 8, 2012 at 1:32 PM, Andreas Schwab <schwab@linux-m68k.org> wrote:
>>> What about backslashes?
>>
>> Duh --- thanks. Revised patch attached.
>
> Committed, thanks.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-02-27 19:05 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-08 20:56 bug#10765: 24.0.93; gdb-mi cannot transmit commands containing double quotes Jim Blandy
2012-02-08 21:04 ` bug#10765: Patch to fix this bug Jim Blandy
2012-02-08 21:32 ` Andreas Schwab
2012-02-09 19:14 ` Jim Blandy
2012-02-26 9:39 ` Chong Yidong
2012-02-27 19:05 ` Jim Blandy
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).