aboutsummaryrefslogtreecommitdiff
path: root/gdb/dwarf2/read.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2024-01-14 18:21:42 -0700
committerTom Tromey <tom@tromey.com>2024-01-19 17:41:36 -0700
commit4a2318c9858fdb1899157339f526df3d20e43cfe (patch)
treedad50eff01a64a346bb03fce0aad9228847d0fb8 /gdb/dwarf2/read.c
parent40ca2746cea5d53419dfd5037fdca485cf32f3ad (diff)
downloadbinutils-4a2318c9858fdb1899157339f526df3d20e43cfe.zip
binutils-4a2318c9858fdb1899157339f526df3d20e43cfe.tar.gz
binutils-4a2318c9858fdb1899157339f526df3d20e43cfe.tar.bz2
Simplify DWARF symtab inclusion handling
In the past, dwarf2_per_cu_data was allocated using malloc, so special handling was needed for the vector used for symtab handling. We changed this to use 'new' a while back, so this code can now be greatly simplified. Regression tested on x86-64 Fedora 38. Approved-By: Simon Marchi <simon.marchi@efficios.com>
Diffstat (limited to 'gdb/dwarf2/read.c')
-rw-r--r--gdb/dwarf2/read.c36
1 files changed, 13 insertions, 23 deletions
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 7691fe0..6be8f81 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -1280,10 +1280,7 @@ dwarf2_per_bfd::~dwarf2_per_bfd ()
index_table->wait_completely ();
for (auto &per_cu : all_units)
- {
- per_cu->imported_symtabs_free ();
- per_cu->free_cached_file_names ();
- }
+ per_cu->free_cached_file_names ();
/* Everything else should be on this->obstack. */
}
@@ -6103,13 +6100,10 @@ recursively_compute_inclusions (std::vector<compunit_symtab *> *result,
}
}
- if (!per_cu->imported_symtabs_empty ())
- for (dwarf2_per_cu_data *ptr : *per_cu->imported_symtabs)
- {
- recursively_compute_inclusions (result, all_children,
- all_type_symtabs, ptr, per_objfile,
- cust);
- }
+ for (dwarf2_per_cu_data *ptr : per_cu->imported_symtabs)
+ recursively_compute_inclusions (result, all_children,
+ all_type_symtabs, ptr, per_objfile,
+ cust);
}
/* Compute the compunit_symtab 'includes' fields for the compunit_symtab of
@@ -6121,7 +6115,7 @@ compute_compunit_symtab_includes (dwarf2_per_cu_data *per_cu,
{
gdb_assert (! per_cu->is_debug_types);
- if (!per_cu->imported_symtabs_empty ())
+ if (!per_cu->imported_symtabs.empty ())
{
int len;
std::vector<compunit_symtab *> result_symtabs;
@@ -6138,12 +6132,10 @@ compute_compunit_symtab_includes (dwarf2_per_cu_data *per_cu,
htab_eq_pointer,
NULL, xcalloc, xfree));
- for (dwarf2_per_cu_data *ptr : *per_cu->imported_symtabs)
- {
- recursively_compute_inclusions (&result_symtabs, all_children.get (),
- all_type_symtabs.get (), ptr,
- per_objfile, cust);
- }
+ for (dwarf2_per_cu_data *ptr : per_cu->imported_symtabs)
+ recursively_compute_inclusions (&result_symtabs, all_children.get (),
+ all_type_symtabs.get (), ptr,
+ per_objfile, cust);
/* Now we have a transitive closure of all the included symtabs. */
len = result_symtabs.size ();
@@ -6391,7 +6383,7 @@ process_imported_unit_die (struct die_info *die, struct dwarf2_cu *cu)
load_full_comp_unit (per_cu, per_objfile, per_objfile->get_cu (per_cu),
false, cu->lang ());
- cu->per_cu->imported_symtabs_push (per_cu);
+ cu->per_cu->imported_symtabs.push_back (per_cu);
}
}
@@ -9651,7 +9643,7 @@ queue_and_load_dwo_tu (void **slot, void *info)
if (maybe_queue_comp_unit (NULL, sig_type, cu->per_objfile,
cu->lang ()))
load_full_type_unit (sig_type, cu->per_objfile);
- cu->per_cu->imported_symtabs_push (sig_type);
+ cu->per_cu->imported_symtabs.push_back (sig_type);
}
return 1;
@@ -20701,9 +20693,7 @@ follow_die_sig_1 (struct die_info *src_die, struct signatured_type *sig_type,
http://sourceware.org/bugzilla/show_bug.cgi?id=15021. */
if (per_objfile->per_bfd->index_table != NULL
&& !per_objfile->per_bfd->index_table->version_check ())
- {
- (*ref_cu)->per_cu->imported_symtabs_push (sig_cu->per_cu);
- }
+ (*ref_cu)->per_cu->imported_symtabs.push_back (sig_cu->per_cu);
*ref_cu = sig_cu;
return die;