From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id SUjNGsdMB2pflz0AWB0awg (envelope-from ) for ; Fri, 15 May 2026 12:41:43 -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=iVmOehxa; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 6A58F1E0B1; Fri, 15 May 2026 12:41:43 -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 F31AE1E067 for ; Fri, 15 May 2026 12:41:42 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B875140A00E5 for ; Fri, 15 May 2026 16:41:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B875140A00E5 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=iVmOehxa Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id 38D4051A4327 for ; Fri, 15 May 2026 16:39:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 38D4051A4327 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 38D4051A4327 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1778863143; cv=none; b=YtX3mOgMjmn6XPVW1H5op+Mih22+OmNCZrEbBE8S6IXiV5k2js03/q0YxK/tbABZJWDrXwgJPE7NHFi2tDYWnBl2cuwlGYkssmKQ+kOchEL5QZQTwzh8hU6PufItB46zKlTQck4k04DNTUKQv3jxhAKZLTeDabwxj4eiZmhC4J8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1778863143; c=relaxed/simple; bh=ZW3KpMUj96h+gVg0RUMGW+l2xHRSV5oYtZ7IOCEHutQ=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=Og/oi7SJVhV0r876iLIVzM9gehdd5ozkcqxtpDFZm9f6ExOOH+wJ4Y7kLET5aZwcNHqnmdKrL6+AoHOI1MFkbO6uthxVWF2fZmUjLHI8HF7oeUdD4vVEQ279tyFh4IbW0XnFfwFBE3sa4wmzVQFrKE/RjB5+zfhKv2i0uK4IFrE= 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=iVmOehxa DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 38D4051A4327 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1778863142; 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=yfThCC++HweG5nfHt57o6BlWmcTA4VoUaa02R+4x/+o=; b=iVmOehxapUclqUYzIfvs495jpNFQl7RcLxR4xGnE5rZ9dGV8Fvh740aCD0f84QBPFN30v+ kR1o9/TPVlTBmBjcMi5TCeKISyIXwKId5OwhoTRsT4XqAJX6XSuQDirsu/qWWBQgeD4H0B biCgAaXFQHJfbGE4Pj4tE3kl0CAU2vg= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-422-o8oK76ngNrCo6surRAaAqA-1; Fri, 15 May 2026 12:39:01 -0400 X-MC-Unique: o8oK76ngNrCo6surRAaAqA-1 X-Mimecast-MFC-AGG-ID: o8oK76ngNrCo6surRAaAqA_1778863140 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id B7DD71956055 for ; Fri, 15 May 2026 16:39:00 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.96.134.23]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 81F8C19432BB; Fri, 15 May 2026 16:38:59 +0000 (UTC) From: Guinevere Larsen To: gdb-patches@sourceware.org Cc: Guinevere Larsen Subject: [PATCH v3 4/7] gdb/record: make record_full_history more c++-like Date: Fri, 15 May 2026 13:37:01 -0300 Message-ID: <20260515163706.3355686-5-guinevere@redhat.com> In-Reply-To: <20260515163706.3355686-1-guinevere@redhat.com> References: <20260515163706.3355686-1-guinevere@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: nrnPLgNtUcWkhOyCqD96qGaYW6LaXf2zfPMViSIKQBM_1778863140 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, 11 insertions(+), 14 deletions(-) diff --git a/gdb/record-full.c b/gdb/record-full.c index 24e94eaf5da..8cabd6e9438 100644 --- a/gdb/record-full.c +++ b/gdb/record-full.c @@ -388,6 +388,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 @@ -843,12 +847,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 (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; } @@ -1308,9 +1309,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) @@ -2503,8 +2502,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 */ @@ -2576,7 +2574,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); } unlink_file.keep (); @@ -2597,17 +2595,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