diff options
author | Simon Marchi <simon.marchi@efficios.com> | 2020-02-24 23:39:47 -0500 |
---|---|---|
committer | Simon Marchi <simon.marchi@efficios.com> | 2020-05-12 15:24:50 -0400 |
commit | 35f1c44ab7ce54c78fc1a4e339c4b141f0745abf (patch) | |
tree | d3f98da4d7b70cbaa912265bcf7791f011806f5d | |
parent | 60684704c1ecac0bff000fb7edfa378a953bb21c (diff) | |
download | gdb-35f1c44ab7ce54c78fc1a4e339c4b141f0745abf.zip gdb-35f1c44ab7ce54c78fc1a4e339c4b141f0745abf.tar.gz gdb-35f1c44ab7ce54c78fc1a4e339c4b141f0745abf.tar.bz2 |
Move die_type_hash to dwarf2_per_objfile
The die_type_hash field can't be shared between multiple obfiles, as it
holds `struct type` objects, which are objfile-specific. Move it from
dwarf2_per_bfd to dwarf2_per_objfile and update all references.
gdb/ChangeLog:
* dwarf2/read.h (struct dwarf2_per_bfd) <die_type_hash>: Move to
struct dwarf2_per_objfile.
(struct dwarf2_per_objfile) <die_type_hash>: Move from struct
dwarf2_per_bfd.
* dwarf2/read.c (set_die_type): Update.
(get_die_type_at_offset): Update.
-rw-r--r-- | gdb/dwarf2/read.c | 10 | ||||
-rw-r--r-- | gdb/dwarf2/read.h | 10 |
2 files changed, 10 insertions, 10 deletions
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 4dfa85f..c961729 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -23717,8 +23717,8 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu) cu->per_cu->addr_type ())) type->add_dyn_prop (DYN_PROP_DATA_LOCATION, prop); - if (dwarf2_per_objfile->per_bfd->die_type_hash == NULL) - dwarf2_per_objfile->per_bfd->die_type_hash + if (dwarf2_per_objfile->die_type_hash == NULL) + dwarf2_per_objfile->die_type_hash = htab_up (htab_create_alloc (127, per_cu_offset_and_type_hash, per_cu_offset_and_type_eq, @@ -23728,7 +23728,7 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu) ofs.sect_off = die->sect_off; ofs.type = type; slot = (struct dwarf2_per_cu_offset_and_type **) - htab_find_slot (dwarf2_per_objfile->per_bfd->die_type_hash.get (), &ofs, INSERT); + htab_find_slot (dwarf2_per_objfile->die_type_hash.get (), &ofs, INSERT); if (*slot) complaint (_("A problem internal to GDB: DIE %s has type already set"), sect_offset_str (die->sect_off)); @@ -23748,13 +23748,13 @@ get_die_type_at_offset (sect_offset sect_off, struct dwarf2_per_cu_offset_and_type *slot, ofs; struct dwarf2_per_objfile *dwarf2_per_objfile = per_cu->dwarf2_per_objfile; - if (dwarf2_per_objfile->per_bfd->die_type_hash == NULL) + if (dwarf2_per_objfile->die_type_hash == NULL) return NULL; ofs.per_cu = per_cu; ofs.sect_off = sect_off; slot = ((struct dwarf2_per_cu_offset_and_type *) - htab_find (dwarf2_per_objfile->per_bfd->die_type_hash.get (), &ofs)); + htab_find (dwarf2_per_objfile->die_type_hash.get (), &ofs)); if (slot) return slot->type; else diff --git a/gdb/dwarf2/read.h b/gdb/dwarf2/read.h index 7631938ed..2897ea6 100644 --- a/gdb/dwarf2/read.h +++ b/gdb/dwarf2/read.h @@ -229,11 +229,6 @@ public: symbols. */ bool reading_partial_symbols = false; - /* Table mapping type DIEs to their struct type *. - This is NULL if not allocated yet. - The mapping is done via (CU/TU + DIE offset) -> type. */ - htab_up die_type_hash; - /* The CUs we recently read. */ std::vector<dwarf2_per_cu_data *> just_read_cus; @@ -310,6 +305,11 @@ struct dwarf2_per_objfile other objfiles backed by the same BFD. */ struct dwarf2_per_bfd *per_bfd; + /* Table mapping type DIEs to their struct type *. + This is nullptr if not allocated yet. + The mapping is done via (CU/TU + DIE offset) -> type. */ + htab_up die_type_hash; + private: /* Hold the corresponding compunit_symtab for each CU or TU. This is indexed by dwarf2_per_cu_data::index. A NULL value means |