diff options
| author | Mattias EngdegÄrd | 2023-10-29 17:16:35 +0100 |
|---|---|---|
| committer | Mattias EngdegÄrd | 2023-10-29 17:16:35 +0100 |
| commit | 7e47d88499f3296eb314a12f483292d9154307de (patch) | |
| tree | e424235ecdfb2e33992be1c85d48a0a668c5a752 | |
| parent | c71c949618dba7a371f94a8f0d1668e717c69fb2 (diff) | |
| download | emacs-7e47d88499f3296eb314a12f483292d9154307de.tar.gz emacs-7e47d88499f3296eb314a12f483292d9154307de.zip | |
Fix broken gdb-control-commands-regexp (bug#66363)
* lisp/progmodes/gdb-mi.el (gdb-python-guile-commands-regexp):
Remove, integrate into...
(gdb-control-commands-regexp): ...this. Translate into rx.
Remove useless submatches which broke earlier attempts at using other
submatches. Rewrite tail expression to avoid superlinear nested
repetition, eliminating a Relint complaint.
* lisp/progmodes/gdb-mi.el (gdb-send): Simplify use of the regexp
above, and use the correct submatch this time. Remove unnecessary and
incorrect second regexp matching.
| -rw-r--r-- | lisp/progmodes/gdb-mi.el | 44 |
1 files changed, 23 insertions, 21 deletions
diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el index bc0070d2630..3afdc59a67e 100644 --- a/lisp/progmodes/gdb-mi.el +++ b/lisp/progmodes/gdb-mi.el | |||
| @@ -1960,19 +1960,23 @@ static char *magick[] = { | |||
| 1960 | :group 'gdb) | 1960 | :group 'gdb) |
| 1961 | 1961 | ||
| 1962 | 1962 | ||
| 1963 | (defvar gdb-python-guile-commands-regexp | ||
| 1964 | "python\\|python-interactive\\|pi\\|guile\\|guile-repl\\|gr" | ||
| 1965 | "Regexp that matches Python and Guile commands supported by GDB.") | ||
| 1966 | |||
| 1967 | (defvar gdb-control-commands-regexp | 1963 | (defvar gdb-control-commands-regexp |
| 1968 | (concat | 1964 | (rx bol |
| 1969 | "^\\(" | 1965 | (or |
| 1970 | "comm\\(a\\(n\\(ds?\\)?\\)?\\)?\\|if\\|while" | 1966 | (or "comm" "comma" "comman" "command" "commands" |
| 1971 | "\\|def\\(i\\(ne?\\)?\\)?\\|doc\\(u\\(m\\(e\\(nt?\\)?\\)?\\)?\\)?\\|" | 1967 | "if" "while" |
| 1972 | gdb-python-guile-commands-regexp | 1968 | "def" "defi" "defin" "define" |
| 1973 | "\\|while-stepping\\|stepp\\(i\\(ng?\\)?\\)?\\|ws\\|actions" | 1969 | "doc" "docu" "docum" "docume" "documen" "document" |
| 1974 | "\\|expl\\(o\\(re?\\)?\\)?" | 1970 | "while-stepping" |
| 1975 | "\\)\\([[:blank:]]+\\([^[:blank:]]*\\)\\)*$") | 1971 | "stepp" "steppi" "steppin" "stepping" |
| 1972 | "ws" "actions" | ||
| 1973 | "expl" "explo" "explor" "explore") | ||
| 1974 | (group ; group 1: Python and Guile commands | ||
| 1975 | (or "python" "python-interactive" "pi" "guile" "guile-repl" "gr"))) | ||
| 1976 | (? (+ blank) | ||
| 1977 | (group ; group 2: command arguments | ||
| 1978 | (* nonl))) | ||
| 1979 | eol) | ||
| 1976 | "Regexp matching GDB commands that enter a recursive reading loop. | 1980 | "Regexp matching GDB commands that enter a recursive reading loop. |
| 1977 | As long as GDB is in the recursive reading loop, it does not expect | 1981 | As long as GDB is in the recursive reading loop, it does not expect |
| 1978 | commands to be prefixed by \"-interpreter-exec console\".") | 1982 | commands to be prefixed by \"-interpreter-exec console\".") |
| @@ -2032,15 +2036,13 @@ commands to be prefixed by \"-interpreter-exec console\".") | |||
| 2032 | (setq gdb-continuation nil))) | 2036 | (setq gdb-continuation nil))) |
| 2033 | ;; Python and Guile commands that have an argument don't enter the | 2037 | ;; Python and Guile commands that have an argument don't enter the |
| 2034 | ;; recursive reading loop. | 2038 | ;; recursive reading loop. |
| 2035 | (let* ((control-command-p (string-match gdb-control-commands-regexp string)) | 2039 | (when (string-match gdb-control-commands-regexp string) |
| 2036 | (command-arg (and control-command-p (match-string 3 string))) | 2040 | (let ((python-or-guile-p (match-beginning 1)) |
| 2037 | (python-or-guile-p (string-match gdb-python-guile-commands-regexp | 2041 | (command-arg (match-string 2 string))) |
| 2038 | string))) | 2042 | (when (or (not python-or-guile-p) |
| 2039 | (if (and control-command-p | 2043 | (null command-arg) |
| 2040 | (or (not python-or-guile-p) | 2044 | (zerop (length command-arg))) |
| 2041 | (null command-arg) | 2045 | (setq gdb-control-level (1+ gdb-control-level)))))) |
| 2042 | (zerop (length command-arg)))) | ||
| 2043 | (setq gdb-control-level (1+ gdb-control-level))))) | ||
| 2044 | 2046 | ||
| 2045 | (defun gdb-mi-quote (string) | 2047 | (defun gdb-mi-quote (string) |
| 2046 | "Return STRING quoted properly as an MI argument. | 2048 | "Return STRING quoted properly as an MI argument. |