From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id VYdsBMdbR2LeaAAAWB0awg (envelope-from ) for ; Fri, 01 Apr 2022 16:08:39 -0400 Received: by simark.ca (Postfix, from userid 112) id 0192D1F1F4; Fri, 1 Apr 2022 16:08:38 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 7C9D21ED17 for ; Fri, 1 Apr 2022 16:08:38 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id BA435383943F for ; Fri, 1 Apr 2022 20:08:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BA435383943F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1648843717; bh=MM9KKw4yj+tS0dpxbNAC/HBshJ9jAf+uajUzr/5TxdI=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=TzcgaNSvIAxJCtHGz6GTPoCHWXw2fGgvC/6oy7YrvFU9WVPRudyd2KGxdoPQZfJTu jzNMz4igdyCqkJfKfL2hyxOp9nIeym8fjfAvHN7e9Nxo+SKtpTiLdyApTx6pfB9OTE bjsbx1NnM++NZ9z27ehwyKbauP9tqIZhdw7aqAGk= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 3678F385B804 for ; Fri, 1 Apr 2022 20:08:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3678F385B804 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-10-HZqd8-mQMECYC9mB2x3Pzw-1; Fri, 01 Apr 2022 16:08:09 -0400 X-MC-Unique: HZqd8-mQMECYC9mB2x3Pzw-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8720089C5E3 for ; Fri, 1 Apr 2022 20:08:08 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.22.10.67]) by smtp.corp.redhat.com (Postfix) with ESMTP id 573EC40E58A4; Fri, 1 Apr 2022 20:08:08 +0000 (UTC) To: gdb-patches@sourceware.org Subject: [PATCH] gdb/elfread.c: Use bfd filename instead of objfile->original_name Date: Fri, 1 Apr 2022 16:07:51 -0400 Message-Id: <20220401200751.242370-1-amerey@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Aaron Merey via Gdb-patches Reply-To: Aaron Merey Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" 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. 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 download. Fix this by using the objfile's bfd filename instead. --- gdb/elfread.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gdb/elfread.c b/gdb/elfread.c index fb40032c505..3554e5d71a2 100644 --- a/gdb/elfread.c +++ b/gdb/elfread.c @@ -1286,13 +1286,14 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags) { has_dwarf2 = false; const struct bfd_build_id *build_id = build_id_bfd_get (objfile->obfd); + const char *filename = bfd_get_filename (objfile->obfd); if (build_id != 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)); if (fd.get () >= 0) @@ -1302,7 +1303,7 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags) if (debug_bfd == 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.get (), symfile_path.get (), -- 2.35.1