From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id N6TGAgC8IGg+vh4AWB0awg (envelope-from ) for ; Sun, 11 May 2025 11:02:24 -0400 Received: by simark.ca (Postfix, from userid 112) id D86641E114; Sun, 11 May 2025 11:02:23 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-9.0 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED, RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE autolearn=ham autolearn_force=no version=4.0.1 Received: from server2.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 ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id F1C3A1E0C1 for ; Sun, 11 May 2025 11:02:22 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8ABF8385701C for ; Sun, 11 May 2025 15:02:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8ABF8385701C Received: from mailout2.rbg.tum.de (mailout2.rbg.tum.de [131.159.0.202]) by sourceware.org (Postfix) with ESMTPS id 0C3D5385800F for ; Sun, 11 May 2025 15:01:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0C3D5385800F Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=sec.in.tum.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=sec.in.tum.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 0C3D5385800F Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=131.159.0.202 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1746975710; cv=none; b=NE4nfTNBB800/Hi53Vz4fNMSzN6wr2XAOQ5V0vNJdYskFWgtU2/778EsyHrMuqhqY7ap1hG05BuWJHj0Vc67jDoPesV6fM+0Z0hIIRs7oM/tg1Tan1sHEFgPf+S+dyNxIaZQy4nj5EivCbwwGNp13fh9Y54aNJUKaKLVLnkAemo= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1746975710; c=relaxed/simple; bh=bn96ZClISM2PVZVDEyUxTIHnGANZnoJX6/8JXuH0H24=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=gCcOSuz+KwhKrdaDtQuIZWZUk+zpmXbO7OvgxvjpQaZ6Obg2s/nSgG1Hz7vMwHQO5rBcvqjaciOPIYYANbry62w606gbBrx0vRIDu4llYp35bKt8zq+51YT7mOmHbfGF7gewKek95k53LH/+he5hKinaOwfVYOHHXoPGHioxPjk= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0C3D5385800F Received: from mailrelay1.rbg.tum.de (mailrelay1.in.tum.de [IPv6:2a09:80c0:254::14]) by mailout2.rbg.tum.de (Postfix) with ESMTPS id 0C4B14C0219 for ; Sun, 11 May 2025 17:01:49 +0200 (CEST) Received: by mailrelay1.rbg.tum.de (Postfix, from userid 112) id 04D6910C; Sun, 11 May 2025 17:01:49 +0200 (CEST) Received: from mailrelay1.rbg.tum.de (localhost [127.0.0.1]) by mailrelay1.rbg.tum.de (Postfix) with ESMTP id B9B1E10B for ; Sun, 11 May 2025 17:01:48 +0200 (CEST) Received: from services.sec.in.tum.de (services.sec.in.tum.de [131.159.50.242]) by mailrelay1.rbg.tum.de (Postfix) with ESMTPS id B7ED145 for ; Sun, 11 May 2025 17:01:48 +0200 (CEST) Received: from frederica.fritz.box (unknown [192.168.253.2]) by services.sec.in.tum.de (Postfix) with ESMTPSA id 5C22A100B93CA; Sun, 11 May 2025 17:01:48 +0200 (CEST) From: Fabian Kilger To: gdb-patches@sourceware.org Cc: Fabian Kilger Subject: [PATCH 2/2][PR GDB/32956] gdb: query inferior's filesystem for build-id debug files Date: Sun, 11 May 2025 17:01:13 +0200 Message-ID: <20250511150113.3163767-3-kilger@sec.in.tum.de> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250511150113.3163767-1-kilger@sec.in.tum.de> References: <20250511150113.3163767-1-kilger@sec.in.tum.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org This fixes a bug related to build-id files with linux namespaces. Specifically, we expect the debug files to be present inside the container, thus the container filesystem should be queried if the program is running inside one. --- gdb/build-id.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gdb/build-id.c b/gdb/build-id.c index 43a80dd3978..abbd65a7c12 100644 --- a/gdb/build-id.c +++ b/gdb/build-id.c @@ -29,6 +29,7 @@ #include "gdbsupport/scoped_fd.h" #include "debuginfod-support.h" #include "extension.h" +#include "inferior.h" /* See build-id.h. */ @@ -128,7 +129,8 @@ build_id_to_debug_bfd_1 (const std::string &original_link, if (supports_target_stat != TRIBOOL_FALSE) { struct stat sb; - int res = target_fileio_stat (nullptr, link_on_target, &sb, + int res = target_fileio_stat (current_inferior (), + link_on_target, &sb, &target_errno); if (res != 0 && target_errno != FILEIO_ENOSYS) @@ -157,7 +159,7 @@ build_id_to_debug_bfd_1 (const std::string &original_link, the path doesn't exist, but we just assume that anything other than EINVAL indicates the path doesn't exist. */ std::optional link_target - = target_fileio_readlink (nullptr, link_on_target, + = target_fileio_readlink (current_inferior (), link_on_target, &target_errno); if (link_target.has_value () || target_errno == FILEIO_EINVAL) -- 2.49.0