diff options
author | Andrew Burgess <andrew.burgess@embecosm.com> | 2020-07-07 15:26:42 +0100 |
---|---|---|
committer | Andrew Burgess <andrew.burgess@embecosm.com> | 2020-07-21 21:57:08 +0100 |
commit | baf8791efb4b5cb41348b11ad9f63e6c2a004c5f (patch) | |
tree | 87b92e4e11919ae60839e352c79c4833b5f8a58c /gdb/infrun.c | |
parent | f7306dac19c502232f766c3881313857915f330d (diff) | |
download | gdb-baf8791efb4b5cb41348b11ad9f63e6c2a004c5f.zip gdb-baf8791efb4b5cb41348b11ad9f63e6c2a004c5f.tar.gz gdb-baf8791efb4b5cb41348b11ad9f63e6c2a004c5f.tar.bz2 |
gdb/python: Reuse gdb.RegisterGroup objects where possible
Only create one gdb.RegisterGroup Python object for each of GDB's
reggroup objects.
I could have added a field into the reggroup object to hold the Python
object pointer for each reggroup, however, as reggroups are never
deleted within GDB, and are global (not per-architecture) a simpler
solution seemed to be just to hold a single global map from reggroup
pointer to a Python object representing the reggroup. Then we can
reuse the objects out of this map.
After this commit it is possible for a user to tell that two
gdb.RegisterGroup objects are now identical when previously they were
unique, however, as both these objects are read-only I don't think
this should be a problem.
There should be no other user visible changes after this commit.
gdb/ChangeLog:
* python/py-registers.c : Add 'unordered_map' include.
(gdbpy_new_reggroup): Renamed to...
(gdbpy_get_reggroup): ...this. Update to only create register
group descriptors when needed.
(gdbpy_reggroup_iter_next): Update.
gdb/testsuite/ChangeLog:
* gdb.python/py-arch-reg-groups.exp: Additional tests.
Diffstat (limited to 'gdb/infrun.c')
0 files changed, 0 insertions, 0 deletions