From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id hG5KAoJEmGGBDwAAWB0awg (envelope-from ) for ; Fri, 19 Nov 2021 19:42:42 -0500 Received: by simark.ca (Postfix, from userid 112) id EA1201F0CE; Fri, 19 Nov 2021 19:42:41 -0500 (EST) 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 781DA1EDEE for ; Fri, 19 Nov 2021 19:42:41 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7BEE43858424 for ; Sat, 20 Nov 2021 00:42:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7BEE43858424 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1637368960; bh=sKeJlT0wJFAnMUFDxM6CICJy3WK7tDK7Cz0RBvL4lxM=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=WNWl89eEAh0M124MeQHT/ydc74247YFryiwPndwGqQvAeWg8myH+siZMWWMorl4O+ qjLnaMbZ6zx/l6nfGqUUWN/v/M2D2NJ9hro9EN391O+5GLUw0DUPyRwsRnrLHI53P4 GljuUYEpNpLLwKvVabz63k+Wg6NhxbaNN6ouRXfs= 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) 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-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" 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