[Bug gdb/26828] SIGSEGV in follow_die_offset dwarf2/read.c:22950
simark at simark dot ca
sourceware-bugzilla@sourceware.org
Tue Nov 3 17:05:40 GMT 2020
https://sourceware.org/bugzilla/show_bug.cgi?id=26828
--- Comment #9 from Simon Marchi <simark at simark dot ca> ---
Nils, could you try the following patch?
The issue lies with the fact that we have a DIE in a CU A referring to a DIE in
a CU B (using DW_AT_abstract_origin). The DIEs for CU B are not loaded yet (or
rather, have been unloaded due to DWARF CU aging stuff), and we try to load
them using:
/* 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, per_objfile->get_cu (per_cu),
false, cu->language);
Since the CU is already queued for expansion, maybe_queue_comp_unit returns
false and we don't call load_full_comp_unit. I think maybe_queue_comp_unit is
the wrong thing to call here, because "queuing for symtab expansion" is
unrelated to "loading the DIEs in memory". We should rather check: "are the
DIEs for per_cu loaded into memory yet? if not do it now", which is what the
patch below implements.
@@ -22937,12 +22939,15 @@ follow_die_offset (sect_offset sect_off, int
offset_in_dwz,
per_cu = dwarf2_find_containing_comp_unit (sect_off, offset_in_dwz,
per_objfile);
- /* 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, per_objfile->get_cu (per_cu),
- false, cu->language);
-
target_cu = per_objfile->get_cu (per_cu);
+ if (target_cu == nullptr)
+ {
+ 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);
+ }
+
+ gdb_assert (target_cu != nullptr);
}
else if (cu->dies == NULL)
{
--
You are receiving this mail because:
You are on the CC list for the bug.
More information about the Gdb-prs
mailing list