From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id jeVBJC2e32oCkh8AWB0awg (envelope-from ) for ; Mon, 26 Oct 2026 14:38:37 -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=ERMBFvkT; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 572D41E023; Mon, 26 Oct 2026 14:38:37 -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 400C81E023 for ; Mon, 26 Oct 2026 14:38:35 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id AF9AA4BA2E38 for ; Mon, 26 Oct 2026 18:38:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AF9AA4BA2E38 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=ERMBFvkT 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 EF66F4BA5434 for ; Mon, 26 Oct 2026 18:38:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EF66F4BA5434 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 EF66F4BA5434 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=1793039888; cv=none; b=OX/1tosKrFZmWHC78u94ZgQ5UAPCT+PxBH3/bZeRrP2kJkq569SxY40YNzZTEZGqb8haAqetlucTk8pEbO9ChSoCi0OQz1oVQomp6boMgHvw1X787WnejTwA6DLAUI6JIlPygEDiQSyNcdgbDMgxqn4lsbP3qDh/qcixwfY9CVs= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1793039888; c=relaxed/simple; bh=MYLGlMMbc6PN+TILQHUXs44Tv9J86ZCNXXf9R6zxvR4=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=sUmP3uGi2WMIkLJ5FQUmUeoGGxVnce6l2z2yzzDx2GoaCZBhgzAm0VWdxnPLbCZprmwhfVmMdi7LyHWAtVRtbsXgdIHkRf8ZevJ6g5HDu/Sy6Y8JioMvWMjLv0qoGpAgW9VHxrIjq2zpEyH0GUHQyj49I8HA/qoeQ/Jfd9pIFF8= 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=ERMBFvkT DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EF66F4BA5434 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1793039887; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CV2W3aemwyTA2Yit+j4UuwpXy12ubCJIrlQAeaKYjJA=; b=ERMBFvkTt/e/nP3jKq3+8aaq87rpfXiQbYU5JueOYkE5sOMEuF/qJ/CuLkIKs8KX+5aYMv pYfakfSzAFIWpp+IkshpzGgz2ZqZXwBK3xfFnQcHJQ4+OQP0HvUxPqzvyplzNlfyBDvlJf 6a1qteuRfOqP6EdbRe0QwaWydyQ/xDw= Received: from mail-vk1-f200.google.com (mail-vk1-f200.google.com [209.85.221.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-194--m1IxQUyO4iUrUzwbIyDdw-1; Mon, 26 Oct 2026 14:38:04 -0400 X-MC-Unique: -m1IxQUyO4iUrUzwbIyDdw-1 X-Mimecast-MFC-AGG-ID: -m1IxQUyO4iUrUzwbIyDdw_1793039884 Received: by mail-vk1-f200.google.com with SMTP id 71dfb90a1353d-5eabedcf97fso588833e0c.2 for ; Mon, 26 Oct 2026 11:38:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1793039884; x=1793644684; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:to:subject:user-agent:mime-version:date :message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=CV2W3aemwyTA2Yit+j4UuwpXy12ubCJIrlQAeaKYjJA=; b=Eh4yJckbAXDD/VmwQOJXhbxNf5TVKRp7OGZ4uvOvyOihI4rymeyZqyPWZAHfjKTz48 bihQ6gTHTDS5+w8uwEEtlQEkRjtidQrqgccMWpAhEDytSVqAoZAKzVh9YHki5tgdjJO5 8AzLEe0udbZxKQHOIHOThu5pfCAqWh6u9zwImnalp+VWEK350bnyulk7Ex5jf/EHikfo eqQ7aqotALerHBwHITR8eb9OcGIfcLwWDsljXhAmr+fI6N2oacNaT45IrUuPX7zM4M+I MoVV31/2mgFehoVe//95+EtH63zWBR7o44q+EOOejSoUNxOSttRERrBSrp8dfM1X6cWv F5LQ== X-Gm-Message-State: AFq9FYLGzHYcAZcXAxo2FFQbm64RsGA3L4pnPWejAAcRnq8hvQUrg4KS FPmRj/G8msbfBFnCSHNxZwHQUpURX4fgVjBLdh406uBf0QO/0FvT8IvfVS2j7EGN8aVYQ64MjR0 lo1umACaQvJrwfst2T03niBOZklsms9WUN6TFF+raXPdbRaprDmCfLpcVxzLNQXQ+M++Zgod9Iz 1kSGcIfciBhNxRog/ssvEi17mvLYBcfezyz4I4gfVMMT6krU3l X-Gm-Gg: AYBFou1t4n8QLXJDjnAVk+leobKDm5pnQJrbuj1lGQ/4AuzGtRktNHqzzNGCRnnqFh8 fnKeHyUIGmiZRh5HzhuMVoGmpMbxLVGEZgb3Cfxucbitd+DZDVVCMCZmJvpIEOSbKXsxJUD83Po 0xPVnt3q7Yl3SH2mRBQPOJBz+JFSn2yOvN8dxww+dYM/54WkTeFuowykcGj/Lyk6qwUpOx8GdQj tWD1jCnQ8g9VUaIkjW+fWCIYtSriTtV2l35yXGJuQkOW7PBbavtDC7nV9Rsb9SprKuhHvDp8mqh SOKzSaBv/aDvAswUuA86rPA02xeOKM/7PWPIXDo/5dS/STshoWV2WNP2CbN+yKmI+BhYmk75DyR ye9SXRaCrZFtfpk8K9M3BK8Nc9BJBPRWG4mHwVKD9J1bZw9fd X-Received: by 2002:a05:6122:2883:b0:5ea:c9ab:bd86 with SMTP id 71dfb90a1353d-5ec23319bfemr2843815e0c.21.1793039884065; Mon, 26 Oct 2026 11:38:04 -0700 (PDT) X-Received: by 2002:a05:6122:2883:b0:5ea:c9ab:bd86 with SMTP id 71dfb90a1353d-5ec23319bfemr2843798e0c.21.1793039883423; Mon, 26 Oct 2026 11:38:03 -0700 (PDT) Received: from ?IPV6:2804:14d:8084:993e:22e8:4ed1:527a:55c0? ([2804:14d:8084:993e:22e8:4ed1:527a:55c0]) by smtp.gmail.com with ESMTPSA id 71dfb90a1353d-5ec23067632sm9095219e0c.0.2026.10.26.11.38.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 26 Oct 2026 11:38:02 -0700 (PDT) Message-ID: Date: Mon, 26 Oct 2026 15:38:00 -0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3] gdb/record: fix missing "no history" message in some situations To: gdb-patches@sourceware.org, guinevere@redhat.com References: <20261019185640.2520434-2-guinevere@redhat.com> From: Guinevere Larsen In-Reply-To: <20261019185640.2520434-2-guinevere@redhat.com> X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: UXx5IYtfilXwqrclS8YX2P_9EjtFu8YGVcLJHpeMfoo_1793039884 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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 Ping! If there are no further feedbacks on this, I plan to push this series early thursday. On 10/19/26 3:56 PM, Guinevere Larsen wrote: > I recently noticed that the end of recorded history message wasn't > shown when replaying an inferior until the end for the first time, it > was only shown when trying to reverse past the start of > history. Executing forward past the end will not warn the user that > recording is going to start again, it just does so. This is the > behavior before the change: > > (gdb) start > Temporary breakpoint 1 at 0x40044a: file t.c, line 2. > Starting program: /home/glarsen/a.out > [Thread debugging using libthread_db enabled] > Using host libthread_db library "/lib64/libthread_db.so.1". > > Temporary breakpoint 1, main () at t.c:2 > 2 int x = 0; > (gdb) record > (gdb) n > 3 x ++; > (gdb) rn > 2 int x = 0; > (gdb) rn > > Reached end of recorded history; stopping. > Backward execution from here not possible. > main () at t.c:2 > 2 int x = 0; > (gdb) n > 3 x ++; > (gdb) n > 4 return x; > > And this is the behavior after the change: > > (gdb) start > Temporary breakpoint 1 at 0x40044a: file t.c, line 2. > Starting program: /home/glarsen/a.out > [Thread debugging using libthread_db enabled] > Using host libthread_db library "/lib64/libthread_db.so.1". > > Temporary breakpoint 1, main () at t.c:2 > 2 int x = 0; > (gdb) record > (gdb) n > 3 x ++; > (gdb) rn > > Reached end of recorded history; stopping. > Backward execution from here not possible. > main () at t.c:2 > 2 int x = 0; > (gdb) n > > Reached end of recorded history; stopping. > Following forward execution will be added to history. > main () at t.c:3 > 3 x ++; > (gdb) > > This was happening because the out-of-history was only set when it > caused the execution loop to stop, so using "next" to reach the end of > history, for example, wouldn't trigger it as I expected. This commit > fixes that to make out-of-history check only happen after the loop is > finished. > > Also add a test to ensure we don't regress again. > --- > > I seem to have forgotten to send or push this patch. I've fixed all comments from Andrew on v2, but seeing as it's been a while and he never replied with an explicit ok for pushing, I figure it's safer to send a v3, just to be sure. > > --- > gdb/record-full.c | 21 +++++-------- > gdb/testsuite/gdb.reverse/no-history.c | 26 +++++++++++++++ > gdb/testsuite/gdb.reverse/no-history.exp | 40 ++++++++++++++++++++++++ > 3 files changed, 73 insertions(+), 14 deletions(-) > create mode 100644 gdb/testsuite/gdb.reverse/no-history.c > create mode 100644 gdb/testsuite/gdb.reverse/no-history.exp > > diff --git a/gdb/record-full.c b/gdb/record-full.c > index 50da022bb52..7b1d64069c7 100644 > --- a/gdb/record-full.c > +++ b/gdb/record-full.c > @@ -1362,19 +1362,10 @@ record_full_wait_1 (struct target_ops *ops, > /* Check for beginning and end of log. */ > if (execution_direction == EXEC_REVERSE > && record_full_next_insn < 0) > - { > - /* Hit beginning of record log in reverse. */ > - status->set_no_history (); > - record_full_next_insn = 0; > - break; > - } > - if (execution_direction != EXEC_REVERSE > - && record_full_next_insn == record_full_log.size ()) > - { > - /* Hit end of record log going forward. */ > - status->set_no_history (); > - break; > - } > + break; > + else if (execution_direction != EXEC_REVERSE > + && record_full_next_insn == record_full_log.size ()) > + break; > > record_full_log[record_full_next_insn].exec_insn (regcache); > > @@ -1424,11 +1415,13 @@ record_full_wait_1 (struct target_ops *ops, > { > gdb_assert (execution_direction == EXEC_REVERSE); > record_full_next_insn = 0; > + status->set_no_history (); > } > - else if (record_full_next_insn > record_full_log.size ()) > + else if (record_full_next_insn >= record_full_log.size ()) > { > gdb_assert (execution_direction == EXEC_FORWARD); > record_full_next_insn = record_full_log.size (); > + status->set_no_history (); > } > /* Reset the current instruction to point to the one to be replayed > moving forward. */ > diff --git a/gdb/testsuite/gdb.reverse/no-history.c b/gdb/testsuite/gdb.reverse/no-history.c > new file mode 100644 > index 00000000000..cb23e3b397e > --- /dev/null > +++ b/gdb/testsuite/gdb.reverse/no-history.c > @@ -0,0 +1,26 @@ > +/* This testcase is part of GDB, the GNU debugger. > + > + Copyright 2026 Free Software Foundation, Inc. > + > + This program is free software; you can redistribute it and/or modify > + it under the terms of the GNU General Public License as published by > + the Free Software Foundation; either version 3 of the License, or > + (at your option) any later version. > + > + This program is distributed in the hope that it will be useful, > + but WITHOUT ANY WARRANTY; without even the implied warranty of > + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > + GNU General Public License for more details. > + > + You should have received a copy of the GNU General Public License > + along with this program. If not, see . */ > + > +/* Test that GDB is printing the no-history messages as it should. */ > + > +int > +main () > +{ > + int x = 0; > + x++; > + return 0; > +} > diff --git a/gdb/testsuite/gdb.reverse/no-history.exp b/gdb/testsuite/gdb.reverse/no-history.exp > new file mode 100644 > index 00000000000..264ca7f84bf > --- /dev/null > +++ b/gdb/testsuite/gdb.reverse/no-history.exp > @@ -0,0 +1,40 @@ > +# Copyright 2026 Free Software Foundation, Inc. > + > +# This program is free software; you can redistribute it and/or modify > +# it under the terms of the GNU General Public License as published by > +# the Free Software Foundation; either version 3 of the License, or > +# (at your option) any later version. > +# > +# This program is distributed in the hope that it will be useful, > +# but WITHOUT ANY WARRANTY; without even the implied warranty of > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > +# GNU General Public License for more details. > +# > +# You should have received a copy of the GNU General Public License > +# along with this program. If not, see . */ > + > +# This file is part of the GDB testsuite. It tests the printing of > +# the "out of history" warnings. > + > +require supports_reverse > + > +standard_testfile > + > +if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } { > + return > +} > + > +runto_main > + > +if {[supports_process_record]} { > + # Activate process record/replay > + gdb_test_no_output "record" "turn on process record" > +} > + > +gdb_test "next" "x\\\+\\\+;" "Record a line of execution" > +gdb_test "reverse-next" \ > + ".*Reached end of recorded history; stopping.*" \ > + "Reverse to start of history" > +gdb_test "next" \ > + ".*Reached end of recorded history; stopping.*" \ > + "Forward to end of history" > > base-commit: 91dc787c65d9f5f9aba59bcadbee8c3d14a53236 -- Cheers, Guinevere Larsen it/its she/her (deprecated)