From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id aYp2FCjg32k4GxoAWB0awg (envelope-from ) for ; Wed, 15 Apr 2026 14:59:52 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=D04BC7Pu; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 5022B1E0C3; Wed, 15 Apr 2026 14:59:52 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED 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 BD2B01E04F for ; Wed, 15 Apr 2026 14:59:51 -0400 (EDT) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id 589B74BA23D8 for ; Wed, 15 Apr 2026 18:59:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 589B74BA23D8 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=D04BC7Pu Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTP id CE6284BA2E10 for ; Wed, 15 Apr 2026 18:59:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CE6284BA2E10 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org CE6284BA2E10 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776279556; cv=none; b=Pwwd7NJZNulq1GuLNEpzO4ckiGY5Y+/83RLiekCdOeo4yXgCXD9tZwB2UiIWfaEzwaZH/C5AR0+AB4129UBe9ogsWedckNCsqOOzhNpSnUr01vZAWErcM2EnnuTpd6/9QnBAtl1HL9sbuu1JiX0UOWasHYXoYmVq78U//DwRR0g= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776279556; c=relaxed/simple; bh=CQD8aPbRqY3keUea4RGfJgws9NHPSUaejC2WliQk4B0=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=IfarfzZCW5FMh8QTVAt2ZMEGYHW9CXz/YMC8rt5tjOPTinXt0At0tM+Nyr6W3La/Webgw+d40qK07o3zlWKBMFnLm+pcwFfbuwmGwCv00TMDbnlyNmjGhpog7OjQD27qF+OxmHHhRYMvOD8YfNd2zNBMKTZwjZafRBdPUT9+3uU= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CE6284BA2E10 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1776279556; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CHp9Pm3RFrAlvo8tbdA0OihSDqm3SiPR1YSMX3dCOwY=; b=D04BC7PuY2hDFyhDjtMpXAPaaHYSQuMe29KQowT8vw9bOjBl7o2/UEhNTJwFTYzqBSp3KX AU4NIiPlydKartDy/RoRPExzWoETrPPYc3+NyVvTigZhIFyAdyPbMEXevfhonXA/TkL9Z0 yVdLRSwWJKUN/6kkHOEzrtzj3suvUx8= Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-619-YKC83Y7TMY-8FPQTxLl9AA-1; Wed, 15 Apr 2026 14:59:15 -0400 X-MC-Unique: YKC83Y7TMY-8FPQTxLl9AA-1 X-Mimecast-MFC-AGG-ID: YKC83Y7TMY-8FPQTxLl9AA_1776279554 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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 mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 74EC21800352 for ; Wed, 15 Apr 2026 18:59:14 +0000 (UTC) Received: from fedora.tailb97d54.ts.net (unknown [10.96.134.153]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 78CDF30001A4; Wed, 15 Apr 2026 18:59:13 +0000 (UTC) From: Guinevere Larsen To: gdb-patches@sourceware.org Cc: Guinevere Larsen Subject: [PATCH 4/6] gdb/record: make record_full_history more c++-like Date: Wed, 15 Apr 2026 15:58:34 -0300 Message-ID: <20260415185836.2732968-5-guinevere@redhat.com> In-Reply-To: <20260415185836.2732968-1-guinevere@redhat.com> References: <20260415185836.2732968-1-guinevere@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: WnYPKcWfkSTgOzx7PXu4btM3dVDS3bdA5UDNnM9faM4_1776279554 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit content-type: text/plain; charset="US-ASCII"; x-default=true 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 Move some functions to being a method of record_full_history, instead of floating functions. --- gdb/record-full.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/gdb/record-full.c b/gdb/record-full.c index f3737fdbc1f..c9e66fac578 100644 --- a/gdb/record-full.c +++ b/gdb/record-full.c @@ -325,6 +325,10 @@ struct record_full_instruction uint32_t insn_num; std::optional sigval; std::vector effects; + + /* Execute the full instruction. As a side effect, set + record_full_stop_reason. */ + void exec_insn (regcache *regcache, gdbarch *gdbarch); }; /* If true, query if PREC cannot record memory @@ -835,12 +839,9 @@ record_full_gdb_operation_disable_set (void) static enum target_stop_reason record_full_stop_reason = TARGET_STOPPED_BY_NO_REASON; -static inline void -record_full_exec_insn (struct regcache *regcache, - struct gdbarch *gdbarch, - record_full_instruction &insn) +void record_full_instruction::exec_insn (regcache *regcache, gdbarch *gdbarch) { - for (auto &entry : insn.effects) + for (auto &entry : effects) if (entry.execute (regcache, gdbarch)) record_full_stop_reason = TARGET_STOPPED_BY_WATCHPOINT; } @@ -1287,9 +1288,8 @@ record_full_wait_1 (struct target_ops *ops, break; } - record_full_exec_insn - (regcache, gdbarch, - record_full_list[record_full_next_insn]); + record_full_list[record_full_next_insn].exec_insn (regcache, + gdbarch); /* step */ if (record_full_resume_step) @@ -2491,8 +2491,7 @@ record_full_base_target::save_record (const char *recfilename) /* Reverse execute to the begin of record list. */ for (int i = record_full_next_insn - 1; i >= 0; i--) - record_full_exec_insn (regcache, gdbarch, - record_full_list[i]); + record_full_list[i].exec_insn (regcache, gdbarch); /* Compute the size needed for the extra bfd section. */ save_size = 4; /* magic cookie */ @@ -2565,7 +2564,7 @@ record_full_base_target::save_record (const char *recfilename) } /* Execute entry. */ if (i < record_full_next_insn) - record_full_exec_insn (regcache, gdbarch, record_full_list[i]); + record_full_list[i].exec_insn (regcache, gdbarch); } unlink_file.keep (); @@ -2593,10 +2592,10 @@ record_full_goto_insn (size_t target_insn, if (dir == EXEC_REVERSE) for (int i = record_full_next_insn; i > target_insn; i--) - record_full_exec_insn (regcache, gdbarch, record_full_list[i - 1]); + record_full_list[i-1].exec_insn (regcache, gdbarch); else for (int i = record_full_next_insn; i < target_insn; i++) - record_full_exec_insn (regcache, gdbarch, record_full_list[i]); + record_full_list[i].exec_insn (regcache, gdbarch); } /* Alias for "target record-full". */ -- 2.53.0