From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 8RkbEoc66mkc5zYAWB0awg (envelope-from ) for ; Thu, 23 Apr 2026 11:28: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=Ii+0c9D2; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 3DEDC1E0BA; Thu, 23 Apr 2026 11:28:07 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-0.1 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_SBL_CSS,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=no 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 CA5691E067 for ; Thu, 23 Apr 2026 11:28:06 -0400 (EDT) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id 6A0FD4BC22D7 for ; Thu, 23 Apr 2026 15:28:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6A0FD4BC22D7 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=Ii+0c9D2 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 74FCB4B87BB7 for ; Thu, 23 Apr 2026 15:26:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 74FCB4B87BB7 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 74FCB4B87BB7 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776958019; cv=none; b=YbUC4yOFw3jsZRhtcSbbnu67Z1F5/ZZjL6Atd20gTjJbUKQEixK10PPYdRI8S/BaYpOB27Gu97rEfs8a5B9QnuM0kmNS6sMMGs8/iD8f8JKvKw1HPvMnMvdrgwU8AOpqfuoYZHOOyCv1yrmoURhI9xdsU3UGDLqKyaosAb9vRig= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776958019; c=relaxed/simple; bh=obN0RaYjldl1oNyvz0N+T3784SjKYp/4c8v9W9KBfTg=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=VC4H6JCK8SoJwsQnYQocdBi08jn6titn7ASjZ3C0W/FF/5X7hzW9bKpLY/sRqCCQFGJyzjcW8njHxUAOojsKFdX/k2G0N4Ba6/bqHPd9Ci8nsQxeoUI85XgB64V7DnBhtk/fqtENsDan+42Mdg0JVv8/liUqnP19vNQG9UhXmLI= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 74FCB4B87BB7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1776958019; 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=DigQHGfQU7BYEJPbcCBSCxRJaaC25KOwudzgAKp6PFo=; b=Ii+0c9D28cOX/iCp4cevPM4jVxKS6qdbMS0Hm72Re9kTOw5fWOnfEWgtCwprGWHrYD+I8t +agQwFY1LcZ1TjdmHhcMINGVPMeIw50oTPdxNgHfyAFrdXbwcPrHywWngSYl8Uyh/NCVcx xbkyTceNXGqVdIKenSEzIW4el1THhYI= Received: from mx-prod-mc-05.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-224-UbJVWi7dNy2bH2Q3AODUxQ-1; Thu, 23 Apr 2026 11:26:55 -0400 X-MC-Unique: UbJVWi7dNy2bH2Q3AODUxQ-1 X-Mimecast-MFC-AGG-ID: UbJVWi7dNy2bH2Q3AODUxQ_1776958015 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 1FC1719560AD for ; Thu, 23 Apr 2026 15:26:55 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.96.134.14]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id D52CD19560AB; Thu, 23 Apr 2026 15:26:53 +0000 (UTC) From: Guinevere Larsen To: gdb-patches@sourceware.org Cc: Guinevere Larsen Subject: [PATCH v2 4/6] gdb/record: make record_full_history more c++-like Date: Thu, 23 Apr 2026 12:26:02 -0300 Message-ID: <20260423152604.171356-5-guinevere@redhat.com> In-Reply-To: <20260423152604.171356-1-guinevere@redhat.com> References: <20260423152604.171356-1-guinevere@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: nZ6V7QXToyRlriW0o84Rb5VcmYTJiKE8tEkEAE7Hee4_1776958015 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 6e3907325cd..d0cd8b66174 100644 --- a/gdb/record-full.c +++ b/gdb/record-full.c @@ -353,6 +353,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 @@ -820,12 +824,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) { - for (auto &entry : insn.effects) + for (auto &entry : effects) if (entry.execute (regcache)) record_full_stop_reason = TARGET_STOPPED_BY_WATCHPOINT; } @@ -1285,9 +1286,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) @@ -2477,8 +2476,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 */ @@ -2550,7 +2548,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 (); @@ -2571,17 +2569,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.53.0