From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id Kbh+FHrjdWrV8RAAWB0awg (envelope-from ) for ; Fri, 07 Aug 2026 09:54:02 -0400 Received: by simark.ca (Postfix, from userid 112) id 502D91E166; Fri, 07 Aug 2026 09:54:02 -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.3 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, 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 8E4DE1E09B for ; Fri, 07 Aug 2026 09:54:01 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 92FEB4BB58D7 for ; Fri, 7 Aug 2026 13:54:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 92FEB4BB58D7 Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 6023B4BA9038 for ; Fri, 7 Aug 2026 13:53:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6023B4BA9038 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=efficios.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=efficios.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 6023B4BA9038 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=158.69.221.121 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1786110782; cv=none; b=VrytE0DBifQJCteRMN8Zar8ZZw+rpMm90nnmOpEFLParbFjGQRArsxWmvVd5buJwevDr8BGYPvbdRNPGplkGgkAtEIIUVAa9yPoSRSaKZdVgAaue2GxHqYLiVVbzVR2PnJUms+jc6/g3plptiubq0pEesb9UBTEVxHjHnmqAaBo= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1786110782; c=relaxed/simple; bh=4SlvSdMmmjrLWG5+vctl0W45k9Y9YPQ9U3gVj421nUI=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=qb4wrV5Il4gW3SPqh9X9ZYDTMHbuE+MjaF+wAoiZSH6JX8Wz4GWPq2/E5eQDTFgnIiK1zeQv2fO8uSUpv1SkzeLQPfIfdb6xdG1LI0dLQMIVQpgHQLm7Yl8uuJ48+lygXc6YRCCACrV5JZ/SF2B4EBn3MPDD/mbo4XcvHhpiJlQ= ARC-Authentication-Results: i=1; sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6023B4BA9038 Received: by simark.ca (Postfix) id B08AC1E166; Fri, 07 Aug 2026 09:53:00 -0400 (EDT) From: Simon Marchi To: gdb-patches@sourceware.org Cc: Simon Marchi , Lancelot Six Subject: [PATCH v4 02/10] gdb/solib-rocm: pass reference to cache to rocm_code_object_stream_file Date: Fri, 7 Aug 2026 09:52:20 -0400 Message-ID: <20260807135259.111194-3-simon.marchi@efficios.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260807135259.111194-1-simon.marchi@efficios.com> References: <20260807135259.111194-1-simon.marchi@efficios.com> 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 ~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