From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id o16QMMvAu2pGrRcAWB0awg (envelope-from ) for ; Tue, 29 Sep 2026 09:44:43 -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=d86j5aIc; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id B123D1E06B; Tue, 29 Sep 2026 09:44:43 -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 896371E01F for ; Tue, 29 Sep 2026 09:44:42 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8DC2D4BA79BE for ; Tue, 29 Sep 2026 13:44:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8DC2D4BA79BE 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=d86j5aIc 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 2E9B84BA2E37 for ; Tue, 29 Sep 2026 13:44:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2E9B84BA2E37 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 2E9B84BA2E37 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=1790689451; cv=none; b=tIKRuTMnevAebatpgeA0eoloXqUmEr2R0ukeobg+tcTCsQxy7UZ1YEpao787ul5hZSXq03g8VcY+FDAOLlcrvZinsQKBfm2pZbazQL0Q8qqBMujQO3AIYoo0Cvaq3arlCpzevfUdeb3RPa0wKhW4ukIUGTMZJ/OVbQ59zYTcKAo= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1790689451; c=relaxed/simple; bh=bPbvicl6lD1+pwgBfAr/fj0NC65c4jwm01OfRHPHaxA=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=jaK/EQGlPlgNEVHkvSnGyNwXEXLuOQ4u07SLChytK2w8wzdc9gcZzy9dFiJ6MsgxSk1BRZpSeYbUVz6xPBgYsP8hWIYszkM5XrNNullls7JMsdnZYFdpyp/w9UGJ88WjnCzOzKqeUrNs/MtR9KGOR4DuQwTUbEJJ7TSYqPJ0yBo= 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=d86j5aIc DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2E9B84BA2E37 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1790689448; 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=3+HaZLUEZwh5F7axhj5ltONLCRA1DjrOZbAL///0L7o=; b=d86j5aIc6KYYqICuiCHnz6WvVmFrKH5WBkk6qM/YTRISHtu44daltoFVuKOYMMwsQCqKuW 4HZplLWGtvObohdyM2MLdLUOw7SE6P1/6DVuYCqG0mdK0O4OM+caB33zbYKylB4QHBeAgq YQ9EQXimiTfgJ0RjPqq7R9jOqM2SwHs= Received: from mail-vk1-f198.google.com (mail-vk1-f198.google.com [209.85.221.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-632-kdthABTNOz6LugGn4lU9uw-1; Tue, 29 Sep 2026 09:44:07 -0400 X-MC-Unique: kdthABTNOz6LugGn4lU9uw-1 X-Mimecast-MFC-AGG-ID: kdthABTNOz6LugGn4lU9uw_1790689447 Received: by mail-vk1-f198.google.com with SMTP id 71dfb90a1353d-5c82ad4977dso4791604e0c.2 for ; Tue, 29 Sep 2026 06:44:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790689447; x=1791294247; 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=3+HaZLUEZwh5F7axhj5ltONLCRA1DjrOZbAL///0L7o=; b=r1cxkwqkvTScCTzlmowCNR4Rxd+1yvgZtcT019uCrVyg6Yq8QfTT7HNfYm2dztq7cl keI5vPA1eP+xCFe4Z92Dt2evceLhgMtlxD96sXTJJgevpcFQrYwKP/WlK7C2Hi+yDWS/ 79ndO/55UNzK73Vaf9Jzqe0XRsXtoNzywjQSAHzsIQp/Wt6PJaudL/vp9wFWKbBO4xmV 23Fmvz3FCdI42e7BsrPzO/dW1Er64FD2iOO83QEYXUcGR/HgOP51v+Y+sj2JhbYqUsa8 EEeLP1GbcRkIyahs7oEOqlBOqxaS+dfesSmBSS2WGjxLap030yDrW8u5WIfFvn0UULll OAZw== X-Forwarded-Encrypted: i=1; AKwUvBx7PoY8AI4MIe+Mi+Hz/3dJ9KQZz81IpJS05AVpYuP73SIz0DRX7BY7R7Wsd8MEZC/XXutt3SAdvhhXKQ==@sourceware.org X-Gm-Message-State: AFq9FYLUoJxCzh3G/5GGLJg2wxkRqhK05RbRVxjC/HayjREtiWrNCP4U 0lACTjdKLKBSYUYbyItgr7C5hZ7X99K5LMU65/Wwa5cbkajJNRLWjgMFnWdkzJR6IaaE8N+BiXY EJVj2RsHV3KumIpLhoeQBnxHhDeAFw74xZi8ZVRr5bRZwD8R76TTsOpx1wVJf998= X-Gm-Gg: AYBFou1BfUczOfEo73Zgx28pvH5PAMyLQki01BwTkzFIQkFxAweutLQpWtWtrekzF7J HCDbTsa8DmSmYlSpG8xfh6CnaX9jzv0pCP0K7adYdMQWPuHWE544/oFBRZK+s2sVRTTuIT2XkoP 29UwImroR8mTR4h65Dbj+STC/peA9CjWBM7pOrzC3Jr7CQSZP/stmsq3xuS9J0ORQgWv8S5oMHe J7w33IZYg32BY9kcCnuk1zfz9hQ0YLNyM3je80Vm+7iSxJeCKEhWAT+GprfgPRPylDNlm2qseqw ZyS23dJ3D4nJ47HDEistCoyYscHdg3Wx6cEZBwqjrFR0ANs/f1VTyYAcet3gec826TMmTrWcHos bhjmb0AtLt/rg6btexMAxBXySr3cVwlfdlpQEy4YbdV814k4d X-Received: by 2002:a05:6122:6d10:b0:5d2:f636:7577 with SMTP id 71dfb90a1353d-5d2f6367964mr465299e0c.9.1790689446821; Tue, 29 Sep 2026 06:44:06 -0700 (PDT) X-Received: by 2002:a05:6122:6d10:b0:5d2:f636:7577 with SMTP id 71dfb90a1353d-5d2f6367964mr465292e0c.9.1790689446312; Tue, 29 Sep 2026 06:44:06 -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-5cde6159d60sm12556137e0c.13.2026.09.29.06.44.04 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 29 Sep 2026 06:44:05 -0700 (PDT) Message-ID: <15fb5e35-fd04-4d2c-836a-468507a9542e@redhat.com> Date: Tue, 29 Sep 2026 10:44:03 -0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2] gdb/record: fix missing "no history" message in some situations To: Andrew Burgess , gdb-patches@sourceware.org References: <20260908205344.95713-1-guinevere@redhat.com> <87bj9h16hq.fsf@redhat.com> From: Guinevere Larsen In-Reply-To: <87bj9h16hq.fsf@redhat.com> X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: cETj34tussJ-eKTbF0KcJzFc4sQLz_5Lp6PuEM7D55w_1790689447 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 On 9/28/26 5:11 PM, Andrew Burgess wrote: > Guinevere Larsen writes: > >> 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. > This sentence seem hard to parse. You initially seem to be talking > about replaying, so forward execution, but then finish by talking about > reverse execution. Replaying is not only forward execution, it can also refer to executing backwards. That word is used to mean "we are using the recorded instruction log to pretend the inferior has moved, as opposed to actually executing" The message was missing for both replay directions, and could only be printed in backwards replaying. > >> Executing forward past the end will not warn the user that >> recording is going to start again, it just does so. This is the > Maybe I'm not understanding, but ... are your examples below switched > around? The "before the change" text DOES warn when reaching the last > location going forward, while the "after the change" text does not. The > "before" behaviour seems to be more inline with what you say your change > delivers. Yes, the examples are swapped around, thanks for catching that. >> 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. > Typo: dont -> don't Fixed > >> --- >> 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; >> + > Please delete this blank line. Fixed >> + 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 */ > The 'END OF MAIN' marker is not used and can be removed. Fixed > >> +} >> 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. > Probably need to update this copyright date. Fixed > > With the nits fixed this change looks fine. It's just the commit > message which to me seems to be the reverse of the change. I'll give some time before pushing, so that you have time to respond to the confusion at the start before I push it. > > Thanks, > Andrew -- Cheers, Guinevere Larsen it/its she/her (deprecated)