]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit - gdb/ChangeLog
gdb/python: Reuse gdb.RegisterDescriptor objects where possible
authorAndrew Burgess <andrew.burgess@embecosm.com>
Tue, 7 Jul 2020 14:00:30 +0000 (15:00 +0100)
committerAndrew Burgess <andrew.burgess@embecosm.com>
Tue, 21 Jul 2020 20:57:08 +0000 (21:57 +0100)
commitf7306dac19c502232f766c3881313857915f330d
treebbad3df7c454ff4eecb1064dfdb00d8e7fb3a778
parent05c309a8aeb8060fdcb9a05bbcdca2f5f1be61d7
gdb/python: Reuse gdb.RegisterDescriptor objects where possible

Instead of having the gdb.RegisterDescriptorIterator creating new
gdb.RegisterDescriptor objects for each regnum, instead cache
gdb.RegisterDescriptor objects on the gdbarch object and reuse these.

This means that for every gdbarch/regnum pair there is a single unique
gdb.RegisterDescriptor, this feels like a neater implementation than
the existing one.

It is possible for a user to see (in Python code) that the descriptors
are now identical, but as the descriptors are read-only this should
make no real difference.

There should be no other user visible changes.

gdb/ChangeLog:

* python/py-registers.c (gdbpy_register_object_data): New static
global.
(gdbpy_register_object_data_init): New function.
(gdbpy_new_register_descriptor): Renamed to...
(gdbpy_get_register_descriptor): ...this, and update to reuse
existing register descriptors where possible.
(gdbpy_register_descriptor_iter_next): Update.
(gdbpy_initialize_registers): Register new gdbarch data.

gdb/testsuite/ChangeLog:

* gdb.python/py-arch-reg-names.exp: Additional tests.
gdb/ChangeLog
gdb/python/py-registers.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.python/py-arch-reg-names.exp