From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id cdT1BmIlMGpPfggAWB0awg (envelope-from ) for ; Mon, 15 Jun 2026 12:16:34 -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=A87gLv09; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 174D31E098; Mon, 15 Jun 2026 12:16:34 -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 [IPv6:2620:52:6:3111::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 470DE1E070 for ; Mon, 15 Jun 2026 12:16:33 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A7E054B9DB6B for ; Mon, 15 Jun 2026 16:16:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A7E054B9DB6B 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=A87gLv09 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 487044B920BE for ; Mon, 15 Jun 2026 16:15:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 487044B920BE 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 487044B920BE 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=1781540141; cv=none; b=Jyu7X5wdvXC6yE4OMflgybaP0OZeFSf/KmlcE8ZkMbGKduboqHhpBWQUwO+H+FOAO5Os1rqFSfikCWcq7NprM/gGMuIYJWgYo8wHItwVl19WmQcl8PlIvqpZ4DxVLljG9/8ELj8/485IdurcD4euJFM0q5sHkLFRbxnuRa70lxU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1781540141; c=relaxed/simple; bh=6MMbgqEHIR+s/qJ5WK6XFxR824pFcVtvdiQcm5B3efk=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=Pi5gYGhxTcU66+9WWSJhQjAFNgoDyr7qI1ayaa2TM4sw+a0O6NsUKYzivr4WAKgoV+ltLicbv7XHX9z36wvJfEknHiK61KOrlY+AdMz1CIkLlTyb0YPir8/rLTPvnhyngPW4df73/DFO8lBqbSVaMsJSfb6nXCp9TPaE4UUrMRw= 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=A87gLv09 DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 487044B920BE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1781540140; 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=Gwg5JQZtSg0QyUOOJktrB2/KspMj3JHQuE15BsvUg9A=; b=A87gLv09gJHrqTW6DqS5vXQ4TK2fwTF0kqNCQGw/1P09Vu22BaHWgqlMRmDMB3Ovt8qQSv 2zwKnzcawg6xiQpy49whO4UFsXtGkOACMFgILARzQRVW+D6rHdle1SCLOwmsC0e2LTwzXS 9hW5qEJwirPANYbHw7lRxZ3sTVkPwUY= 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-470-PSZotwcYN9aN5BTsyB3TiA-1; Mon, 15 Jun 2026 12:15:39 -0400 X-MC-Unique: PSZotwcYN9aN5BTsyB3TiA-1 X-Mimecast-MFC-AGG-ID: PSZotwcYN9aN5BTsyB3TiA_1781540138 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-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 197181802664; Mon, 15 Jun 2026 16:15:38 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.96.134.37]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 0BA431955BCE; Mon, 15 Jun 2026 16:15:35 +0000 (UTC) From: Guinevere Larsen To: gdb-patches@sourceware.org Cc: Guinevere Larsen , Thiago Jung Bauermann , Christina Schimpe Subject: [PATCH v5 3/8] gdb/record: remove record_full_insn_num Date: Mon, 15 Jun 2026 13:14:55 -0300 Message-ID: <20260615161500.34181-4-guinevere@redhat.com> In-Reply-To: <20260615161500.34181-1-guinevere@redhat.com> References: <20260615161500.34181-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: o8rF9kNdChuOr4KpUM0Vnoy1uWDqfP_65D6q6VdVRHE_1781540138 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 Reviewed-By: Christina Schimpe --- 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 c2f18e85ca4..0f885f2315a 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; @@ -464,7 +462,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; @@ -511,9 +508,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) @@ -613,7 +608,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) @@ -695,10 +690,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 @@ -1478,10 +1471,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. */ @@ -1582,10 +1573,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, @@ -1823,8 +1812,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")); @@ -2305,8 +2294,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) @@ -2346,9 +2333,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); } @@ -2607,14 +2594,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