diff options
author | Simon Marchi <simon.marchi@efficios.com> | 2020-05-27 11:14:12 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@efficios.com> | 2020-05-27 11:19:41 -0400 |
commit | 39b16f87f720b5cc454eac1e668c2ce2c60bfe15 (patch) | |
tree | 5fd75891054c9b9e0ecf52f68f28219cab3b76d9 /gdb | |
parent | fcf23d5b654b0fc05e99c445ebd471221a290cf4 (diff) | |
download | binutils-39b16f87f720b5cc454eac1e668c2ce2c60bfe15.zip binutils-39b16f87f720b5cc454eac1e668c2ce2c60bfe15.tar.gz binutils-39b16f87f720b5cc454eac1e668c2ce2c60bfe15.tar.bz2 |
Move line_header_hash to dwarf2_per_objfile
The `line_header_hash` field of `struct dwarf2_per_bfd` contains some
`struct line_header` objects. A `struct line_header` objects contains
some `file_entry` objects. A `file_entry` object contains a pointer to
the `symtab` object created from it. The `line_header_hash` is
therefore ultimately objfile-dependent and can't be shared as-is between
objfiles.
Move it from `dwarf2_per_bfd` to `dwarf2_per_objfile`.
gdb/ChangeLog:
* dwarf2/read.h (struct dwarf2_per_bfd) <line_header_hash>: Move
to...
(struct dwarf2_per_objfile) <line_header_hash>: ... here.
* dwarf2/read.c (handle_DW_AT_stmt_list): Update.
Change-Id: I8d2ee04df4f4847c2db99061fc976c35af98ac71
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 7 | ||||
-rw-r--r-- | gdb/dwarf2/read.c | 12 | ||||
-rw-r--r-- | gdb/dwarf2/read.h | 6 |
3 files changed, 16 insertions, 9 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index a7f989e..589c3f4 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,12 @@ 2020-05-27 Simon Marchi <simon.marchi@efficios.com> + * dwarf2/read.h (struct dwarf2_per_bfd) <line_header_hash>: Move + to... + (struct dwarf2_per_objfile) <line_header_hash>: ... here. + * dwarf2/read.c (handle_DW_AT_stmt_list): Update. + +2020-05-27 Simon Marchi <simon.marchi@efficios.com> + * dwarf2/read.c (struct mapped_index_base) <symbol_name_at, build_name_components, find_name_components_bounds>: Add per_objfile parameter. diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index df15068..c77c356 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -10888,10 +10888,10 @@ handle_DW_AT_stmt_list (struct die_info *die, struct dwarf2_cu *cu, compile_unit, then use the line header hash table if it's already created, but don't create one just yet. */ - if (dwarf2_per_objfile->per_bfd->line_header_hash == NULL + if (dwarf2_per_objfile->line_header_hash == NULL && die->tag == DW_TAG_partial_unit) { - dwarf2_per_objfile->per_bfd->line_header_hash + dwarf2_per_objfile->line_header_hash .reset (htab_create_alloc (127, line_header_hash_voidp, line_header_eq_voidp, free_line_header_voidp, @@ -10901,9 +10901,9 @@ handle_DW_AT_stmt_list (struct die_info *die, struct dwarf2_cu *cu, line_header_local.sect_off = line_offset; line_header_local.offset_in_dwz = cu->per_cu->is_dwz; line_header_local_hash = line_header_hash (&line_header_local); - if (dwarf2_per_objfile->per_bfd->line_header_hash != NULL) + if (dwarf2_per_objfile->line_header_hash != NULL) { - slot = htab_find_slot_with_hash (dwarf2_per_objfile->per_bfd->line_header_hash.get (), + slot = htab_find_slot_with_hash (dwarf2_per_objfile->line_header_hash.get (), &line_header_local, line_header_local_hash, NO_INSERT); @@ -10927,11 +10927,11 @@ handle_DW_AT_stmt_list (struct die_info *die, struct dwarf2_cu *cu, cu->line_header = lh.release (); cu->line_header_die_owner = die; - if (dwarf2_per_objfile->per_bfd->line_header_hash == NULL) + if (dwarf2_per_objfile->line_header_hash == NULL) slot = NULL; else { - slot = htab_find_slot_with_hash (dwarf2_per_objfile->per_bfd->line_header_hash.get (), + slot = htab_find_slot_with_hash (dwarf2_per_objfile->line_header_hash.get (), &line_header_local, line_header_local_hash, INSERT); gdb_assert (slot != NULL); diff --git a/gdb/dwarf2/read.h b/gdb/dwarf2/read.h index 996cf55..b53aab7 100644 --- a/gdb/dwarf2/read.h +++ b/gdb/dwarf2/read.h @@ -234,9 +234,6 @@ public: /* The CUs we recently read. */ std::vector<dwarf2_per_cu_data *> just_read_cus; - /* Table containing line_header indexed by offset and offset_in_dwz. */ - htab_up line_header_hash; - /* Table containing all filenames. This is an optional because the table is lazily constructed on first access. */ gdb::optional<filename_seen_cache> filenames_cache; @@ -368,6 +365,9 @@ struct dwarf2_per_objfile The mapping is done via (CU/TU + DIE offset) -> type. */ htab_up die_type_hash; + /* Table containing line_header indexed by offset and offset_in_dwz. */ + htab_up line_header_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 |