From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id mQdHAJPqHmp/3y8AWB0awg (envelope-from ) for ; Tue, 02 Jun 2026 10:37:07 -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=XU8EcBm4; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id F1CC81E0A6; Tue, 02 Jun 2026 10:37:06 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-6.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 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 524821E062 for ; Tue, 02 Jun 2026 10:37:06 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id DDCE14BA2E3F for ; Tue, 2 Jun 2026 14:37:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DDCE14BA2E3F 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=XU8EcBm4 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 180E74BA23D2 for ; Tue, 2 Jun 2026 14:36:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 180E74BA23D2 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 180E74BA23D2 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1780410966; cv=none; b=b0rhK3HKlAQPw4m9LxQy9PS11VJ2caTS0JeSYwlkvWjc3832WoFtfkzd0WSYc3FXggju3qzXHAXkMTpoEiimlpsvK9IYXET6lMdGP6XVq6+V5qPRIrrWMWt7IIvEE2WsctptzQdvWIULoC6bICZDNNNOBSpkg5fFPhHb4h2NIIQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1780410966; c=relaxed/simple; bh=9zUe+G4jH6SfSwvI80gWzDJtASPRD2vEB7VCs7UNLUw=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=uyAuDCbpR5B7J3jiCLiJVIghSNIf340FB4ln/jhsGJdpEku4f7zjaHAxudMlj/Tbn85DtFWM+ZClbHW3ISu4dk1hMcT8gbhvjqxkLkA7+vY8fUGXKtMCBWSeHg4JSPxEyVRoMgokBDSRKbhMSIHZybSOOiQtTtXCyXym6xNXC9Q= ARC-Authentication-Results: i=1; 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=XU8EcBm4 DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 180E74BA23D2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1780410965; 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=UMWNdkO5SfKvC/imvSNKHH+MUhNq9oO0fkxAI0SHhus=; b=XU8EcBm4BQfPHdvSqNSsblTju0w+duFv9HktnddJV0G/wkXj04sI0KoDUYbryyMFhW5IbF hA2LQ40QSh+L0SwtkMgbvkWUyBJEWXtBzPcUhz8pWsyVjsXzxXOfWCwlrED+kcLJ6hcohp oDO7aqei5VK5JdQsp2CCm26dxjJBnN4= Received: from mx-prod-mc-06.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-641-0klosiDyOjWVQVC8Jwl7vg-1; Tue, 02 Jun 2026 10:36:02 -0400 X-MC-Unique: 0klosiDyOjWVQVC8Jwl7vg-1 X-Mimecast-MFC-AGG-ID: 0klosiDyOjWVQVC8Jwl7vg_1780410961 Received: from mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.95]) (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-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 7FA8D1800624; Tue, 2 Jun 2026 14:36:01 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.96.134.9]) by mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 36DA21687; Tue, 2 Jun 2026 14:35:58 +0000 (UTC) From: Guinevere Larsen To: gdb-patches@sourceware.org Cc: Guinevere Larsen , Thiago Jung Bauermann , Christina Schimpe Subject: [PATCH v4 5/8] gdb/record: make record_full_history more c++-like Date: Tue, 2 Jun 2026 11:33:39 -0300 Message-ID: <20260602143342.12245-6-guinevere@redhat.com> In-Reply-To: <20260602143342.12245-1-guinevere@redhat.com> References: <20260602143342.12245-1-guinevere@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.6 on 10.30.177.95 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: Fxufr9Rg3BSrWYrcmtg57qYjGuENv-FHAUn1RAXjlsU_1780410961 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 This commit moves the function record_full_exec_insn to be a method of the record_full_instruction class. Reviewed-by: Thiago Jung Bauermann Reviewed-By: Christina Schimpe --- gdb/record-full.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/gdb/record-full.c b/gdb/record-full.c index 73de84372b0..fb09147d8cf 100644 --- a/gdb/record-full.c +++ b/gdb/record-full.c @@ -391,6 +391,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); }; /* If true, query if PREC cannot record memory @@ -852,12 +856,9 @@ static enum target_stop_reason record_full_stop_reason /* Execute one entry in the log by executing all the effects. */ -static inline void -record_full_exec_insn (regcache *regcache, - gdbarch *gdbarch, - record_full_instruction &insn) +void record_full_instruction::exec_insn (regcache *regcache) { - for (auto &entry : insn.effects) + for (auto &entry : effects) if (entry.execute (regcache)) record_full_stop_reason = TARGET_STOPPED_BY_WATCHPOINT; } @@ -1318,9 +1319,7 @@ 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); /* step */ if (record_full_resume_step) @@ -2510,8 +2509,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); /* Compute the size needed for the extra bfd section. */ save_size = 4; /* magic cookie */ @@ -2582,8 +2580,9 @@ record_full_base_target::save_record (const char *recfilename) gdbarch); } + /* 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); } unlink_file.keep (); @@ -2604,17 +2603,16 @@ record_full_goto_insn (size_t target_insn, scoped_restore restore_operation_disable = record_full_gdb_operation_disable_set (); regcache *regcache = get_thread_regcache (inferior_thread ()); - struct gdbarch *gdbarch = regcache->arch (); /* Assume everything is valid: we will hit the entry, and we will not hit the end of the recording. */ 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); 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); } /* Alias for "target record-full". */ -- 2.54.0