From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 0bIjIwPKumqRgxMAWB0awg (envelope-from ) for ; Mon, 28 Sep 2026 16:11:47 -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=FjQpi9hV; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 7D6A81E06B; Mon, 28 Sep 2026 16:11:47 -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 80FB81E01F for ; Mon, 28 Sep 2026 16:11:46 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 113E54BAE7D0 for ; Mon, 28 Sep 2026 20:11:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 113E54BAE7D0 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=FjQpi9hV 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 2C4E84BA2E3F for ; Mon, 28 Sep 2026 20:11:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2C4E84BA2E3F 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 2C4E84BA2E3F 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=1790626279; cv=none; b=jCMMq5lZVvLA9lPHaZ7w77k/gKrlHU07RWA7nMo1eBOp68/cT51HoYHSeui8gyrmAsLH9EtpVdPn2HbiM9aE0M3UKVVTzeBvGZN5bVFmVpEglIoEtJgAiUaWnMbM92+9L4v9xk5I4Dw8TIOGdP03mcQFjRifc3nyx29BSxqSr4U= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1790626279; c=relaxed/simple; bh=HiLbAF5hi9ViosSj55w3rtZ2BekEUkYXyBAc0v5WzDM=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=fQlTEL5KHUFHHfPrMzNA/VE6uellclK+xWcrIBwqD0WwV94+xX8gcxQTyEuARpyxG7oTpKXnFOF/m99c8hrfK5s4yKvn2hlP8e5Y2gPNYneThMy43nBhfAsLTZ1Mq0Gu9HKLptpgP6OR4mivFCkDn3dehSCHp2/a2M4j85xvfPU= 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=FjQpi9hV DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2C4E84BA2E3F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1790626278; 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: in-reply-to:in-reply-to:references:references; bh=7tR3QMH1KpwdS5FpYaKwYy9z/btJ5C/AA/Bfzzahn3o=; b=FjQpi9hVexplWgH9odUTLKwjCdOzu6T0L/9kPnArDtn0MjdjEXGTZRLHR7kvwIenW2qpkk +J6LmDU5+aYNd3cbosN6M1rjAN1sgkBI7ahDbyOYSP/8OtjX/8LZ7RFavzz87CxwGtYn8V 5UQiEE67q1iH8tnYo5Y53kjQTHIUfxc= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-52-SwWRulHnOaqALFrYthlA5w-1; Mon, 28 Sep 2026 16:11:17 -0400 X-MC-Unique: SwWRulHnOaqALFrYthlA5w-1 X-Mimecast-MFC-AGG-ID: SwWRulHnOaqALFrYthlA5w_1790626276 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-4994d67d0e3so25144565e9.2 for ; Mon, 28 Sep 2026 13:11:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790626276; x=1791231076; h=content-type:mime-version:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to:content-type; bh=7tR3QMH1KpwdS5FpYaKwYy9z/btJ5C/AA/Bfzzahn3o=; b=oB2/WcGQUcXFNBJfcKrLtCFWa7Y5RfatrU2uXKtDTBOJPBabR7nDw2FVwm4RONgI+Z 5uC8ko1TtljX+08kmczl3AbZ69s5MjKnlwHLGUHiMYWyfmRzyS+yTWeNzWcMWhAaXbV+ svzna+RUjF3peLtpDknNF55W1qIS2kub8QikHOOFx0XmDtxzceY14AAH4dmDyuxiniW2 Ps1pTLEKiZcAizfprQAd87vUJ6u8ZGY33EncY4r3rrtVCa2RGiywS81FTjbE/fW38kUj AhfZggzEEmqoIxunZGFczdU/ltAw1y/NljLdL6EGgyo7udJW/Z0hPoyz9bJeIfGMjOIM rKgg== X-Forwarded-Encrypted: i=1; AKwUvBxbaWlOI0TmO9IbIY781rXLKFOf3H+Q7/CPwoVn9dc/lhz1PRz7AL3X+ntuJ/phGcP3+1FT/Bp8hryoDA==@sourceware.org X-Gm-Message-State: AFuF++lr0wmyCmR/OdEa9hhYSpDNtXXrCwLHf+UJu3atfiedech3GdB9 7Ga4sWlB1Z/xgYq/I3TZ1Hhk6XG1NA+QwvY8N3Q0ou81S6hFsmDjUnmfeWoSmgpH71foas2VW2y ObDlsW1KTWYFc0y1ClgwkmPd4QaTVy/rE+5B8PSqc9jtrS0ImTWm3szw53HNxox4= X-Gm-Gg: AYBFou1R/UA5euKYV7rL4sew/jUwy/mlpv7PJ92Rz5fCHgQpqFd+REJBdDgG8JUsuqV LKIKSNbn3DqpwxUN0GZmRmjvU+3KNuyyZbrdUwzleNAfeFkAhw5UXZYqha2CxKKCrUWjFWntdnc UVdTSbGy/HMRo1tuA4Ht1XNMbhxfJmk/K7kRZS/ztX5q39XF0t50PtK9IJbscC08f+gRPfidxNJ mboPOsjZEAV/C6eSxhsYLQQ8Vk9R+adNa3Q62/Yojxcb7jqu8PkTPz5ysbP9sKFGxxnjjbvwsSB at3igRM7+EM1O06gRonxCB/kBqqWAkDVwHYbZ0tyQXfBYrtxK9aTRMhbgGF8jBP47H1I X-Received: by 2002:a05:600c:34d4:b0:499:79b9:e220 with SMTP id 5b1f17b1804b1-49fe66d1279mr214217665e9.10.1790626275849; Mon, 28 Sep 2026 13:11:15 -0700 (PDT) X-Received: by 2002:a05:600c:34d4:b0:499:79b9:e220 with SMTP id 5b1f17b1804b1-49fe66d1279mr214217425e9.10.1790626275325; Mon, 28 Sep 2026 13:11:15 -0700 (PDT) Received: from localhost ([213.31.44.29]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4a00d0f68basm16499365e9.12.2026.09.28.13.11.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Sep 2026 13:11:14 -0700 (PDT) From: Andrew Burgess To: Guinevere Larsen , gdb-patches@sourceware.org Cc: Guinevere Larsen Subject: Re: [PATCH v2] gdb/record: fix missing "no history" message in some situations In-Reply-To: <20260908205344.95713-1-guinevere@redhat.com> References: <20260908205344.95713-1-guinevere@redhat.com> Date: Mon, 28 Sep 2026 21:11:13 +0100 Message-ID: <87bj9h16hq.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: qv2R1Y2o_ahg5Lq_Ngr2zAhIc6MlYZyAZXPbuwfklck_1790626276 X-Mimecast-Originator: redhat.com Content-Type: text/plain 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 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. > 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. > 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 > --- > 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. > + 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. > +} > 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. 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. Thanks, Andrew