[PATCH 0/2] Improvements to Python Register Descriptor API

Andrew Burgess andrew.burgess@embecosm.com
Wed Jul 8 08:48:10 GMT 2020


I was thinking about my recent Python API additions to provide access
to register and register group information, and I thought that the
implementation of the API could be improved.

Currently for both registers and register groups, you ask the
architecture for an iterator, and the iterator then returns
descriptors.  Each descriptor returned is a new object, so if you have
two iterators, and ask the the first register you'll get two unique
objects that both describe the same register.

I thought it might be a nice improvement if the objects returned were
the same from every iterator, so in the above example you'd end up
with two references to the same object.  In this way you can compare
the objects for equality.

I don't know if this will be useful, but this seems like a better
implementation, so I'd like to change things to work this way
(assuming nobody disagrees).

Thanks,
Andrew

---

Andrew Burgess (2):
  gdb/python: Reuse gdb.RegisterDescriptor objects where possible
  gdb/python: Reuse gdb.RegisterGroup objects where possible

 gdb/ChangeLog                                 |  19 ++++
 gdb/python/py-registers.c                     | 103 ++++++++++++++----
 gdb/testsuite/ChangeLog                       |   8 ++
 .../gdb.python/py-arch-reg-groups.exp         |  19 ++++
 .../gdb.python/py-arch-reg-names.exp          |  19 ++++
 5 files changed, 146 insertions(+), 22 deletions(-)

-- 
2.25.4



More information about the Gdb-patches mailing list