From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id J8W0B8BP42qWMAcAWB0awg (envelope-from ) for ; Thu, 29 Oct 2026 09:53: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=hZbS5+UU; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 0B62D1E06B; Thu, 29 Oct 2026 09:53: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=-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 068841E023 for ; Thu, 29 Oct 2026 09:53:03 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 894EB4BA7995 for ; Thu, 29 Oct 2026 13:53:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 894EB4BA7995 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=hZbS5+UU 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 C7F124BA2E1C for ; Thu, 29 Oct 2026 13:51:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C7F124BA2E1C 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 C7F124BA2E1C 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=1793281899; cv=none; b=ll4Nexxb3ChxPAFVKA4uhrTITR/4EXF4/bl/gQPXdwmQLMVrJMAJc7FJKX7XX5oxYQl3WRqFqJ0xhu5nyWwQr45rXnOSJomRE/QULgh4PyqL7gm0yw6EnlKpwuakIwKsn3wwYHumpXM2/ewhJ/Pa/fa/6uczMVYxqiHWdA6FtMo= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1793281899; c=relaxed/simple; bh=5N+HfOEIPKuT6UQxycVTmmZAMfKGwmvz9tBxZnb8Cas=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=f7XRKNL32s5g8cFSazuVoSFH2Uz2f52yZtXXQP7MLP90G/XWH//CUrkajzpf35xinNE1Sx3kepYhhXepkNATHd0Fj8NTC14oFKF0JNnkrN6fpgrT0G8LJJp2+i7fdM9AC4vpYUH8nmbmiJmgL5NqBh/JtOcitEm8BJxTYbOPwYc= 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=hZbS5+UU DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C7F124BA2E1C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1793281899; 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=d9DfJR5Uks+7s1zFPTY/RcqrqUdxjMq+VbR9idxXSAU=; b=hZbS5+UUMHQwJP3L7oIUBgBjlYoafTdLHeZCdi3G6pa/JpUz0xphcG7yYXFEPsDT0AqBuA qK0UIkAtLFojMxjwqrf2HR7c7KGYZ45dCiq4uOqeb6xKs61SHxJhlVpmW8Ek/2Me1ZKrf6 9ze2TyfTP5mTeD7zdLY9inx0uRcaBYM= Received: from mail-yw1-f200.google.com (mail-yw1-f200.google.com [209.85.128.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-661-6sZ9cKHbN2W-eZ78mlxD7A-1; Thu, 29 Oct 2026 09:51:38 -0400 X-MC-Unique: 6sZ9cKHbN2W-eZ78mlxD7A-1 X-Mimecast-MFC-AGG-ID: 6sZ9cKHbN2W-eZ78mlxD7A_1793281897 Received: by mail-yw1-f200.google.com with SMTP id 00721157ae682-8b18c67095dso31715997b3.2 for ; Thu, 29 Oct 2026 06:51:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1793281897; x=1793886697; 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=d9DfJR5Uks+7s1zFPTY/RcqrqUdxjMq+VbR9idxXSAU=; b=2HQZqbffFeK/toVSHw/88DBISqkoJWCmX1PXBY8URQYezhl/95Ai0J/5UD+crHE6on dySyfIE6zXY4DbCVEEpwQZOJdkDfwLGVI5Hym2nhbe55m1xAHgF4/9NuToZnv/s9TFy0 F/lIev6ST3ctdYiOcQ/zriv5McWmG5tnd1Gxwj5u7KhAfZvjTdsjLWASskdlZjl61LDs J4H9EpkahjBJP0PsCowOv21mhYj4ghb1gwX2Z3TFGWTZRoDHnuKrphWLqHvWkJuunUlX TQcTqN9/Z92bZoJfVjXjUvNcxoBZHHXHQCo7t4RFgUgxQIh7bhl0G6iWnfzn0vbctR4l yD/A== X-Gm-Message-State: AFq9FYKjs52yGwrHw6aRJcA1G69zwVydkOpgslyoa/6bhw7hEp1P5ai6 R5O7uBgy00vcMDjuM9FBWdH22cHzBAmzutvshZH/JSvcNBrxrYx0cN9PXmH47DaVtQQJr2/BRcS WB7DVBxByY/S4QtYnggaWh7QSHAvNjPAx4DrmZeb2WimkztkD4O09AqCp8J6RopQ/GOaLpSzRtP tQDP8yUda0gqeG1jOt7gQEuucpKGgTDhewvpRGI/s28E0OoMEt X-Gm-Gg: AYBFou0U+zehyf8B4NGNcwTBXzfTi2Gi+0GFCqIYgUukAVYdZJkN6A9+z9VRu1b1Hk5 Hp4DgWpNOCigZNiFgOUaMhmfaDcZRdj93G3gLxLqEDoygYIO+pOck1k5KdgMw5nM2GYM/dAGdNc SimR+MwdcAuj+fr8LT8ZWiygV/F2F3kBAKgpKREnyioVqx476KPW1YoYpApAnWTRjd+uN3ds3sc sZ5UhMjJRhls5hV9/rJ40Z6sgcYptn9pxlG4k6n+87t8af792cCCSyH/C9fT8VnEIzDR5lR2rU5 GRJEHG7edtSWn4hW+juj9Bmv/rf2a5Up4EICd9O4ORKAaLTGfVFQHy5Zq6bPyun92RHgWXwMlup hDgbiT4GQmb4KjROY5F60S39L8Ao50rZXh+PnyJ2BJMW4PPKrnJ1Bb9Q/Iaqc2vypLiL9MOk3XA 9mk8J8e4ANcRedS9xjeVmGiA== X-Received: by 2002:a05:690c:a855:20b0:8ab:3d1d:af0f with SMTP id 00721157ae682-8b1b5d16d93mr29283827b3.44.1793281897374; Thu, 29 Oct 2026 06:51:37 -0700 (PDT) X-Received: by 2002:a05:690c:a855:20b0:8ab:3d1d:af0f with SMTP id 00721157ae682-8b1b5d16d93mr29283717b3.44.1793281896577; Thu, 29 Oct 2026 06:51:36 -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 00721157ae682-8b19e5c7d50sm43793427b3.30.2026.10.29.06.51.34 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 29 Oct 2026 06:51:35 -0700 (PDT) Message-ID: <26ca93f6-a237-47ee-be03-3b4003cf995b@redhat.com> Date: Thu, 29 Oct 2026 10:51:33 -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 References: <20261019185640.2520434-2-guinevere@redhat.com> From: Guinevere Larsen In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 2cjGiu8lDBHyUb8MdPBsSwpVEFKxUqiSJO1TWg1KYUQ_1793281897 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit 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 I have pushed this patch. Let me know if this causes any further issues, and I'll be happy to fix them On 10/26/26 3:38 PM, Guinevere Larsen wrote: > 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)