diff options
author | Simon Marchi <simon.marchi@efficios.com> | 2025-03-14 00:32:48 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@efficios.com> | 2025-03-14 12:23:40 -0400 |
commit | 4fca47b93866f96db4723cc5f8570a66df9a7127 (patch) | |
tree | 422358f108aa153aea78865a4f361c53d6ce6d7e /gdb/python/python.c | |
parent | 0bb9d85fc7f86fe5bde091b68facbd72b005c286 (diff) | |
download | binutils-4fca47b93866f96db4723cc5f8570a66df9a7127.zip binutils-4fca47b93866f96db4723cc5f8570a66df9a7127.tar.gz binutils-4fca47b93866f96db4723cc5f8570a66df9a7127.tar.bz2 |
gdb/dwarf: change cutu_reader::read_die_and_siblings to cutu_reader::read_all_dies
After construction of a cutu_reader, only the top-level DIE has been
read in memory. If the caller wants to access the full DIE tree, it
does:
reader.top_level_die ()->child
= reader.read_die_and_siblings (reader.top_level_die ());
I don't really like this poking into cutu_reader's data structures from
the outside, I would prefer if that work was done by cutu_reader.
Rename the read_die_and_siblings method to read_all_dies, and do that
work inside cutu_reader.
I also moved these operations inside the read_all_dies method:
gdb_assert (cu->die_hash.empty ());
cu->die_hash.reserve (cu->header.get_length_without_initial () / 12);
...
cu->dies = reader.top_level_die ();
The rationale for this is that read_all_dies (and the functions it
calls) is responsible for filling the die_hash set. So I think it makes
sense for it to do the reserve.
It is also cutu_reader's job, currently, to create and fill the fields
of dwarf2_cu. So I think it makes sense for it to set cu->dies, after
having read the DIEs in memory.
Change-Id: I088c2e0b367db7d1f67e8c9e2d5b0d61165292fc
Approved-By: Tom Tromey <tom@tromey.com>
Diffstat (limited to 'gdb/python/python.c')
0 files changed, 0 insertions, 0 deletions