From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 336C63858406 for ; Sat, 20 Nov 2021 00:42:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 336C63858406 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-264-n2Ue_keCMi2AEeIj2_1G0A-1; Fri, 19 Nov 2021 19:42:17 -0500 X-MC-Unique: n2Ue_keCMi2AEeIj2_1G0A-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9A2511006AA1 for ; Sat, 20 Nov 2021 00:42:16 +0000 (UTC) Received: from ovpn-112-23.phx2.redhat.com (ovpn-112-23.phx2.redhat.com [10.3.112.23]) by smtp.corp.redhat.com (Postfix) with ESMTP id E1D2360657; Sat, 20 Nov 2021 00:42:13 +0000 (UTC) From: Aaron Merey To: gdb-patches@sourceware.org Subject: [PATCH] PR gdb/27876 - debuginfod-downloaded source files don't pass proper fullname across mi / (gdb)info source Date: Fri, 19 Nov 2021 19:41:40 -0500 Message-Id: <20211120004140.737744-1-amerey@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" X-Spam-Status: No, score=-13.7 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org 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: , X-List-Received-Date: Sat, 20 Nov 2021 00:42:23 -0000 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