:group 'gdb)
\f
+(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\".")
(> 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.