gdb: Add a find method for RegisterDescriptorIterator
authorAndrew Burgess <andrew.burgess@embecosm.com>
Wed, 22 Jul 2020 13:02:30 +0000 (14:02 +0100)
committerAndrew Burgess <andrew.burgess@embecosm.com>
Tue, 28 Jul 2020 09:27:53 +0000 (10:27 +0100)
commit14fa8fb3073dfdb8736ccf6bde6572d8b226c4cf
tree714047412271f8f7fb8e557f918c2fab03713fe9
parent67411cbf63a0e841ac6801bf59c854fed8b8dd80
gdb: Add a find method for RegisterDescriptorIterator

Adds a new method 'find' to the gdb.RegisterDescriptorIterator class,
this allows gdb.RegisterDescriptor objects to be looked up directly by
register name rather than having to iterate over all registers.

This will be of use for a later commit.

I've documented the new function in the manual, but I don't think a
NEWS entry is required here, as, since the last release, the whole
register descriptor mechanism is new, and is already mentioned in the
NEWS file.

gdb/ChangeLog:

* python/py-registers.c: Add 'user-regs.h' include.
(register_descriptor_iter_find): New function.
(register_descriptor_iterator_object_methods): New static global
methods array.
(register_descriptor_iterator_object_type): Add pointer to methods
array.

gdb/testsuite/ChangeLog:

* gdb.python/py-arch-reg-names.exp: Add additional tests.

gdb/doc/ChangeLog:

* python.texi (Registers In Python): Document new find function.
gdb/ChangeLog
gdb/doc/ChangeLog
gdb/doc/python.texi
gdb/python/py-registers.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.python/py-arch-reg-names.exp