public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] PR gdb/27876 - debuginfod-downloaded source files don't pass proper fullname across mi / (gdb)info s
@ 2022-03-08 20:48 Aaron Merey
  0 siblings, 0 replies; only message in thread
From: Aaron Merey @ 2022-03-08 20:48 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=9ac37a9ce607b790bea17c7782d73afecaaa916c

commit 9ac37a9ce607b790bea17c7782d73afecaaa916c
Author: Aaron Merey <amerey@redhat.com>
Date:   Fri Nov 19 19:41:40 2021 -0500

    PR gdb/27876 - debuginfod-downloaded source files don't pass proper fullname across mi / (gdb)info source
    
    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.

Diff:
---
 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 56d8e7781c5..b44ce67c340 100644
--- a/gdb/debuginfod-support.c
+++ b/gdb/debuginfod-support.c
@@ -202,6 +202,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);
@@ -216,7 +217,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)
@@ -225,7 +226,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;
 }


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-03-08 20:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-08 20:48 [binutils-gdb] PR gdb/27876 - debuginfod-downloaded source files don't pass proper fullname across mi / (gdb)info s Aaron Merey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).