From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id ORoAKxcdtWopvjwAWB0awg (envelope-from ) for ; Thu, 24 Sep 2026 08:52:39 -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=D4OLASFS; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id AC2151E01F; Thu, 24 Sep 2026 08:52:39 -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 AC3D61E01F for ; Thu, 24 Sep 2026 08:52:38 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 473D84BB588A for ; Thu, 24 Sep 2026 12:52:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 473D84BB588A 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=D4OLASFS 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 AFBDE4BB1C1B for ; Thu, 24 Sep 2026 12:52:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AFBDE4BB1C1B 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 AFBDE4BB1C1B 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=1790254332; cv=none; b=LhvdyVZeAldyPP5V57pK4eFou7j0u+xOfgLfJy2+1JIhCsRcTEjDl3saI4BCDQjZJcL2lQn17EKxw5ip6F40xCPQFXbBkfHB8Cup7mCbHYyiJBKDfwf4O6d4zlioIGh84Br5Xb60+uA48vi+aNkx4yym1uIUjFKOU2rEt1Nz1e0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1790254332; c=relaxed/simple; bh=VHrggEK07A3JpM7iEhu7/3JTbEg/LZa9CyI3cIsS4kk=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=joOOqLkBhygCRyrhq8tCVYHe6thOm277EvU6LKoYaUeKe6v2/lLIQNvrGY+8DkkizCvS3NfkEf5sVUiwcaIF6Rpo/tSVHkFFLR2e4W4jK1JfUqb/sL451fYl2M2e+3Im7mXgAR/eH2Db+XXstTbGNLacJ4TJmnawHrk+nVKwo/g= 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=D4OLASFS DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AFBDE4BB1C1B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1790254332; 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=75qEMca6XkvMfKcFSG0+8qZXgEe4Z/UYMuN66uBnp3g=; b=D4OLASFSEmvmukFS2mES0KNa9MVI/+SkEzzFhylyps8Vcj/u6h/BRFVnxD0NSmRxz48dHA AoWZ43hQljqnnjO3M4KHLu0PnigkR9G64W5D5GAlVNBEl0+ZCKtamY3exDQ/bTFwR3k7P4 W+dEWqDsAiloklhkTBYkBFvEFuTQ36A= Received: from mail-oo1-f69.google.com (mail-oo1-f69.google.com [209.85.161.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-375-qvKZVBOLMomIH0V_ZzOqXQ-1; Thu, 24 Sep 2026 08:52:10 -0400 X-MC-Unique: qvKZVBOLMomIH0V_ZzOqXQ-1 X-Mimecast-MFC-AGG-ID: qvKZVBOLMomIH0V_ZzOqXQ_1790254329 Received: by mail-oo1-f69.google.com with SMTP id 006d021491bc7-6c1b24c4d0bso2538866eaf.1 for ; Thu, 24 Sep 2026 05:52:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790254329; x=1790859129; 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=75qEMca6XkvMfKcFSG0+8qZXgEe4Z/UYMuN66uBnp3g=; b=PATunKwi9IHzF9Xmm7km6sN8ONQlAsxlsw1faqHNP6UGLUGzr6WpuzKW700rKkOTjw aJI4mvmg0zdw+gG6nfNmszFVmEAht9IKvoze5+wJ+cTmp/hy7UaMa2qgNQV5aiyG9r73 ioSXpC24WnFlXhN5zgUC/E7bc4znBjrqZo/puIa/VczemCp1cY6T/XIxN3jiN4xvdEuJ byCt357PG4Jzj74ZWssbxbqcnkEJvZTdQwLvGsatH6wlmDcbOO8q3jDKG42s3xSJEYTD gawtdgiXfyI0k7KhVyZ7ReCm8Oz8BOu6DESdYLrF7r3rLqon/4/Pghgzc1S+Ac0kdm/3 u6Pg== X-Gm-Message-State: AFuF++kQs9PBpqH9bT8PNl0HKiX5kgYJyTV6plPDvE2M8LMnWZtH1vUi 1QYlYi8fozDXYkHvdWltYOGJdVPdzMqSo9bsKDafekB6/nzlswUJa5O7LblNjWTOKF64Ma2YgB5 pUkxQ6mEXqftvfv9xWFi33ijUToyd9eH7iKcWpSSodOKfAC4azkmK0Qe9QSwT7xDIaXwz9EBfY0 Zuy/p9Z6VNHEFmfGCzYxlyYURA/OEbk6ENV9pos/atqufN1GNb X-Gm-Gg: AYBFou0zWXMg4o41f1mYf9vfKHHTdouv/7PLhqcFh2AbQxiQt1kGy810VbKPI+dXYxk ahWtTiCqSYPac7X8kpEfMQj5RSGkHF/99epCHz7xKnF4dOQg2kiLi/drOz4Ad/J5Peg8Ja/ByLd K7wE5jpB97Ry3am1SPmcnHJpRkuHYiXON3FIGcA/G+x1FjzL9wYqjt0pR8DSEhUM/tbULvamtP0 7+B94GWvUIMDy8aGcS37x7xZ244z2qZm+jUnZXsIuWGaeiwaVCdlNMipGm/7Enyyti3P4h9OpVA eBE+3IdyBVlz52rQACLYHHZWDIcOnB1vfgl/31vh6GRi8k2z1KK+5S59+Wsv98aqI0WqGpJlx9H Q7bdFGtilF9IuNabN2mTiz0Bs0w623I7aU/iK0j3iz9SSC9j+ X-Received: by 2002:a05:6820:1688:b0:6cd:3fcc:96ce with SMTP id 006d021491bc7-6d440b0b15dmr2219073eaf.76.1790254329138; Thu, 24 Sep 2026 05:52:09 -0700 (PDT) X-Received: by 2002:a05:6820:1688:b0:6cd:3fcc:96ce with SMTP id 006d021491bc7-6d440b0b15dmr2219048eaf.76.1790254328396; Thu, 24 Sep 2026 05:52:08 -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 006d021491bc7-6d2cee6919fsm5003866eaf.9.2026.09.24.05.52.04 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 24 Sep 2026 05:52:06 -0700 (PDT) Message-ID: <3b277d88-0eb9-40e2-890c-44cb6135148d@redhat.com> Date: Thu, 24 Sep 2026 09:52:03 -0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PING][PATCH v2] gdb/record: fix missing "no history" message in some situations To: gdb-patches@sourceware.org, guinevere@redhat.com References: <20260908205344.95713-1-guinevere@redhat.com> From: Guinevere Larsen In-Reply-To: <20260908205344.95713-1-guinevere@redhat.com> X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: lb9rj0PrLdnKFLDNuOBy0_2HsW5awaSas1vJQI_bilY_1790254329 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! I plan on pushing this change next week if there's no comments On 9/8/26 5:53 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 > > 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) > > 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 > 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; > > 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 dont regress again. > --- > gdb/record-full.c | 22 +++++-------- > gdb/testsuite/gdb.reverse/no-history.c | 26 +++++++++++++++ > gdb/testsuite/gdb.reverse/no-history.exp | 40 ++++++++++++++++++++++++ > 3 files changed, 74 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 26bd85d34f6..e9ec65b161b 100644 > --- a/gdb/record-full.c > +++ b/gdb/record-full.c > @@ -1362,19 +1362,11 @@ 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 +1416,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..4e7cf3786fd > --- /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; /* END OF MAIN */ > +} > diff --git a/gdb/testsuite/gdb.reverse/no-history.exp b/gdb/testsuite/gdb.reverse/no-history.exp > new file mode 100644 > index 00000000000..443d3b66497 > --- /dev/null > +++ b/gdb/testsuite/gdb.reverse/no-history.exp > @@ -0,0 +1,40 @@ > +# Copyright 2008-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: 0ca0b8de31ec76ff71f4a051db3dc1fcc9325154 -- Cheers, Guinevere Larsen it/its she/her (deprecated)