From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id A3FC63858C62 for ; Mon, 3 Apr 2023 18:52:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A3FC63858C62 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=efficios.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=efficios.com Received: from localhost.localdomain (unknown [217.28.27.60]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 1895E1E223; Mon, 3 Apr 2023 14:52:19 -0400 (EDT) From: Simon Marchi To: gdb-patches@sourceware.org Cc: Simon Marchi , Pedro Alves Subject: [PATCH 3/7] gdb: remove regcache::target Date: Mon, 3 Apr 2023 14:52:04 -0400 Message-Id: <20230403185208.197965-4-simon.marchi@efficios.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230403185208.197965-1-simon.marchi@efficios.com> References: <20230403185208.197965-1-simon.marchi@efficios.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1173.2 required=5.0 tests=BAYES_00,GIT_PATCH_0,KAM_DMARC_NONE,KAM_DMARC_STATUS,SPF_HELO_PASS,SPF_SOFTFAIL,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: The regcache class takes a process_stratum_target and then exposes it through regcache::target. But it doesn't use it itself, suggesting it doesn't really make sense to put it there. The only user of regcache::target is record_btrace_target::fetch_registers, but it might as well just get it from the current target stack. This simplifies a little bit a patch later in this series. Change-Id: I8878d875805681c77f469ac1a2bf3a508559a62d Reviewed-By: Pedro Alves --- gdb/record-btrace.c | 3 ++- gdb/regcache.c | 1 - gdb/regcache.h | 5 ----- 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c index 2d88e4d20bf6..358d8de089f8 100644 --- a/gdb/record-btrace.c +++ b/gdb/record-btrace.c @@ -1548,7 +1548,8 @@ record_btrace_target::fetch_registers (struct regcache *regcache, int regno) /* Thread-db may ask for a thread's registers before GDB knows about the thread. We forward the request to the target beneath in this case. */ - thread_info *tp = find_thread_ptid (regcache->target (), regcache->ptid ()); + thread_info *tp = find_thread_ptid (current_inferior ()->process_target (), + regcache->ptid ()); if (tp != nullptr) replay = tp->btrace.replay; diff --git a/gdb/regcache.c b/gdb/regcache.c index af76fab1a34f..cfa8a3d78335 100644 --- a/gdb/regcache.c +++ b/gdb/regcache.c @@ -1622,7 +1622,6 @@ get_thread_arch_aspace_regcache_and_check (process_stratum_target *target, = get_thread_arch_aspace_regcache (target, ptid, arch, aspace); SELF_CHECK (regcache != NULL); - SELF_CHECK (regcache->target () == target); SELF_CHECK (regcache->ptid () == ptid); SELF_CHECK (regcache->arch () == arch); SELF_CHECK (regcache->aspace () == aspace); diff --git a/gdb/regcache.h b/gdb/regcache.h index b9ffab9950d2..2bd2f57b8332 100644 --- a/gdb/regcache.h +++ b/gdb/regcache.h @@ -416,11 +416,6 @@ class regcache : public detached_regcache this->m_ptid = ptid; } - process_stratum_target *target () const - { - return m_target; - } - /* Dump the contents of a register from the register cache to the target debug. */ void debug_print_register (const char *func, int regno); -- 2.40.0