From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id MaqHKq7GTmpG0iwAWB0awg (envelope-from ) for ; Wed, 08 Jul 2026 17:52:46 -0400 Authentication-Results: simark.ca; dkim=pass (2048-bit key; unprotected) header.d=polymtl.ca header.i=@polymtl.ca header.a=rsa-sha256 header.s=oct2025 header.b=PNR5IOTs; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id A984C1E098; Wed, 08 Jul 2026 17:52:46 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [IPv6:2620:52:6:3111::32]) (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 3ED641E04F for ; Wed, 08 Jul 2026 17:52:46 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id DD9124BA2E21 for ; Wed, 8 Jul 2026 21:52:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DD9124BA2E21 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=polymtl.ca header.i=@polymtl.ca header.a=rsa-sha256 header.s=oct2025 header.b=PNR5IOTs Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id C2D6B4BA2E11 for ; Wed, 8 Jul 2026 21:51:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C2D6B4BA2E11 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=polymtl.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=polymtl.ca ARC-Filter: OpenARC Filter v1.0.0 sourceware.org C2D6B4BA2E11 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=132.207.4.11 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1783547518; cv=none; b=aBzgYLI+BFTnTPzE8eaEQVz8s/edaTBpda+Pf7F6ODTp7yRLLCJtBLZpOJtVCjxRlrCeC4RL2rYPOA3n/Mkz9Kl64dW3CMdTzI3K7QkJzVTFY6aEbpQdfNVDj1XE12HigN2k74pR/9rgHMD2hg8WFTxKGBO+xVi5YNawZBpdSAA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1783547518; c=relaxed/simple; bh=TXkW8iSXZLHvNpxOH6FbRyKoTND1i/splg9hPEf8O8I=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=LLVBMpBM19wN/aRsmMyokUrVf/O2Fupv6RmPTjsA1ND7ovYXjJEOozShdptaIPAR1v0bpErxzyZeQ5mga7aU/EgH9O3xXvaymq7G/QLwiPEk0wX5TBdoTttRQBu2gDGCOhXxknZsR+hOj5W2LC9dIWA2H0BZNgZcmy7JudftteE= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=polymtl.ca header.i=@polymtl.ca header.a=rsa-sha256 header.s=oct2025 header.b=PNR5IOTs DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C2D6B4BA2E11 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 668LppQs117337 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 8 Jul 2026 17:51:55 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 668LppQs117337 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=polymtl.ca; s=oct2025; t=1783547516; bh=MiahMn6Vwl9ABqu+hQZu2o0WynFBybqWnBebHAfBEcw=; h=From:To:Cc:Subject:Date:In-Reply-To:From; b=PNR5IOTsUDG8wTo7IIWalScqtMhrX+pNsTEtd1qmVHiqy+xaeGNRDaBtgyg9hKy2W ShSFWWiw+Np4WWrJf9I5Iy687s1DjDtB5ykDw8aMx+aP0SfWbNZ9aAyI9sK7BCDQ3e HC7WJY/0GFxxi+5/SydHU4XhXQFWLx/kHe8DSHZILFv4QKHJfIb2hpIQZq+Oc4q0br q/LQ9X5hC2dVrD9fZoGyV4vnWhHdD0FslMijG7jFaeQOKvyUduaOUPJ19F807YFzA7 TmVfYg4R5gLxQ1FAmAqXzsJa4JG/lmPhtrYO2qcg32oAVWFsyt6M8Tg7dSVZiQB7/A SPT5Pnt7h9UYw== Received: by simark.ca (Postfix) id 14B761E098; Wed, 08 Jul 2026 17:51:50 -0400 (EDT) From: simon.marchi@polymtl.ca To: gdb-patches@sourceware.org Cc: Tom Tromey , Lancelot SIX , Simon Marchi , Lancelot Six Subject: [PATCH v3 02/10] gdb/solib-rocm: pass reference to cache to rocm_code_object_stream_file Date: Wed, 8 Jul 2026 17:51:34 -0400 Message-ID: <20260708215145.93134-3-simon.marchi@polymtl.ca> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260708215145.93134-1-simon.marchi@polymtl.ca> References: <20260708215145.93134-1-simon.marchi@polymtl.ca> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Wed, 8 Jul 2026 21:51:51 +0000 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 From: Simon Marchi ~rocm_code_object_stream_file obtains the fd cache to call "close" on using its m_inf field, obtaining the per-inferior info using get_solib_info. A patch later in this series moves the fd cache from the per-inferior registry to the rocm_solib_ops directly. This implies that we will need a new way to get a reference to the fd_cache owning the fd, as it won't be easy to get it from the inferior anymore. To achieve this, update rocm_code_object_stream_file to keep a reference to the fd cache directly (because the rocm_code_object_stream is not meant to be copied nor moved, make the field a reference). The inferior parameter and field are not needed anymore. Change-Id: Ia10f8f125840274e51e188cafcb7384fdff92240 Approved-by: Lancelot Six --- gdb/solib-rocm.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/gdb/solib-rocm.c b/gdb/solib-rocm.c index 48040111b196..97eb93865610 100644 --- a/gdb/solib-rocm.c +++ b/gdb/solib-rocm.c @@ -356,8 +356,8 @@ struct rocm_code_object_stream_file final : rocm_code_object_stream { DISABLE_COPY_AND_ASSIGN (rocm_code_object_stream_file); - rocm_code_object_stream_file (inferior *inf, target_fd fd, ULONGEST offset, - ULONGEST size); + rocm_code_object_stream_file (rocm_solib_fd_cache &fd_cache, target_fd fd, + ULONGEST offset, ULONGEST size); file_ptr read (bfd *abfd, void *buf, file_ptr size, file_ptr offset) override; @@ -367,9 +367,8 @@ struct rocm_code_object_stream_file final : rocm_code_object_stream ~rocm_code_object_stream_file () override; protected: - - /* The inferior owning this code object stream. */ - inferior *m_inf; + /* The fd cache owning this code object stream. */ + rocm_solib_fd_cache &m_fd_cache; /* The target file descriptor for this stream. */ target_fd m_fd; @@ -383,8 +382,9 @@ struct rocm_code_object_stream_file final : rocm_code_object_stream }; rocm_code_object_stream_file::rocm_code_object_stream_file - (inferior *inf, target_fd fd, ULONGEST offset, ULONGEST size) - : m_inf (inf), m_fd (fd), m_offset (offset), m_size (size) + (rocm_solib_fd_cache &fd_cache, target_fd fd, ULONGEST offset, + ULONGEST size) + : m_fd_cache (fd_cache), m_fd (fd), m_offset (offset), m_size (size) { } @@ -449,9 +449,8 @@ rocm_code_object_stream_file::size () rocm_code_object_stream_file::~rocm_code_object_stream_file () { - auto info = get_solib_info (m_inf); fileio_error target_errno; - if (info->fd_cache.close (m_fd, &target_errno) != 0) + if (m_fd_cache.close (m_fd, &target_errno) != 0) warning (_("Failed to close solib: %s"), strerror (fileio_error_to_host (target_errno))); } @@ -620,7 +619,7 @@ rocm_bfd_iovec_open (bfd *abfd, inferior *inferior) return nullptr; } - return new rocm_code_object_stream_file (inferior, fd, offset, + return new rocm_code_object_stream_file (info->fd_cache, fd, offset, size); } -- 2.55.0