From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id KZysGwEgJ2rmmzwAWB0awg (envelope-from ) for ; Mon, 08 Jun 2026 16:03:13 -0400 Received: by simark.ca (Postfix, from userid 112) id 6D5731E0AA; Mon, 08 Jun 2026 16:03:13 -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=unavailable 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 EBC431E070 for ; Mon, 08 Jun 2026 16:03:12 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D8AE844EBD74 for ; Mon, 8 Jun 2026 20:03:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D8AE844EBD74 Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 812B651A432F for ; Mon, 8 Jun 2026 20:01:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 812B651A432F 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 812B651A432F 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=1780948864; cv=none; b=CEAGjV11tgKZzA2Jmh4ZoE2+ozYY/blFx2+2oaMce0U6ZWS25buhaxb6Wa0VHs4/6LRSqok2uvYma+8IGbr41hSmASaIVDPv93O4BZ13X7lAzRyP6hPg+YKToxeZOEsvRJsOrYNGSrWLhK00IaQX8YYL10Kr//rgKxxFT2i7VPg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1780948864; c=relaxed/simple; bh=9jtn6H0iYxtLWAj7dnKSrpA5z+yEeTRK0jplwgG3v0I=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=QVR7CfDO1jhSD2Lh/50KcDh2hOBivaJYCvmsUw7fDcYJY9/EthycBg6B4wpe9hshMYjtAsX+1myuTkBJroP6S7749aJiGsAiawLHIeeLFmbf3u85S9eVf/yeJ0TcUUgTFWgp3z81yZ7C4Wsqs6jxfg6DZhWF4XurTPke6zLDfbA= ARC-Authentication-Results: i=1; sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 812B651A432F Received: by simark.ca (Postfix) id AD93D1E0AE; Mon, 08 Jun 2026 16:01:02 -0400 (EDT) From: Simon Marchi To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH RESEND v2 06/10] gdb/solib-rocm: save inferior in rocm_solib_ops Date: Mon, 8 Jun 2026 16:00:30 -0400 Message-ID: <20260608200100.666134-7-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 From: Simon Marchi Storing the inferior in rocm_solib_ops lets us avoid some calls to current_inferior(). Change-Id: Icf36bbef031eda7b776cd735a91a2ff918697dd3 --- gdb/solib-rocm.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/gdb/solib-rocm.c b/gdb/solib-rocm.c index 618f4f5e7905..0a284dfb0a56 100644 --- a/gdb/solib-rocm.c +++ b/gdb/solib-rocm.c @@ -189,7 +189,7 @@ struct rocm_solib_ops : public solib_ops in order to provide support for ROCm code objects. */ explicit rocm_solib_ops (inferior *inf, solib_ops_up host_ops) : solib_ops (inf->pspace), m_host_ops (std::move (host_ops)), - m_fd_cache (inf) + m_inf (inf), m_fd_cache (inf) { gdb_assert (m_host_ops != nullptr); gdb_assert (dynamic_cast (m_host_ops.get ()) == nullptr); @@ -260,10 +260,13 @@ struct rocm_solib_ops : public solib_ops private: owning_intrusive_list solibs_from_rocm_sos (const std::vector &sos); - gdb_bfd_iovec_base *bfd_iovec_open (bfd *abfd, inferior *inferior); + gdb_bfd_iovec_base *bfd_iovec_open (bfd *abfd); solib_ops_up m_host_ops; + /* Inferior this rocm_solib_ops is for. */ + inferior *m_inf; + /* List of code objects loaded into the inferior. */ std::vector m_solib_list; @@ -510,7 +513,7 @@ rocm_code_object_stream_memory::read (bfd *, void *buf, file_ptr size, } /* anonymous namespace */ gdb_bfd_iovec_base * -rocm_solib_ops::bfd_iovec_open (bfd *abfd, inferior *inferior) +rocm_solib_ops::bfd_iovec_open (bfd *abfd) { std::string_view uri (bfd_get_filename (abfd)); std::string_view protocol_delim = "://"; @@ -637,7 +640,7 @@ rocm_solib_ops::bfd_iovec_open (bfd *abfd, inferior *inferior) if (protocol == "memory") { ULONGEST pid = try_strtoulst (path); - if (pid != inferior->pid) + if (pid != m_inf->pid) { warning (_("`%s': code object is from another inferior"), std::string (uri).c_str ()); @@ -683,7 +686,7 @@ rocm_solib_ops::bfd_open (const char *pathname) auto open = [this] (bfd *nbfd) { - return this->bfd_iovec_open (nbfd, current_inferior ()); + return this->bfd_iovec_open (nbfd); }; gdb_bfd_ref_ptr abfd = gdb_bfd_openr_iovec (pathname, "elf64-amdgcn", open); @@ -772,9 +775,7 @@ rocm_solib_ops::create_inferior_hook (int from_tty) void rocm_solib_ops::update_solib_list () { - inferior *inf = current_inferior (); - - amd_dbgapi_process_id_t process_id = get_amd_dbgapi_process_id (inf); + amd_dbgapi_process_id_t process_id = get_amd_dbgapi_process_id (m_inf); if (process_id.handle == AMD_DBGAPI_PROCESS_NONE.handle) return; -- 2.54.0