aboutsummaryrefslogtreecommitdiff
path: root/gdb/dwarf2/index-cache.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2022-04-26 12:45:07 -0600
committerTom Tromey <tom@tromey.com>2022-04-28 09:37:48 -0600
commit9dd9f9ce1e231ef594845f11c05a724653241b58 (patch)
tree6748568e879ce123e0bcd2736d724b2b2771ce56 /gdb/dwarf2/index-cache.c
parent0d1703b8fb611f978577a70ad6aa308a12a53980 (diff)
downloadbinutils-9dd9f9ce1e231ef594845f11c05a724653241b58.zip
binutils-9dd9f9ce1e231ef594845f11c05a724653241b58.tar.gz
binutils-9dd9f9ce1e231ef594845f11c05a724653241b58.tar.bz2
Check OBJF_NOT_FILENAME in DWARF index code
The DWARF index code currently uses 'stat' to see if an objfile represents a real file. However, I think it's more correct to check OBJF_NOT_FILENAME instead. Regression tested on x86-64 Fedora 34.
Diffstat (limited to 'gdb/dwarf2/index-cache.c')
-rw-r--r--gdb/dwarf2/index-cache.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/gdb/dwarf2/index-cache.c b/gdb/dwarf2/index-cache.c
index fb827e0..a1f6ff5 100644
--- a/gdb/dwarf2/index-cache.c
+++ b/gdb/dwarf2/index-cache.c
@@ -96,6 +96,10 @@ index_cache::store (dwarf2_per_objfile *per_objfile)
if (!enabled ())
return;
+ /* If the objfile does not correspond to an actual file, skip it. */
+ if ((obj->flags & OBJF_NOT_FILENAME) != 0)
+ return;
+
/* Get build id of objfile. */
const bfd_build_id *build_id = build_id_bfd_get (obj->obfd);
if (build_id == nullptr)