From: "Mattias Engdegård" <mattias.engdegard@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 66363@debbugs.gnu.org
Subject: bug#66363: gdb-control-commands-regexp issues
Date: Thu, 5 Oct 2023 19:16:32 +0200 [thread overview]
Message-ID: <EC849A28-D892-485C-B737-4610DA48F75A@gmail.com> (raw)
In-Reply-To: <83wmw12fu5.fsf@gnu.org>
> I'd appreciate a few examples of using this that don't work correctly
> (or not at all), as it is otherwise not easy to understand the
> problem, and much less the proposed solution and how to test it.
I don't have any examples but the problems are clear from reading the code.
The regexp is defined by:
> (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
> "^\\("
> "comm\\(a\\(n\\(ds?\\)?\\)?\\)?\\|if\\|while"
> "\\|def\\(i\\(ne?\\)?\\)?\\|doc\\(u\\(m\\(e\\(nt?\\)?\\)?\\)?\\)?\\|"
> gdb-python-guile-commands-regexp
> "\\|while-stepping\\|stepp\\(i\\(ng?\\)?\\)?\\|ws\\|actions"
> "\\|expl\\(o\\(re?\\)?\\)?"
> "\\)\\([[: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\".")
which results in the string regexp
> "^\\(comm\\(a\\(n\\(ds?\\)?\\)?\\)?\\|if\\|while\\|def\\(i\\(ne?\\)?\\)?\\|doc\\(u\\(m\\(e\\(nt?\\)?\\)?\\)?\\)?\\|python\\|python-interactive\\|pi\\|guile\\|guile-repl\\|gr\\|while-stepping\\|stepp\\(i\\(ng?\\)?\\)?\\|ws\\|actions\\|expl\\(o\\(re?\\)?\\)?\\)\\([[:blank:]]+\\([^[:blank:]]*\\)\\)*$"
It is used in one place only:
> (let* ((control-command-p (string-match gdb-control-commands-regexp string))
> (command-arg (and control-command-p (match-string 3 string)))
As you can see it refers to group 3, which is matched by "\\(n\\(ds?\\)?\\)" -- clearly not what anybody intended.
As for the tail, even if the match group is corrected it's a rather roundabout way of checking whether there is a non-blank character after the command (and is written using nested repetitions which is how this came to my attention).
For the examples you asked about, perhaps commit 30c0f81f9f which introduced the now broken mechanism can be of help.
next prev parent reply other threads:[~2023-10-05 17:16 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-05 15:07 bug#66363: gdb-control-commands-regexp issues Mattias Engdegård
2023-10-05 16:29 ` Eli Zaretskii
2023-10-05 17:16 ` Mattias Engdegård [this message]
2023-10-05 17:43 ` Eli Zaretskii
2023-10-05 18:11 ` Mattias Engdegård
2023-10-05 18:52 ` Eli Zaretskii
2023-10-06 12:09 ` Mattias Engdegård
2023-10-29 16:34 ` Mattias Engdegård
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=EC849A28-D892-485C-B737-4610DA48F75A@gmail.com \
--to=mattias.engdegard@gmail.com \
--cc=66363@debbugs.gnu.org \
--cc=eliz@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).