aboutsummaryrefslogtreecommitdiff
path: root/gdb/doc
diff options
context:
space:
mode:
authorAndrew Burgess <andrew.burgess@embecosm.com>2020-07-22 14:02:30 +0100
committerAndrew Burgess <andrew.burgess@embecosm.com>2020-07-28 10:27:53 +0100
commit14fa8fb3073dfdb8736ccf6bde6572d8b226c4cf (patch)
tree714047412271f8f7fb8e557f918c2fab03713fe9 /gdb/doc
parent67411cbf63a0e841ac6801bf59c854fed8b8dd80 (diff)
downloadbinutils-14fa8fb3073dfdb8736ccf6bde6572d8b226c4cf.zip
binutils-14fa8fb3073dfdb8736ccf6bde6572d8b226c4cf.tar.gz
binutils-14fa8fb3073dfdb8736ccf6bde6572d8b226c4cf.tar.bz2
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.
Diffstat (limited to 'gdb/doc')
-rw-r--r--gdb/doc/ChangeLog4
-rw-r--r--gdb/doc/python.texi9
2 files changed, 13 insertions, 0 deletions
diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog
index 7e530c0..1074511 100644
--- a/gdb/doc/ChangeLog
+++ b/gdb/doc/ChangeLog
@@ -1,3 +1,7 @@
+2020-07-28 Andrew Burgess <andrew.burgess@embecosm.com>
+
+ * python.texi (Registers In Python): Document new find function.
+
2020-07-22 Kevin Buettner <kevinb@redhat.com>
* gdb.texinfo (Maintenance Commands): Add documentation for
diff --git a/gdb/doc/python.texi b/gdb/doc/python.texi
index 4fb994c..c9dc1ff 100644
--- a/gdb/doc/python.texi
+++ b/gdb/doc/python.texi
@@ -5755,6 +5755,15 @@ A @code{gdb.RegisterDescriptor} has the following read-only properties:
The name of this register.
@end defvar
+It is also possible to lookup a register descriptor based on its name
+using the following @code{gdb.RegisterDescriptorIterator} function:
+
+@defun RegisterDescriptorIterator.find (@var{name})
+Takes @var{name} as an argument, which must be a string, and returns a
+@code{gdb.RegisterDescriptor} for the register with that name, or
+@code{None} if there is no register with that name.
+@end defun
+
Python code can also request from a @code{gdb.Architecture}
information about the set of register groups available on a given
architecture