diff options
-rw-r--r-- | gdb/ChangeLog | 8 | ||||
-rw-r--r-- | gdb/dwarf2read.c | 42 |
2 files changed, 40 insertions, 10 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 2dc9198..abffbe8 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,11 @@ +2019-05-17 Tom de Vries <tdevries@suse.de> + + PR gdb/24094 + * dwarf2read.c (struct cu_partial_die_info): New struct. + (find_partial_die): Return cu_partial_die_info. + (partial_die_parent_scope, guess_partial_die_structure_name) + (partial_die_info::fixup): Handle new return type of find_partial_die. + 2019-05-16 Sergio Durigan Junior <sergiodj@redhat.com> * stap-probe.c (stap_parse_register_operand): Make "regname" an diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 0e3f37f..004238a 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -1507,8 +1507,17 @@ static unsigned int peek_abbrev_code (bfd *, const gdb_byte *); static struct partial_die_info *load_partial_dies (const struct die_reader_specs *, const gdb_byte *, int); -static struct partial_die_info *find_partial_die (sect_offset, int, - struct dwarf2_cu *); +/* A pair of partial_die_info and compilation unit. */ +struct cu_partial_die_info +{ + /* The compilation unit of the partial_die_info. */ + struct dwarf2_cu *cu; + /* A partial_die_info. */ + struct partial_die_info *pdi; +}; + +static struct cu_partial_die_info find_partial_die (sect_offset, int, + struct dwarf2_cu *); static const gdb_byte *read_attribute (const struct die_reader_specs *, struct attribute *, struct attr_abbrev *, @@ -8754,14 +8763,19 @@ partial_die_parent_scope (struct partial_die_info *pdi, { const char *grandparent_scope; struct partial_die_info *parent, *real_pdi; + struct cu_partial_die_info res; /* We need to look at our parent DIE; if we have a DW_AT_specification, then this means the parent of the specification DIE. */ real_pdi = pdi; while (real_pdi->has_specification) - real_pdi = find_partial_die (real_pdi->spec_offset, - real_pdi->spec_is_dwz, cu); + { + res = find_partial_die (real_pdi->spec_offset, + real_pdi->spec_is_dwz, cu); + real_pdi = res.pdi; + cu = res.cu; + } parent = real_pdi->die_parent; if (parent == NULL) @@ -18905,7 +18919,7 @@ dwarf2_cu::find_partial_die (sect_offset sect_off) outside their CU (they do however referencing other types via DW_FORM_ref_sig8). */ -static struct partial_die_info * +static struct cu_partial_die_info find_partial_die (sect_offset sect_off, int offset_in_dwz, struct dwarf2_cu *cu) { struct dwarf2_per_objfile *dwarf2_per_objfile @@ -18919,7 +18933,7 @@ find_partial_die (sect_offset sect_off, int offset_in_dwz, struct dwarf2_cu *cu) { pd = cu->find_partial_die (sect_off); if (pd != NULL) - return pd; + return { cu, pd }; /* We missed recording what we needed. Load all dies and try again. */ per_cu = cu->per_cu; @@ -18967,7 +18981,7 @@ find_partial_die (sect_offset sect_off, int offset_in_dwz, struct dwarf2_cu *cu) _("could not find partial DIE %s " "in cache [from module %s]\n"), sect_offset_str (sect_off), bfd_get_filename (objfile->obfd)); - return pd; + return { per_cu->cu, pd }; } /* See if we can figure out if the class lives in a namespace. We do @@ -18986,6 +19000,7 @@ guess_partial_die_structure_name (struct partial_die_info *struct_pdi, struct partial_die_info *real_pdi; struct partial_die_info *child_pdi; + struct cu_partial_die_info res; /* If this DIE (this DIE's specification, if any) has a parent, then we should not do this. We'll prepend the parent's fully qualified @@ -18993,8 +19008,12 @@ guess_partial_die_structure_name (struct partial_die_info *struct_pdi, real_pdi = struct_pdi; while (real_pdi->has_specification) - real_pdi = find_partial_die (real_pdi->spec_offset, - real_pdi->spec_is_dwz, cu); + { + res = find_partial_die (real_pdi->spec_offset, + real_pdi->spec_is_dwz, cu); + real_pdi = res.pdi; + cu = res.cu; + } if (real_pdi->die_parent != NULL) return; @@ -19039,8 +19058,11 @@ partial_die_info::fixup (struct dwarf2_cu *cu) if (name == NULL && has_specification) { struct partial_die_info *spec_die; + struct cu_partial_die_info res; - spec_die = find_partial_die (spec_offset, spec_is_dwz, cu); + res = find_partial_die (spec_offset, spec_is_dwz, cu); + spec_die = res.pdi; + cu = res.cu; spec_die->fixup (cu); |