Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Guinevere Larsen <guinevere@redhat.com>
To: gdb-patches@sourceware.org
Cc: Guinevere Larsen <guinevere@redhat.com>
Subject: [PATCH] gdb/record: fix missing "no history" message in some situations
Date: Tue,  8 Sep 2026 10:14:00 -0300	[thread overview]
Message-ID: <20260908131400.28513-1-guinevere@redhat.com> (raw)

I recently noticed that the end of recoded history message wasn't
shown when replaying an inferior until end 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 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.
---
 gdb/record-full.c | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/gdb/record-full.c b/gdb/record-full.c
index 26bd85d34f6..c02bc39f12c 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
+
+	      else 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;
-		}
 
 	      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.  */

base-commit: 0ca0b8de31ec76ff71f4a051db3dc1fcc9325154
-- 
2.55.0


             reply	other threads:[~2026-09-08 13:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-08 13:14 Guinevere Larsen [this message]
2026-09-08 15:18 ` Simon Marchi
2026-09-08 20:55   ` Guinevere Larsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260908131400.28513-1-guinevere@redhat.com \
    --to=guinevere@redhat.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox