aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2021-03-26 09:37:22 -0600
committerTom Tromey <tom@tromey.com>2021-03-26 09:37:22 -0600
commitbab287cdcfb47ac472da9e8d3c8db8b15880c12c (patch)
treea74014e35507b6d96edc175a57ffadd723b47b84 /gdb
parent3c2dcf90b55fea84260ac83ab968c5df3b44d34d (diff)
downloadgdb-bab287cdcfb47ac472da9e8d3c8db8b15880c12c.zip
gdb-bab287cdcfb47ac472da9e8d3c8db8b15880c12c.tar.gz
gdb-bab287cdcfb47ac472da9e8d3c8db8b15880c12c.tar.bz2
Avoid some pointer chasing in DWARF reader
I noticed a spot in the DWARF reader using "per_objfile->per_bfd", where a local per_bfd variable had already been created. Looking through the file, I found a number of such spots. This patch changes them to use the already-existing local, avoiding a bit of excess pointer chasing. gdb/ChangeLog 2021-03-26 Tom Tromey <tom@tromey.com> * dwarf2/read.c (dwarf2_read_debug_names) (dwarf2_build_psymtabs_hard, create_addrmap_from_aranges) (dw2_debug_names_iterator::next, create_type_unit_group): Simplify.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog7
-rw-r--r--gdb/dwarf2/read.c13
2 files changed, 13 insertions, 7 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 173b08b..8e7b920 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,10 @@
+2021-03-26 Tom Tromey <tom@tromey.com>
+
+ * dwarf2/read.c (dwarf2_read_debug_names)
+ (dwarf2_build_psymtabs_hard, create_addrmap_from_aranges)
+ (dw2_debug_names_iterator::next, create_type_unit_group):
+ Simplify.
+
2021-03-25 Pedro Alves <pedro@palves.net>
* gdb.server/bkpt-other-inferior.exp: Only enable remote output
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index ee6f3f7..2f4b54b 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -2774,7 +2774,7 @@ create_addrmap_from_aranges (dwarf2_per_objfile *per_objfile,
dwarf2_per_cu_data *,
gdb::hash_enum<sect_offset>>
debug_info_offset_to_per_cu;
- for (dwarf2_per_cu_data *per_cu : per_objfile->per_bfd->all_comp_units)
+ for (dwarf2_per_cu_data *per_cu : per_bfd->all_comp_units)
{
const auto insertpair
= debug_info_offset_to_per_cu.emplace (per_cu->sect_off, per_cu);
@@ -5299,7 +5299,7 @@ dwarf2_read_debug_names (dwarf2_per_objfile *per_objfile)
dwarf2_per_bfd *per_bfd = per_objfile->per_bfd;
if (!read_debug_names_from_section (objfile, objfile_name (objfile),
- &per_objfile->per_bfd->debug_names, *map))
+ &per_bfd->debug_names, *map))
return false;
/* Don't use the index if it's empty. */
@@ -5341,7 +5341,7 @@ dwarf2_read_debug_names (dwarf2_per_objfile *per_objfile)
per_bfd->debug_names_table = std::move (map);
per_bfd->using_index = 1;
per_bfd->quick_file_names_table =
- create_quick_file_names_table (per_objfile->per_bfd->all_comp_units.size ());
+ create_quick_file_names_table (per_bfd->all_comp_units.size ());
return true;
}
@@ -5596,7 +5596,7 @@ dw2_debug_names_iterator::next ()
{
case DW_IDX_compile_unit:
/* Don't crash on bad data. */
- if (ull >= m_per_objfile->per_bfd->all_comp_units.size ())
+ if (ull >= per_bfd->all_comp_units.size ())
{
complaint (_(".debug_names entry has bad CU index %s"
" [in module %s]"),
@@ -7455,7 +7455,7 @@ create_type_unit_group (struct dwarf2_cu *cu, sect_offset line_offset_struct)
struct dwarf2_per_cu_data *per_cu;
struct type_unit_group *tu_group;
- tu_group = OBSTACK_ZALLOC (&per_objfile->per_bfd->obstack, type_unit_group);
+ tu_group = OBSTACK_ZALLOC (&per_bfd->obstack, type_unit_group);
per_cu = &tu_group->per_cu;
per_cu->per_bfd = per_bfd;
@@ -8081,8 +8081,7 @@ dwarf2_build_psymtabs_hard (dwarf2_per_objfile *per_objfile)
objfile_name (objfile));
scoped_restore restore_reading_psyms
- = make_scoped_restore (&per_objfile->per_bfd->reading_partial_symbols,
- true);
+ = make_scoped_restore (&per_bfd->reading_partial_symbols, true);
per_bfd->info.read (objfile);