From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id waqcEaIfJ2rmmzwAWB0awg (envelope-from ) for ; Mon, 08 Jun 2026 16:01:38 -0400 Received: by simark.ca (Postfix, from userid 112) id D50231E0A6; Mon, 08 Jun 2026 16:01:37 -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 [38.145.34.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 5D44A1E0A6 for ; Mon, 08 Jun 2026 16:01:34 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 956A544EBD7B for ; Mon, 8 Jun 2026 20:01:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 956A544EBD7B Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 8210851A432A for ; Mon, 8 Jun 2026 20:01:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8210851A432A 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 8210851A432A 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=1780948862; cv=none; b=K8xYuDjniAG4p/t8D20jCLeY+7QeOunf08/Y9D8ovqFwc6kew9fy4759W7FAwGBGM6tTKFRkAJ6Oduxts+z31LmAPfkIEQfuxHSvLBpEHZgXEwUqDyab3QfwMVM+5nIBwkgvrw1wLbNRq2XIeasRV1yvBS59qOZw/0FKEh39+aY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1780948862; c=relaxed/simple; bh=/+YabtFc7Z+9ohaEhJGFWfhSuhWIqjV+smfkG22AlAo=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=rjkDF54prdM/YoEvnxgxIsxB3qLD9x+UkD9Taw5YUxbIfV49rTIAEjN977gov6YQb6YhFKGEaeibI/HX8sBuk2mDjwjiWE+FAnoMz4p+qGnaNaxA2TECdiT1lOP1cV8Ca4+UC5DyeiZ7Dyq1pEtL6HiH0fAX4vZYCifjM5tm6ow= ARC-Authentication-Results: i=1; sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8210851A432A Received: by simark.ca (Postfix) id 8C3741E0A3; Mon, 08 Jun 2026 16:01:01 -0400 (EDT) From: Simon Marchi To: gdb-patches@sourceware.org Cc: Simon Marchi , Lancelot Six Subject: [PATCH RESEND v2 02/10] gdb/solib-rocm: pass reference to cache to rocm_code_object_stream_file Date: Mon, 8 Jun 2026 16:00:26 -0400 Message-ID: <20260608200100.666134-3-simon.marchi@efficios.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260608200100.666134-1-simon.marchi@efficios.com> References: <20260608200100.666134-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 dcaa0ee980a3..f96f0823200e 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.54.0