]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[gdb/symtab] Fix problem with enum value
authorTom de Vries <tdevries@suse.de>
Mon, 21 Jun 2021 11:14:05 +0000 (13:14 +0200)
committerTom de Vries <tdevries@suse.de>
Thu, 24 Jun 2021 15:48:26 +0000 (17:48 +0200)
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

index 6c0dc604ad56286560c6115dc2e522ddc00f488c..e6789666431e5c6b763d3e38bc1101f193d8b356 100644 (file)
@@ -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;