From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id KdwdOFZMB2pflz0AWB0awg (envelope-from ) for ; Fri, 15 May 2026 12:39:50 -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=aFKkhb0z; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id E13341E0B1; Fri, 15 May 2026 12:39:50 -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 60F701E067 for ; Fri, 15 May 2026 12:39:50 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 09C9C40A00FF for ; Fri, 15 May 2026 16:39:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 09C9C40A00FF 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=aFKkhb0z 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 1C25340A24B1 for ; Fri, 15 May 2026 16:39:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1C25340A24B1 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 1C25340A24B1 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=1778863141; cv=none; b=KbR0XxnSnHOeYbApbzfjfVep7sqfeYjkMZYt2BBuCGQl+vtsI9/gNPS0WSQcejLXGm+H61pN/VBzS5zrkLzRZSfhsjRVDI4rW+Ekknk8iVYUXgImbMzeUuVGa7bz1J/6tY3OhLswxjNdOtqsXaoT+V2L5iFEKw7rqBd8+rfGojE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1778863141; c=relaxed/simple; bh=XK9nGXOK0C6VDbfGEIrJgp2iC7NvD7U1n3eShyQQKT0=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=OPyrqUEJm5FcvV93GJOYMi8yeLLw6ku8VXm7hn50bLqAJ1wriS/kxgzRWbSx7B3IqST+AMKPqCGer2/cc4wcUdQzKfKiiLhbtn1BB3Rl6JdhhGYesybKDPO3xtSzmW8zheuCGNqwAB9V0967D+5IQEkbDrargaW2x5QvGnqmXq8= 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=aFKkhb0z DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1C25340A24B1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1778863140; 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=EJLEvtj9yhjGnCmnmX2nQurGWrwuMNs//s/cBRfQDyo=; b=aFKkhb0zOYLoKakuDOZLAL/L+WcqBPY0cvKbowRECK7pLvYCl6WUIvQuvyK8FxoDOgHzgl Z32Us+rRNEW/KZfwIEeWoPWOwG5j/HqML8MuPKlxWGiSUlq/ZRpBPLmUPCyTjYf/KLe+6F fTvDosZy5AQbr4xNLy2h402NsKkFyw8= 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-685-s4F9LCzBMr-2KdEAy6nH0g-1; Fri, 15 May 2026 12:38:57 -0400 X-MC-Unique: s4F9LCzBMr-2KdEAy6nH0g-1 X-Mimecast-MFC-AGG-ID: s4F9LCzBMr-2KdEAy6nH0g_1778863136 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-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id A106C180034E; Fri, 15 May 2026 16:38:56 +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 2F97D1955F2D; Fri, 15 May 2026 16:38:54 +0000 (UTC) From: Guinevere Larsen To: gdb-patches@sourceware.org Cc: Guinevere Larsen , Thiago Jung Bauermann Subject: [PATCH v3 2/7] gdb/record: remove record_full_insn_num Date: Fri, 15 May 2026 13:36:59 -0300 Message-ID: <20260515163706.3355686-3-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: ZKHA4GnUT1GG7wgHpuqhqh7fSeqJjG8_2jqJjlGgPk4_1778863136 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 02a57726a95..e4dd07dc300 100644 --- a/gdb/record-full.c +++ b/gdb/record-full.c @@ -193,8 +193,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; @@ -462,7 +460,6 @@ record_full_entry_cleanup (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; @@ -504,9 +501,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) @@ -606,7 +601,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) @@ -688,10 +683,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 @@ -1468,10 +1461,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. */ @@ -1572,10 +1563,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, @@ -1813,8 +1802,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")); @@ -2296,8 +2285,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) @@ -2338,9 +2325,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); } @@ -2595,14 +2582,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.54.0