gdb/python: New method to access list of register groups
authorAndrew Burgess <andrew.burgess@embecosm.com>
Sun, 7 Jun 2020 09:08:01 +0000 (10:08 +0100)
committerAndrew Burgess <andrew.burgess@embecosm.com>
Mon, 6 Jul 2020 14:06:06 +0000 (15:06 +0100)
commit64cb3757a9df273b990adf4f28333324edc3cae8
treebd2f7edb9b8da04b018d532afa24b489f020499d
parent0f767f942b027df6de60c42ed0e4a1dac7d0fd4b
gdb/python: New method to access list of register groups

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.

gdb/ChangeLog:

* NEWS: Mention additions to Python API.
* python/py-arch.c (archpy_register_groups): New function.
(arch_object_methods): Add 'register_groups' method.
* python/py-registers.c (reggroup_iterator_object): New struct.
(reggroup_object): New struct.
(gdbpy_new_reggroup): New function.
(gdbpy_reggroup_to_string): New function.
(gdbpy_reggroup_name): New function.
(gdbpy_reggroup_iter): New function.
(gdbpy_reggroup_iter_next): New function.
(gdbpy_new_reggroup_iterator): New function
(gdbpy_initialize_registers): Register new types.
(reggroup_iterator_object_type): Define new Python type.
(gdbpy_reggroup_getset): New static global.
(reggroup_object_type): Define new Python type.
* python/python-internal.h

gdb/testsuite/ChangeLog:

* gdb.python/py-arch-reg-groups.exp: New file.

gdb/doc/ChangeLog:

* gdb.texi (Registers): Add @anchor for 'info registers
<reggroup>' command.
* python.texi (Architectures In Python): Document new
register_groups method.
(Registers In Python): Document two new object types related to
register groups.
gdb/ChangeLog
gdb/NEWS
gdb/doc/ChangeLog
gdb/doc/gdb.texinfo
gdb/doc/python.texi
gdb/python/py-arch.c
gdb/python/py-registers.c
gdb/python/python-internal.h
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.python/py-arch-reg-groups.exp [new file with mode: 0644]