diff options
author | Aaron Merey <amerey@redhat.com> | 2023-02-09 20:35:32 -0500 |
---|---|---|
committer | Aaron Merey <amerey@redhat.com> | 2023-02-10 21:05:05 -0500 |
commit | 8cc96ee4169f631917d048cbaeec14ddf8ccb90d (patch) | |
tree | a201a360447b005e62941fd4e51afcad74c68d54 /gdb/source-cache.c | |
parent | 40dfb28b56fe55a370a35495e0f1eb6c95110f35 (diff) | |
download | gdb-8cc96ee4169f631917d048cbaeec14ddf8ccb90d.zip gdb-8cc96ee4169f631917d048cbaeec14ddf8ccb90d.tar.gz gdb-8cc96ee4169f631917d048cbaeec14ddf8ccb90d.tar.bz2 |
gdb/source: Fix open_source_file error handling
open_source_file relies on errno to communicate the reason for a missing
source file.
open_source_file may also call debuginfod_find_source. It is possible
for debuginfod_find_source to set errno to a value unrelated to the
reason for a failed download.
This can result in bogus error messages being reported as the reason for
a missing source file. The following error message should instead be
"No such file or directory":
Temporary breakpoint 1, 0x00005555556f4de0 in main ()
(gdb) list
Downloading source file /usr/src/debug/glibc-2.36-8.fc37.x86_64/elf/<built-in>
1 /usr/src/debug/glibc-2.36-8.fc37.x86_64/elf/<built-in>: Directory not empty.
Fix this by having open_source_file return a negative errno if it fails
to open a source file. Use this value to generate the error message
instead of errno.
Approved-By: Tom Tromey <tom@tromey.com>
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29999
Diffstat (limited to 'gdb/source-cache.c')
-rw-r--r-- | gdb/source-cache.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/gdb/source-cache.c b/gdb/source-cache.c index b7410d4..77b357c 100644 --- a/gdb/source-cache.c +++ b/gdb/source-cache.c @@ -95,7 +95,7 @@ source_cache::get_plain_source_lines (struct symtab *s, { scoped_fd desc (open_source_file (s)); if (desc.get () < 0) - perror_with_name (symtab_to_filename_for_display (s)); + perror_with_name (symtab_to_filename_for_display (s), -desc.get ()); struct stat st; if (fstat (desc.get (), &st) < 0) |