aboutsummaryrefslogtreecommitdiff
path: root/gdb/dwarf2/read.c
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2025-03-17 10:34:30 -0400
committerSimon Marchi <simon.marchi@polymtl.ca>2025-03-18 09:39:03 -0400
commit6eb9dab4c99725c1de4bccfeb99e766e7ee657a4 (patch)
tree7d30e15adf6cc4021631665819a0f3e688bca7ae /gdb/dwarf2/read.c
parentaab6de1613df693059a6a2b505cc8f20d479d109 (diff)
downloadfsf-binutils-gdb-6eb9dab4c99725c1de4bccfeb99e766e7ee657a4.zip
fsf-binutils-gdb-6eb9dab4c99725c1de4bccfeb99e766e7ee657a4.tar.gz
fsf-binutils-gdb-6eb9dab4c99725c1de4bccfeb99e766e7ee657a4.tar.bz2
gdb/dwarf: set m_top_level_die directly in read_cutu_die_from_dwo
read_cutu_die_from_dwo currently returns the dwo's top-level DIE through a parameter. Following the previous patch, all code paths end up setting m_top_level_die. Simplify this by having read_cutu_die_from_dwo set m_top_level_die directly. I think it's easier to understand, because there's one less indirection to follow. Change-Id: Ib659f1d2e38501a8fe2b5dd0ca2add3ef55e8d60 Approved-By: Tom Tromey <tom@tromey.com>
Diffstat (limited to 'gdb/dwarf2/read.c')
-rw-r--r--gdb/dwarf2/read.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 60cd2d5..f41723c 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -2781,7 +2781,6 @@ void
cutu_reader::read_cutu_die_from_dwo (dwarf2_cu *cu, dwo_unit *dwo_unit,
die_info *stub_comp_unit_die,
const char *stub_comp_dir,
- die_info **result_top_level_die,
abbrev_table_up *result_dwo_abbrev_table)
{
dwarf2_per_objfile *per_objfile = cu->per_objfile;
@@ -2909,7 +2908,7 @@ cutu_reader::read_cutu_die_from_dwo (dwarf2_cu *cu, dwo_unit *dwo_unit,
has the benefit of simplifying the rest of the code - all the
work to maintain the illusion of a single
DW_TAG_{compile,type}_unit DIE is done here. */
- *result_top_level_die
+ m_top_level_die
= this->read_toplevel_die (gdb::make_array_view (attributes,
next_attr_idx));
@@ -3018,7 +3017,7 @@ cutu_reader::init_tu_and_read_dwo_dies (dwarf2_per_cu *this_cu,
read_cutu_die_from_dwo (cu, sig_type->dwo_unit, NULL /* stub_comp_unit_die */,
sig_type->dwo_unit->dwo_file->comp_dir,
- &m_top_level_die, &m_dwo_abbrev_table);
+ &m_dwo_abbrev_table);
prepare_one_comp_unit (cu, pretend_language);
}
@@ -3195,7 +3194,6 @@ cutu_reader::cutu_reader (dwarf2_per_cu *this_cu,
if (dwo_name != nullptr)
{
struct dwo_unit *dwo_unit;
- struct die_info *dwo_comp_unit_die;
if (m_top_level_die->has_children)
{
@@ -3204,14 +3202,11 @@ cutu_reader::cutu_reader (dwarf2_per_cu *this_cu,
sect_offset_str (this_cu->sect_off),
bfd_get_filename (abfd));
}
+
dwo_unit = lookup_dwo_unit (cu, m_top_level_die, dwo_name);
if (dwo_unit != NULL)
- {
- read_cutu_die_from_dwo (cu, dwo_unit, m_top_level_die,
- nullptr, &dwo_comp_unit_die,
- &m_dwo_abbrev_table);
- m_top_level_die = dwo_comp_unit_die;
- }
+ read_cutu_die_from_dwo (cu, dwo_unit, m_top_level_die, nullptr,
+ &m_dwo_abbrev_table);
else
{
/* Yikes, we couldn't find the rest of the DIE, we only have