Skip to content

Commit e0ec6b1

Browse files
committed
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.
1 parent 4584f33 commit e0ec6b1

File tree

1 file changed

+7
-17
lines changed

1 file changed

+7
-17
lines changed

gdb/dwarf2/read.c

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1989,9 +1989,9 @@ struct dwarf2_per_cu_quick_data
19891989
expand_symtabs_matching. */
19901990
unsigned int mark : 1;
19911991

1992-
/* True if we've tried to read the file table and found there isn't one.
1993-
There will be no point in trying to read it again next time. */
1994-
unsigned int no_file_data : 1;
1992+
/* True if we've tried to read the file table. There will be no
1993+
point in trying to read it again next time. */
1994+
bool files_read : 1;
19951995
};
19961996

19971997
/* 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,
28972897

28982898
gdb_assert (! this_cu->is_debug_types);
28992899

2900+
this_cu->v.quick->files_read = true;
29002901
/* Our callers never want to match partial units -- instead they
29012902
will match the enclosing full CU. */
29022903
if (comp_unit_die->tag == DW_TAG_partial_unit)
2903-
{
2904-
this_cu->v.quick->no_file_data = 1;
2905-
return;
2906-
}
2904+
return;
29072905

29082906
lh_cu = this_cu;
29092907
slot = NULL;
@@ -2933,10 +2931,7 @@ dw2_get_file_names_reader (const struct die_reader_specs *reader,
29332931
lh = dwarf_decode_line_header (line_offset, cu);
29342932
}
29352933
if (lh == NULL)
2936-
{
2937-
lh_cu->v.quick->no_file_data = 1;
2938-
return;
2939-
}
2934+
return;
29402935

29412936
qfn = XOBNEW (&per_objfile->per_bfd->obstack, struct quick_file_names);
29422937
qfn->hash.dwo_unit = cu->dwo_unit;
@@ -2976,18 +2971,13 @@ dw2_get_file_names (dwarf2_per_cu_data *this_cu,
29762971
/* Nor type unit groups. */
29772972
gdb_assert (! this_cu->type_unit_group_p ());
29782973

2979-
if (this_cu->v.quick->file_names != NULL)
2974+
if (this_cu->v.quick->files_read)
29802975
return this_cu->v.quick->file_names;
2981-
/* If we know there is no line data, no point in looking again. */
2982-
if (this_cu->v.quick->no_file_data)
2983-
return NULL;
29842976

29852977
cutu_reader reader (this_cu, per_objfile);
29862978
if (!reader.dummy_p)
29872979
dw2_get_file_names_reader (&reader, reader.comp_unit_die);
29882980

2989-
if (this_cu->v.quick->no_file_data)
2990-
return NULL;
29912981
return this_cu->v.quick->file_names;
29922982
}
29932983

0 commit comments

Comments
 (0)