aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2017-06-10 11:29:58 +0300
committerEli Zaretskii2017-06-10 11:29:58 +0300
commit30c0f81f9faca5df012a93b6b0dc9cab5a7de65d (patch)
tree2e54aa423ecb5c1840b1e76486c3881a46d195be
parent6b4b13eb3868e861df8e52e491214376134baf63 (diff)
downloademacs-30c0f81f9faca5df012a93b6b0dc9cab5a7de65d.tar.gz
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.
-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[] = {
1767 :group 'gdb) 1767 :group 'gdb)
1768 1768
1769 1769
1770(defvar gdb-python-guile-commands-regexp
1771 "python\\|python-interactive\\|pi\\|guile\\|guile-repl\\|gr"
1772 "Regexp that matches Python and Guile commands supported by GDB.")
1773
1770(defvar gdb-control-commands-regexp 1774(defvar gdb-control-commands-regexp
1771 (concat 1775 (concat
1772 "^\\(" 1776 "^\\("
1773 "commands\\|if\\|while\\|define\\|document\\|" 1777 "commands\\|if\\|while\\|define\\|document\\|"
1774 "python\\|python-interactive\\|pi\\|guile\\|guile-repl\\|gr\\|" 1778 gdb-python-guile-commands-regexp
1775 "while-stepping\\|stepping\\|ws\\|actions" 1779 "\\|while-stepping\\|stepping\\|ws\\|actions"
1776 "\\)\\([[:blank:]]+.*\\)?$") 1780 "\\)\\([[:blank:]]+\\([^[:blank:]]*\\)\\)?$")
1777 "Regexp matching GDB commands that enter a recursive reading loop. 1781 "Regexp matching GDB commands that enter a recursive reading loop.
1778As long as GDB is in the recursive reading loop, it does not expect 1782As long as GDB is in the recursive reading loop, it does not expect
1779commands to be prefixed by \"-interpreter-exec console\".") 1783commands to be prefixed by \"-interpreter-exec console\".")
@@ -1831,8 +1835,17 @@ commands to be prefixed by \"-interpreter-exec console\".")
1831 (> gdb-control-level 0)) 1835 (> gdb-control-level 0))
1832 (setq gdb-control-level (1- gdb-control-level))) 1836 (setq gdb-control-level (1- gdb-control-level)))
1833 (setq gdb-continuation nil))) 1837 (setq gdb-continuation nil)))
1834 (if (string-match gdb-control-commands-regexp string) 1838 ;; Python and Guile commands that have an argument don't enter the
1835 (setq gdb-control-level (1+ gdb-control-level)))) 1839 ;; recursive reading loop.
1840 (let* ((control-command-p (string-match gdb-control-commands-regexp string))
1841 (command-arg (match-string 3 string))
1842 (python-or-guile-p (string-match gdb-python-guile-commands-regexp
1843 string)))
1844 (if (and control-command-p
1845 (or (not python-or-guile-p)
1846 (null command-arg)
1847 (zerop (length command-arg))))
1848 (setq gdb-control-level (1+ gdb-control-level)))))
1836 1849
1837(defun gdb-mi-quote (string) 1850(defun gdb-mi-quote (string)
1838 "Return STRING quoted properly as an MI argument. 1851 "Return STRING quoted properly as an MI argument.