public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] PR gdb/27876 - debuginfod-downloaded source files don't pass proper fullname across mi / (gdb)info source
@ 2021-11-20  0:41 Aaron Merey
  2022-01-26  1:43 ` Aaron Merey
  2022-03-04 15:32 ` Tom Tromey
  0 siblings, 2 replies; 5+ messages in thread
From: Aaron Merey @ 2021-11-20  0:41 UTC (permalink / raw)
  To: gdb-patches

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] PR gdb/27876 - debuginfod-downloaded source files don't pass proper fullname across mi / (gdb)info source
  2021-11-20  0:41 [PATCH] PR gdb/27876 - debuginfod-downloaded source files don't pass proper fullname across mi / (gdb)info source Aaron Merey
@ 2022-01-26  1:43 ` Aaron Merey
  2022-02-09  2:30   ` Aaron Merey
  2022-03-04 15:32 ` Tom Tromey
  1 sibling, 1 reply; 5+ messages in thread
From: Aaron Merey @ 2022-01-26  1:43 UTC (permalink / raw)
  To: gdb-patches

Ping

Thanks,
Aaron

On Fri, Nov 19, 2021 at 7:42 PM Aaron Merey <amerey@redhat.com> wrote:
>
> 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
>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] PR gdb/27876 - debuginfod-downloaded source files don't pass proper fullname across mi / (gdb)info source
  2022-01-26  1:43 ` Aaron Merey
@ 2022-02-09  2:30   ` Aaron Merey
  0 siblings, 0 replies; 5+ messages in thread
From: Aaron Merey @ 2022-02-09  2:30 UTC (permalink / raw)
  To: gdb-patches

Ping ** 2

Thanks,
Aaron

On Tue, Jan 25, 2022 at 8:43 PM Aaron Merey <amerey@redhat.com> wrote:
>
> Ping
>
> Thanks,
> Aaron
>
> On Fri, Nov 19, 2021 at 7:42 PM Aaron Merey <amerey@redhat.com> wrote:
> >
> > 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
> >


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] PR gdb/27876 - debuginfod-downloaded source files don't pass proper fullname across mi / (gdb)info source
  2021-11-20  0:41 [PATCH] PR gdb/27876 - debuginfod-downloaded source files don't pass proper fullname across mi / (gdb)info source Aaron Merey
  2022-01-26  1:43 ` Aaron Merey
@ 2022-03-04 15:32 ` Tom Tromey
  2022-03-08 20:50   ` Aaron Merey
  1 sibling, 1 reply; 5+ messages in thread
From: Tom Tromey @ 2022-03-04 15:32 UTC (permalink / raw)
  To: Aaron Merey via Gdb-patches

>>>>> "Aaron" == Aaron Merey via Gdb-patches <gdb-patches@sourceware.org> writes:

Aaron> Source files downloaded from debuginfod currently use their original DWARF
Aaron> filename as their "fullname".  This causes a mismatch between the fullname
Aaron> and the actual location of the source file in the debuginfod client cache.

Aaron> MI consumers such as VSCode will fail to open debuginfod-downloaded
Aaron> source files due to this.  Also 'info source' will fail to include the
Aaron> true paths of these files.

Aaron> To fix this, use the debuginfod cache path as the fullname for debuginfod-
Aaron> downloaded source files.

Looks good.  Thank you.

Tom

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] PR gdb/27876 - debuginfod-downloaded source files don't pass proper fullname across mi / (gdb)info source
  2022-03-04 15:32 ` Tom Tromey
@ 2022-03-08 20:50   ` Aaron Merey
  0 siblings, 0 replies; 5+ messages in thread
From: Aaron Merey @ 2022-03-08 20:50 UTC (permalink / raw)
  To: Tom Tromey; +Cc: Aaron Merey via Gdb-patches

On Fri, Mar 4, 2022 at 10:32 AM Tom Tromey <tom@tromey.com> wrote:
> Looks good.  Thank you.

Thanks, pushed as commit 9ac37a9ce.

Aaron


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-03-08 20:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-20  0:41 [PATCH] PR gdb/27876 - debuginfod-downloaded source files don't pass proper fullname across mi / (gdb)info source Aaron Merey
2022-01-26  1:43 ` Aaron Merey
2022-02-09  2:30   ` Aaron Merey
2022-03-04 15:32 ` Tom Tromey
2022-03-08 20:50   ` 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).