diff options
| author | Eli Zaretskii | 2015-12-16 12:40:33 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2015-12-16 12:40:33 +0200 |
| commit | 8df2eb9dc599c9eb95eea51fe7d45e972cb275f1 (patch) | |
| tree | 403649eeba429fc93e059a165447f3999667804f | |
| parent | d8b41057051896541798647e90421daf0b38ed1c (diff) | |
| download | emacs-8df2eb9dc599c9eb95eea51fe7d45e972cb275f1.tar.gz emacs-8df2eb9dc599c9eb95eea51fe7d45e972cb275f1.zip | |
Fix invocation of Python and Guile interpreters from gdb-mi
* lisp/progmodes/gdb-mi.el (gdb-control-commands-regexp): Add
commands for interactive Python and Guile interpreters.
(gdb-send): Recognize various ways of exiting from Python and
Guile interpreters and returning to GDB. For details, see
http://lists.gnu.org/archive/html/emacs-devel/2015-12/msg00693.html
and http://stackoverflow.com/questions/31514741.
| -rw-r--r-- | lisp/progmodes/gdb-mi.el | 37 |
1 files changed, 24 insertions, 13 deletions
diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el index 16f82ccb47f..bde030e3f26 100644 --- a/lisp/progmodes/gdb-mi.el +++ b/lisp/progmodes/gdb-mi.el | |||
| @@ -1766,7 +1766,8 @@ static char *magick[] = { | |||
| 1766 | (defvar gdb-control-commands-regexp | 1766 | (defvar gdb-control-commands-regexp |
| 1767 | (concat | 1767 | (concat |
| 1768 | "^\\(" | 1768 | "^\\(" |
| 1769 | "commands\\|if\\|while\\|define\\|document\\|python\\|" | 1769 | "commands\\|if\\|while\\|define\\|document\\|" |
| 1770 | "python\\|python-interactive\\|pi\\|guile\\|guile-repl\\|gr\\|" | ||
| 1770 | "while-stepping\\|stepping\\|ws\\|actions" | 1771 | "while-stepping\\|stepping\\|ws\\|actions" |
| 1771 | "\\)\\([[:blank:]]+.*\\)?$") | 1772 | "\\)\\([[:blank:]]+.*\\)?$") |
| 1772 | "Regexp matching GDB commands that enter a recursive reading loop. | 1773 | "Regexp matching GDB commands that enter a recursive reading loop. |
| @@ -1782,21 +1783,27 @@ commands to be prefixed by \"-interpreter-exec console\".") | |||
| 1782 | (let ((inhibit-read-only t)) | 1783 | (let ((inhibit-read-only t)) |
| 1783 | (remove-text-properties (point-min) (point-max) '(face)))) | 1784 | (remove-text-properties (point-min) (point-max) '(face)))) |
| 1784 | ;; mimic <RET> key to repeat previous command in GDB | 1785 | ;; mimic <RET> key to repeat previous command in GDB |
| 1785 | (if (not (string= "" string)) | 1786 | (when (= gdb-control-level 0) |
| 1786 | (if gdb-continuation | 1787 | (if (not (string= "" string)) |
| 1787 | (setq gdb-last-command (concat gdb-continuation | 1788 | (if gdb-continuation |
| 1788 | (gdb-strip-string-backslash string) | 1789 | (setq gdb-last-command (concat gdb-continuation |
| 1789 | " ")) | 1790 | (gdb-strip-string-backslash string) |
| 1790 | (setq gdb-last-command (gdb-strip-string-backslash string))) | 1791 | " ")) |
| 1791 | (if gdb-last-command (setq string gdb-last-command)) | 1792 | (setq gdb-last-command (gdb-strip-string-backslash string))) |
| 1792 | (setq gdb-continuation nil)) | 1793 | (if gdb-last-command (setq string gdb-last-command)) |
| 1793 | (if (and (not gdb-continuation) (or (string-match "^-" string) | 1794 | (setq gdb-continuation nil))) |
| 1794 | (> gdb-control-level 0))) | 1795 | (if (and (not gdb-continuation) |
| 1796 | (or (string-match "^-" string) | ||
| 1797 | (> gdb-control-level 0))) | ||
| 1795 | ;; Either MI command or we are feeding GDB's recursive reading loop. | 1798 | ;; Either MI command or we are feeding GDB's recursive reading loop. |
| 1796 | (progn | 1799 | (progn |
| 1797 | (setq gdb-first-done-or-error t) | 1800 | (setq gdb-first-done-or-error t) |
| 1798 | (process-send-string proc (concat string "\n")) | 1801 | (process-send-string proc (concat string "\n")) |
| 1799 | (if (and (string-match "^end$" string) | 1802 | (if (and (string-match |
| 1803 | (concat "^\\(" | ||
| 1804 | (if (eq system-type 'windows-nt) "\026" "\004") | ||
| 1805 | "\\|,q\\|,quit\\|end\\)$") | ||
| 1806 | string) | ||
| 1800 | (> gdb-control-level 0)) | 1807 | (> gdb-control-level 0)) |
| 1801 | (setq gdb-control-level (1- gdb-control-level)))) | 1808 | (setq gdb-control-level (1- gdb-control-level)))) |
| 1802 | ;; CLI command | 1809 | ;; CLI command |
| @@ -1812,7 +1819,11 @@ commands to be prefixed by \"-interpreter-exec console\".") | |||
| 1812 | (if gdb-enable-debug | 1819 | (if gdb-enable-debug |
| 1813 | (push (cons 'mi-send to-send) gdb-debug-log)) | 1820 | (push (cons 'mi-send to-send) gdb-debug-log)) |
| 1814 | (process-send-string proc to-send)) | 1821 | (process-send-string proc to-send)) |
| 1815 | (if (and (string-match "^end$" string) | 1822 | (if (and (string-match |
| 1823 | (concat "^\\(" | ||
| 1824 | (if (eq system-type 'windows-nt) "\026" "\004") | ||
| 1825 | "\\|,q\\|,quit\\|end\\)$") | ||
| 1826 | string) | ||
| 1816 | (> gdb-control-level 0)) | 1827 | (> gdb-control-level 0)) |
| 1817 | (setq gdb-control-level (1- gdb-control-level))) | 1828 | (setq gdb-control-level (1- gdb-control-level))) |
| 1818 | (setq gdb-continuation nil))) | 1829 | (setq gdb-continuation nil))) |