Re: [PATCH 4/5] gdb/python: New method to access list of register groups

Andrew Burgess
2020-06-18T08:44:14Z

* Christian Biesinger <cbiesinger@google.com> [2020-06-17 13:40:47 -0500]:

> On Wed, Jun 17, 2020 at 12:38 PM Andrew Burgess
> <andrew.burgess@embecosm.com> wrote:
> >
> > Add a new method gdb.Architecture.register_groups which returns a new
> > object of type gdb.RegisterGroupsIterator. This new iterator then
> > returns objects of type gdb.RegisterGroup.
> >
> > Each gdb.RegisterGroup object just wraps a single reggroup pointer,
> > and (currently) has just one read-only property 'name' that is a
> > string, the name of the register group.
> >
> > As with the previous commit (adding gdb.RegisterDescriptor) I made
> > gdb.RegisterGroup an object rather than just a string in case we want
> > to add additional properties in the future.
>
> So this adds just the ability to get the names of the groups, without
> a way to associate specific registers with the group? Out of
> curiosity, what's the use case for that?

I did consider that, but remember that groups exist across
architectures. That is, there's only one "all" group that everyone
shares.

As such to go from group -> registers you would have to supply an
architecture. And by that point you may just as well call the
registers method on the architecture.

As for use case the only thing that comes immediately to mind would be
if you wanted to implement a new kind of register viewing window in
the TUI. This would provide a way for Python to figure out which
register groups exist.

Honestly, I needed the registers API to write my test (for a later
patch in the series), and I added this one mostly just because I was
working in the area and it seemed kind-of related.

Thanks,
Andrew