From f7b5068c5f41aa13ee3efa35a2555c3bfafe81f0 Mon Sep 17 00:00:00 2001 From: Tom de Vries Date: Mon, 21 Jun 2021 13:14:05 +0200 Subject: [PATCH] [gdb/symtab] Fix problem with enum value When adding a partial symbol for an enum value, we try to find the section offset for the enum itself rather than the enum value. This fails if the parent die is not set. Fix that. --- gdb/dwarf2/read.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 6c0dc604ad5..e6789666431 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -19022,7 +19022,11 @@ load_partial_dies (const struct die_reader_specs *reader, if (pdi.raw_name == NULL) complaint (_("malformed enumerator DIE ignored")); else if (building_psymtab) - add_partial_symbol (&pdi, cu); + { + if (lazy_expand_symtab_p) + pdi.die_parent = parent_die; + add_partial_symbol (&pdi, cu); + } info_ptr = locate_pdi_sibling (reader, &pdi, info_ptr); continue; -- 2.47.2