[PATCH] PR gdb/27876 - debuginfod-downloaded source files don't pass proper fullname across mi / (gdb)info source
Aaron Merey
amerey@redhat.com
Sat Nov 20 00:41:40 GMT 2021
Source files downloaded from debuginfod currently use their original DWARF
filename as their "fullname". This causes a mismatch between the fullname
and the actual location of the source file in the debuginfod client cache.
MI consumers such as VSCode will fail to open debuginfod-downloaded
source files due to this. Also 'info source' will fail to include the
true paths of these files.
To fix this, use the debuginfod cache path as the fullname for debuginfod-
downloaded source files.
---
gdb/debuginfod-support.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/gdb/debuginfod-support.c b/gdb/debuginfod-support.c
index 2e1837da949..3f57b5d50cb 100644
--- a/gdb/debuginfod-support.c
+++ b/gdb/debuginfod-support.c
@@ -201,6 +201,7 @@ debuginfod_source_query (const unsigned char *build_id,
if (c == nullptr)
return scoped_fd (-ENOMEM);
+ char *dname = nullptr;
user_data data ("source file", srcpath);
debuginfod_set_user_data (c, &data);
@@ -208,7 +209,7 @@ debuginfod_source_query (const unsigned char *build_id,
build_id,
build_id_len,
srcpath,
- nullptr));
+ &dname));
debuginfod_set_user_data (c, nullptr);
if (debuginfod_verbose > 0 && fd.get () < 0 && fd.get () != -ENOENT)
@@ -217,7 +218,7 @@ debuginfod_source_query (const unsigned char *build_id,
styled_string (file_name_style.style (), srcpath));
if (fd.get () >= 0)
- *destname = make_unique_xstrdup (srcpath);
+ destname->reset (dname);
return fd;
}
--
2.33.1
More information about the Gdb-patches
mailing list