diff options
author | Jan Vrany <jan.vrany@labware.com> | 2025-03-19 21:12:53 +0000 |
---|---|---|
committer | Jan Vrany <jan.vrany@labware.com> | 2025-03-19 21:12:53 +0000 |
commit | 974c8ea576353d58fc024898dbc349da3c13984b (patch) | |
tree | 9a6aceac2c0d8892169c2b989eb93c66b53a4010 /gdb/python/python-config.py | |
parent | aaefa9023e6c7835c37ad62a4542b7171651479e (diff) | |
download | binutils-974c8ea576353d58fc024898dbc349da3c13984b.zip binutils-974c8ea576353d58fc024898dbc349da3c13984b.tar.gz binutils-974c8ea576353d58fc024898dbc349da3c13984b.tar.bz2 |
gdb/python: preserve identity for gdb.Type objects
This commit changes type_to_type_object() so that each it is called
with a particular struct type * it returns the very same gdb.Type
object.
This is done in the same way as for gdb.Symtab objects in earlier commit
("gdb/python: preserve identity for gdb.Symtab objects") except that
types may be either objfile-owned or arch-owned.
Prior this commit, arch-owned objects we not put into any list (like
objfile-owned ones) so they could not be easily looked up. This commit
changes the code so arch-owned list are put into per-architecture list
which is then used (solely) for looking up arch-owned gdb.Type.
Another complication comes from the fact that when objfile is about to
be freed, associated gdb.Type instances are not merely invalidated
(like it is done with gdb.Symtab or gdb.Symbol objects) but instead the
type is copied and the copy is arch-owned. So we need two different
"deleters", one for objfile-owned types that copies the type (as before)
and then insert the object to per-architecture list and another one
for arch-owned types.
Approved-By: Tom Tromey <tom@tromey.com>
Diffstat (limited to 'gdb/python/python-config.py')
0 files changed, 0 insertions, 0 deletions