From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id EZoxBl466mkc5zYAWB0awg (envelope-from ) for ; Thu, 23 Apr 2026 11:27:26 -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=Hq/CnD93; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 1434E1E0CA; Thu, 23 Apr 2026 11:27:26 -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 051071E0B1 for ; Thu, 23 Apr 2026 11:27:25 -0400 (EDT) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id B4B884BC22E2 for ; Thu, 23 Apr 2026 15:27:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B4B884BC22E2 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=Hq/CnD93 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 49DCF4B87BAE for ; Thu, 23 Apr 2026 15:26:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 49DCF4B87BAE 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 49DCF4B87BAE 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=1776958014; cv=none; b=DhFrXL8Xmo3mkUemv1H5j3FKqh2ahP8NOOTc9g/ecQyxzJs4D2YGE6kZjH6XzuoTy6kd96x9PWVgLn2TEcIHgT6jqg/KQxEkX9vCoxC4BQtWG7x+Jg3QYGGk2+QZq8yKB6DdqaEQWQTMOTYHa9obHz9abYcDBP+RVnAb7diJWPI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776958014; c=relaxed/simple; bh=duE8nFlyZrqk92WG+/8nurojZZwaeQxBG+TYnGbILU8=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=upUYqLHTj33kE54WztVFlleQJUTa1jn564REiyIFkMTn95jdVev82/uW5DspzsnibVzZKYKCcUI5g/jp1gnEQ10ulpj2bjgErVQmjpEsWbwcNQo41p8GmbJQ5MMgpz0Z2+PQBBtEyp9XVE0YAMLQyzLmT2PlQkodwGQnqWIwcUc= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 49DCF4B87BAE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1776958013; 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=hUiV0qsHaSflpKlQbZqwHuNWaOzgDfjeU/Ce1BDz+qI=; b=Hq/CnD930yrRx85jNKAhoaGX1dgffVUcg5qNvZFYMfyc2MMaYjHKt6gg3R7+ko+NDs6Waq XsYAaALJO7C7BFqc4oPD9X4RkC1rDT8zHNMwb5lTS6VWi89LODGd/N793kKkq1FkKos8+1 yGQcZfE/PcLfO1LN2tJYkd9occJC+b4= 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-442-yipeqX5sNwmJC0rmeReT5g-1; Thu, 23 Apr 2026 11:26:52 -0400 X-MC-Unique: yipeqX5sNwmJC0rmeReT5g-1 X-Mimecast-MFC-AGG-ID: yipeqX5sNwmJC0rmeReT5g_1776958011 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-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 71195180049F; Thu, 23 Apr 2026 15:26:51 +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 BE07019560B7; Thu, 23 Apr 2026 15:26:49 +0000 (UTC) From: Guinevere Larsen To: gdb-patches@sourceware.org Cc: Guinevere Larsen , Thiago Jung Bauermann Subject: [PATCH v2 2/6] gdb/record: remove record_full_insn_num Date: Thu, 23 Apr 2026 12:26:00 -0300 Message-ID: <20260423152604.171356-3-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: ywLfd6OcwKKdbW3jk_pdHRAQPSm-w-ZvhGMHG5xzcpc_1776958011 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 Now that record_full_list uses a deque, we don't need a variable to track the amount of items recorded, so it is just dropped. Reviewed-by: Thiago Jung Bauermann --- gdb/record-full.c | 41 ++++++++++++----------------------------- 1 file changed, 12 insertions(+), 29 deletions(-) diff --git a/gdb/record-full.c b/gdb/record-full.c index aac69cee17e..613dd166881 100644 --- a/gdb/record-full.c +++ b/gdb/record-full.c @@ -190,8 +190,6 @@ static bool record_full_stop_at_limit = true; /* Maximum allowed number of insns in execution log. */ static unsigned int record_full_insn_max_num = DEFAULT_RECORD_FULL_INSN_MAX_NUM; -/* Actual count of insns presently in execution log. */ -static unsigned int record_full_insn_num = 0; /* Count of insns logged so far (may be larger than count of insns presently in execution log). */ static ULONGEST record_full_insn_count; @@ -459,7 +457,6 @@ record_full_entry_cleanup (struct record_full_entry rec) static void record_full_reset_history () { - record_full_insn_num = 0; record_full_insn_count = 0; record_full_next_insn = 0; @@ -497,9 +494,7 @@ record_full_save_instruction () } /* Delete the first instruction from the beginning of the log, to make - room for adding a new instruction at the end of the log. - - Note -- this function does not modify record_full_insn_num. */ + room for adding a new instruction at the end of the log. */ static void record_full_list_release_first (void) @@ -599,7 +594,7 @@ record_full_arch_list_add_mem (CORE_ADDR addr, int len) static void record_full_check_insn_num (void) { - if (record_full_insn_num == record_full_insn_max_num) + if (record_full_list.size () == record_full_insn_max_num) { /* Ask user what to do. */ if (record_full_stop_at_limit) @@ -681,10 +676,8 @@ record_full_message (struct regcache *regcache, enum gdb_signal signal) record_full_save_instruction (); - if (record_full_insn_num == record_full_insn_max_num) + if (record_full_list.size () == record_full_insn_max_num) record_full_list_release_first (); - else - record_full_insn_num++; } static bool @@ -1461,10 +1454,8 @@ record_full_registers_change (struct regcache *regcache, int regnum) } record_full_save_instruction (); - if (record_full_insn_num == record_full_insn_max_num) + if (record_full_list.size () == record_full_insn_max_num) record_full_list_release_first (); - else - record_full_insn_num++; } /* "store_registers" method for process record target. */ @@ -1565,10 +1556,8 @@ record_full_target::xfer_partial (enum target_object object, } record_full_save_instruction (); - if (record_full_insn_num == record_full_insn_max_num) + if (record_full_list.size () == record_full_insn_max_num) record_full_list_release_first (); - else - record_full_insn_num++; } return this->beneath ()->xfer_partial (object, annex, readbuf, writebuf, @@ -1803,8 +1792,8 @@ record_full_base_target::info_record () pulongest (record_full_insn_count)); /* Display log count. */ - gdb_printf (_("Log contains %u instructions.\n"), - record_full_insn_num); + gdb_printf (_("Log contains %lu instructions.\n"), + (unsigned long int) record_full_list.size ()); } else gdb_printf (_("No instructions have been logged.\n")); @@ -2286,8 +2275,6 @@ record_full_restore (struct bfd &cbfd) "RECORD_FULL_FILE_MAGIC (0x%s)\n", phex_nz (netorder32 (magic), 4)); - record_full_insn_num = 0; - try { while (bfd_offset < osec_size) @@ -2328,9 +2315,9 @@ record_full_restore (struct bfd &cbfd) } /* Update record_full_insn_max_num. */ - if (record_full_insn_num > record_full_insn_max_num) + if (record_full_list.size () > record_full_insn_max_num) { - record_full_insn_max_num = record_full_insn_num; + record_full_insn_max_num = record_full_list.size (); warning (_("Auto increase record/replay buffer limit to %u."), record_full_insn_max_num); } @@ -2585,14 +2572,10 @@ static void set_record_full_insn_max_num (const char *args, int from_tty, struct cmd_list_element *c) { - if (record_full_insn_num > record_full_insn_max_num) + if (record_full_list.size () > record_full_insn_max_num) { - /* Count down record_full_insn_num while releasing records from list. */ - while (record_full_insn_num > record_full_insn_max_num) - { - record_full_list_release_first (); - record_full_insn_num--; - } + while (record_full_list.size () > record_full_insn_max_num) + record_full_list_release_first (); } } -- 2.53.0