aboutsummaryrefslogtreecommitdiff
path: root/gdb/dwarf2/read.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/dwarf2/read.c')
-rw-r--r--gdb/dwarf2/read.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 37409c5..436a116 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -1606,6 +1606,7 @@ static int create_all_type_units (dwarf2_per_objfile *per_objfile);
static void load_full_comp_unit (dwarf2_per_cu_data *per_cu,
dwarf2_per_objfile *per_objfile,
+ dwarf2_cu *existing_cu,
bool skip_partial,
enum language pretend_language);
@@ -2385,7 +2386,8 @@ load_cu (dwarf2_per_cu_data *per_cu, dwarf2_per_objfile *per_objfile,
if (per_cu->is_debug_types)
load_full_type_unit (per_cu, per_objfile);
else
- load_full_comp_unit (per_cu, per_objfile, skip_partial, language_minimal);
+ load_full_comp_unit (per_cu, per_objfile, per_objfile->get_cu (per_cu),
+ skip_partial, language_minimal);
dwarf2_cu *cu = per_objfile->get_cu (per_cu);
if (cu == nullptr)
@@ -9226,17 +9228,22 @@ die_eq (const void *item_lhs, const void *item_rhs)
return die_lhs->sect_off == die_rhs->sect_off;
}
-/* Load the DIEs associated with PER_CU into memory. */
+/* Load the DIEs associated with PER_CU into memory.
+
+ In some cases, the caller, while reading partial symbols, will need to load
+ the full symbols for the CU for some reason. It will already have a
+ dwarf2_cu object for THIS_CU and pass it as EXISTING_CU, so it can be re-used
+ rather than creating a new one. */
static void
load_full_comp_unit (dwarf2_per_cu_data *this_cu,
dwarf2_per_objfile *per_objfile,
+ dwarf2_cu *existing_cu,
bool skip_partial,
enum language pretend_language)
{
gdb_assert (! this_cu->is_debug_types);
- dwarf2_cu *existing_cu = per_objfile->get_cu (this_cu);
cutu_reader reader (this_cu, per_objfile, NULL, existing_cu, skip_partial);
if (reader.dummy_p)
return;
@@ -10102,7 +10109,8 @@ process_imported_unit_die (struct die_info *die, struct dwarf2_cu *cu)
/* If necessary, add it to the queue and load its DIEs. */
if (maybe_queue_comp_unit (cu, per_cu, per_objfile, cu->language))
- load_full_comp_unit (per_cu, per_objfile, false, cu->language);
+ load_full_comp_unit (per_cu, per_objfile, per_objfile->get_cu (per_cu),
+ false, cu->language);
cu->per_cu->imported_symtabs_push (per_cu);
}
@@ -22932,7 +22940,8 @@ follow_die_offset (sect_offset sect_off, int offset_in_dwz,
/* If necessary, add it to the queue and load its DIEs. */
if (maybe_queue_comp_unit (cu, per_cu, per_objfile, cu->language))
- load_full_comp_unit (per_cu, per_objfile, false, cu->language);
+ load_full_comp_unit (per_cu, per_objfile, per_objfile->get_cu (per_cu),
+ false, cu->language);
target_cu = per_objfile->get_cu (per_cu);
}
@@ -22940,7 +22949,8 @@ follow_die_offset (sect_offset sect_off, int offset_in_dwz,
{
/* We're loading full DIEs during partial symbol reading. */
gdb_assert (per_objfile->per_bfd->reading_partial_symbols);
- load_full_comp_unit (cu->per_cu, per_objfile, false, language_minimal);
+ load_full_comp_unit (cu->per_cu, per_objfile, cu, false,
+ language_minimal);
}
*ref_cu = target_cu;