Re: [PATCHv2 07/16] gdb/tui: avoid theoretical bug with 'tui reg' command

Simon Marchi via Gdb-patches
2022-04-06T13:03:01Z

On 2022-04-06 08:04, Andrew Burgess via Gdb-patches wrote:
> While looking at the 'tui reg' command as part of another patch, I
> spotted a theoretical bug.
>
> The 'tui reg' command takes the name of a register group, but also
> handles partial register group matches, though the partial match has to
> be unique. The current command logic goes:
>
> With the code as currently written, if a target description named a
> register group either 'prev' or 'next' then GDB would see this as an
> ambiguous register name, and refuse to switch groups.
>
> Naming a register group 'prev' or 'next' seems pretty unlikely, but,
> by adding a single else block we can prevent this problem.
>
> Now, if there's a 'prev' or 'next' register group, the user will not
> be able to select the group directly, the 'prev' and 'next' names will
> always iterate through the available groups instead. But at least the
> user could select their groups by iteration, rather than direct
> selection.

This looks ok to me. All previous patches also look ok, but I didn't
reply to each one, since they are mostly obvious.

Simon