summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2017-06-10 11:29:58 +0300
committerEli Zaretskii <eliz@gnu.org>2017-06-10 11:29:58 +0300
commit30c0f81f9faca5df012a93b6b0dc9cab5a7de65d (patch)
tree2e54aa423ecb5c1840b1e76486c3881a46d195be /lisp
parent6b4b13eb3868e861df8e52e491214376134baf63 (diff)
downloademacs-30c0f81f9faca5df012a93b6b0dc9cab5a7de65d.tar.gz
emacs-30c0f81f9faca5df012a93b6b0dc9cab5a7de65d.tar.bz2
emacs-30c0f81f9faca5df012a93b6b0dc9cab5a7de65d.zip
Fix handling of Python/Guile commands with arguments in gdb-mi.el
* lisp/progmodes/gdb-mi.el (gdb-python-guile-commands-regexp): New variable. (gdb-control-commands-regexp): Use it. (gdb-send): Don't increment gdb-control-level if the command matches gdb-python-guile-commands-regexp and has non-empty arguments. Reported by David Boles <boles@ieee.org> in http://lists.gnu.org/archive/html/emacs-devel/2017-06/msg00009.html.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/progmodes/gdb-mi.el23
1 files changed, 18 insertions, 5 deletions
diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el
index 1af520dbc32..cc9205c0d8a 100644
--- a/lisp/progmodes/gdb-mi.el
+++ b/lisp/progmodes/gdb-mi.el
@@ -1767,13 +1767,17 @@ static char *magick[] = {
:group 'gdb)
+(defvar gdb-python-guile-commands-regexp
+ "python\\|python-interactive\\|pi\\|guile\\|guile-repl\\|gr"
+ "Regexp that matches Python and Guile commands supported by GDB.")
+
(defvar gdb-control-commands-regexp
(concat
"^\\("
"commands\\|if\\|while\\|define\\|document\\|"
- "python\\|python-interactive\\|pi\\|guile\\|guile-repl\\|gr\\|"
- "while-stepping\\|stepping\\|ws\\|actions"
- "\\)\\([[:blank:]]+.*\\)?$")
+ gdb-python-guile-commands-regexp
+ "\\|while-stepping\\|stepping\\|ws\\|actions"
+ "\\)\\([[:blank:]]+\\([^[: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\".")
@@ -1831,8 +1835,17 @@ commands to be prefixed by \"-interpreter-exec console\".")
(> 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))))
+ ;; Python and Guile commands that have an argument don't enter the
+ ;; recursive reading loop.
+ (let* ((control-command-p (string-match gdb-control-commands-regexp string))
+ (command-arg (match-string 3 string))
+ (python-or-guile-p (string-match gdb-python-guile-commands-regexp
+ string)))
+ (if (and control-command-p
+ (or (not python-or-guile-p)
+ (null command-arg)
+ (zerop (length command-arg))))
+ (setq gdb-control-level (1+ gdb-control-level)))))
(defun gdb-mi-quote (string)
"Return STRING quoted properly as an MI argument.