Subject: bug#66363: gdb-control-commands-regexp issues

From: Eli Zaretskii <[email-masked]>
Date: Thu, 05 Oct 2023 19:29:06 +0300

> From: Mattias Engdegård <[email-masked]>
> Date: Thu, 5 Oct 2023 17:07:22 +0200
> 
> The variable `gdb-control-commands-regexp` in gdb-mi.el cannot work as currently defined and used. Only group 3 is of  interest, but that group hasn't referred to anything useful for several years.
> 
> Group 3 probably refers to a part of the regex's tail where the command argument is matched:
> 
>    "\\([[:blank:]]+\\([^[:blank:]]*\\)\\)*$"
> 
> However, this seems to be broken as well, because all groups here are inside repetitions. This part of the regexp is also exponential in form if not in practice but we'd better simplify it anyway.
> 
> Attached is a suggested patch which makes explicit the command abbreviations matched, and leaves only a single submatch. It also changes the tail to assuming that the command argument doesn't contain non-newlines (or the final eol anchor wouldn't make sense) but that it can contain spaces (which seems reasonable). However, right now the argument is only checked for being non-empty or not.
> 
> I don't have a working gdb setup at the moment so if someone would be kind to test it, I would be very grateful for it.

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.

TIA