diff options
author | Tom Tromey <tom@tromey.com> | 2021-07-04 13:14:10 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2021-07-17 10:41:42 -0600 |
commit | e0ec6b1a8796127c5141647bfe88e260716d6cd4 (patch) | |
tree | 0c767eb98df7037e950e963cb198b3a0896e2549 | |
parent | 4584f33d68b79c362ce9f3543052027b1676f30e (diff) | |
download | gdb-e0ec6b1a8796127c5141647bfe88e260716d6cd4.zip gdb-e0ec6b1a8796127c5141647bfe88e260716d6cd4.tar.gz gdb-e0ec6b1a8796127c5141647bfe88e260716d6cd4.tar.bz2 |
Simplify DWARF file name caching
The DWARF index file name caching code only records when a line table
has been read and the reading failed. However, the code would be
simpler if it recorded any attempt, which is what this patch
implements.
-rw-r--r-- | gdb/dwarf2/read.c | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index e0007b7..c730c52 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -1989,9 +1989,9 @@ struct dwarf2_per_cu_quick_data expand_symtabs_matching. */ unsigned int mark : 1; - /* True if we've tried to read the file table and found there isn't one. - There will be no point in trying to read it again next time. */ - unsigned int no_file_data : 1; + /* True if we've tried to read the file table. There will be no + point in trying to read it again next time. */ + bool files_read : 1; }; /* A subclass of psymbol_functions that arranges to read the DWARF @@ -2897,13 +2897,11 @@ dw2_get_file_names_reader (const struct die_reader_specs *reader, gdb_assert (! this_cu->is_debug_types); + this_cu->v.quick->files_read = true; /* Our callers never want to match partial units -- instead they will match the enclosing full CU. */ if (comp_unit_die->tag == DW_TAG_partial_unit) - { - this_cu->v.quick->no_file_data = 1; - return; - } + return; lh_cu = this_cu; slot = NULL; @@ -2933,10 +2931,7 @@ dw2_get_file_names_reader (const struct die_reader_specs *reader, lh = dwarf_decode_line_header (line_offset, cu); } if (lh == NULL) - { - lh_cu->v.quick->no_file_data = 1; - return; - } + return; qfn = XOBNEW (&per_objfile->per_bfd->obstack, struct quick_file_names); qfn->hash.dwo_unit = cu->dwo_unit; @@ -2976,18 +2971,13 @@ dw2_get_file_names (dwarf2_per_cu_data *this_cu, /* Nor type unit groups. */ gdb_assert (! this_cu->type_unit_group_p ()); - if (this_cu->v.quick->file_names != NULL) + if (this_cu->v.quick->files_read) return this_cu->v.quick->file_names; - /* If we know there is no line data, no point in looking again. */ - if (this_cu->v.quick->no_file_data) - return NULL; cutu_reader reader (this_cu, per_objfile); if (!reader.dummy_p) dw2_get_file_names_reader (&reader, reader.comp_unit_die); - if (this_cu->v.quick->no_file_data) - return NULL; return this_cu->v.quick->file_names; } |