From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id CWr7FDTg32k4GxoAWB0awg (envelope-from ) for ; Wed, 15 Apr 2026 15:00:04 -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=JQUDwwer; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 4D2111E0C3; Wed, 15 Apr 2026 15:00:04 -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 691671E04F for ; Wed, 15 Apr 2026 15:00:02 -0400 (EDT) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id 16A6A4BA23DB for ; Wed, 15 Apr 2026 19:00:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 16A6A4BA23DB 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=JQUDwwer 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 D3A334BA23C3 for ; Wed, 15 Apr 2026 18:59:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D3A334BA23C3 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 D3A334BA23C3 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=1776279553; cv=none; b=TREavSAiLce+MTYZqH7LUui6tDM4KuzkUM66cyPwyzuPP8YfAH1MH5JvoPlhK3xWni+uAMDH2le76TnVhnFFHzGTdO/oG8DJl9hNXvNVr/jxdtIVhal1VMPF8fw/7Cgn7qcJqxCLaHb3YeXlZKODf5DmW+lspQh9J3yXtPqLVsY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776279553; c=relaxed/simple; bh=rA0QjGcDDiUnvg4tCjs+/zSSQMJ9EZQhBKqI7QfcsFU=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=RrjmhArf+Y0zJCReX56tIk2s0JsHBOIeBMhJG1GS+17Hgepe6N8ct964F57fpnZt6isD58MCY8cBOY/XyGB0BHZmWCZu3c6fWKYTCszURQgU2VduM9Mm0iP4J8V8TMikqUVKycnpQAsloyWu4UxAXeZmhvQrjNRTDeVM0Amyp2E= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D3A334BA23C3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1776279553; 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=bAb3LWCwCKKgdW/WUHolBgpiJC/icjxAxYpg6tMWYLk=; b=JQUDwwer6tEJM59NUcpFCbmlxOietbJVk5wIHbAQ8wOaDxQeYQoBJYxYBJJ18622pHNYZs S84RQqLl2hfUfT+9sYNzBKCNh8KMkBH5DUdvvV5+TF9NMnXH7l8vMSZAaSM5qsc4F0v4Gg vIU0qUXw7VZtLWUEju8RSLftjI9C8Zc= 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-634-RWv32rNROt6JGSC_5xmAhg-1; Wed, 15 Apr 2026 14:59:12 -0400 X-MC-Unique: RWv32rNROt6JGSC_5xmAhg-1 X-Mimecast-MFC-AGG-ID: RWv32rNROt6JGSC_5xmAhg_1776279551 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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 938CE1956088 for ; Wed, 15 Apr 2026 18:59:11 +0000 (UTC) Received: from fedora.tailb97d54.ts.net (unknown [10.96.134.153]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 95E7130001A4; Wed, 15 Apr 2026 18:59:09 +0000 (UTC) From: Guinevere Larsen To: gdb-patches@sourceware.org Cc: Guinevere Larsen Subject: [PATCH 2/6] gdb/record: remove record_full_insn_num Date: Wed, 15 Apr 2026 15:58:32 -0300 Message-ID: <20260415185836.2732968-3-guinevere@redhat.com> In-Reply-To: <20260415185836.2732968-1-guinevere@redhat.com> References: <20260415185836.2732968-1-guinevere@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: AcIUtt4q8GAHgQR7qRssh7DUhy23FOPb4J7WEMN60Uw_1776279551 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. --- 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 c9757464bb9..95776679f21 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; @@ -460,7 +458,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; @@ -498,9 +495,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) @@ -600,7 +595,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) @@ -682,10 +677,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 @@ -1449,10 +1442,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. */ @@ -1553,10 +1544,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, @@ -1791,8 +1780,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")); @@ -2276,8 +2265,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 { @@ -2321,9 +2308,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); } @@ -2584,14 +2571,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