From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2009) id A7708383A21A; Wed, 31 Aug 2022 00:22:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A7708383A21A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1661905353; bh=SL0MpfDqiAiQ7GcpBE9lOQ5cHsWYzuJDFSZsSK90uV8=; h=From:To:Subject:Date:From; b=eLiekDGXLCmFBzV/2aL7w07j6FmRJmyRckT+3thXGp/NiDpnEC0Wsuvpx6wf0Jqbh tx1hbqPOIYuQX9eOCyuh3SvMzU/opqOKB3lYZXwUeeH9tHHUHJBDxu8BqSeuKlJADp X8cU5kluE4p8TPEWNnciIcQz8HSHw0wmTWnJQ3H0= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Aaron Merey To: gdb-cvs@sourceware.org Subject: [binutils-gdb] gdb/elfread.c: Use bfd filename instead of objfile->original_name X-Act-Checkin: binutils-gdb X-Git-Author: Aaron Merey X-Git-Refname: refs/heads/master X-Git-Oldrev: 649cd1d8df4d927b21b8178dcad1041ad674d672 X-Git-Newrev: 803584b96d97e1f6ea50b0a0064d2a03ab0baa60 Message-Id: <20220831002233.A7708383A21A@sourceware.org> Date: Wed, 31 Aug 2022 00:22:33 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D803584b96d97= e1f6ea50b0a0064d2a03ab0baa60 commit 803584b96d97e1f6ea50b0a0064d2a03ab0baa60 Author: Aaron Merey Date: Tue Aug 30 20:18:11 2022 -0400 gdb/elfread.c: Use bfd filename instead of objfile->original_name =20 The call to debuginfod_debuginfo_query in elf_symfile_read is given objfile->original_name as the filename to print when downloading the objfile's debuginfo. =20 In some cases original_name is prefixed with gdb's working directory even though the objfile is not located in the working directory. This causes debuginfod to display the wrong path of the objfile during a dow= nload. =20 Fix this by using the objfile's bfd filename instead. Diff: --- gdb/elfread.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gdb/elfread.c b/gdb/elfread.c index 08db208ebbb..13dbaf0227a 100644 --- a/gdb/elfread.c +++ b/gdb/elfread.c @@ -1279,13 +1279,14 @@ elf_symfile_read (struct objfile *objfile, symfile_= add_flags symfile_flags) has_dwarf2 =3D false; const struct bfd_build_id *build_id =3D build_id_bfd_get (objfile->obfd.get ()); + const char *filename =3D bfd_get_filename (objfile->obfd.get ()); =20 if (build_id !=3D nullptr) { gdb::unique_xmalloc_ptr symfile_path; scoped_fd fd (debuginfod_debuginfo_query (build_id->data, build_id->size, - objfile->original_name, + filename, &symfile_path)); =20 if (fd.get () >=3D 0) @@ -1295,7 +1296,7 @@ elf_symfile_read (struct objfile *objfile, symfile_ad= d_flags symfile_flags) =20 if (debug_bfd =3D=3D nullptr) warning (_("File \"%s\" from debuginfod cannot be opened as bfd"), - objfile->original_name); + filename); else if (build_id_verify (debug_bfd.get (), build_id->size, build_id->= data)) { symbol_file_add_separate (debug_bfd, symfile_path.get (),