Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] gdb/record: fix missing "no history" message in some situations
@ 2026-09-08 13:14 Guinevere Larsen
  2026-09-08 15:18 ` Simon Marchi
  0 siblings, 1 reply; 3+ messages in thread
From: Guinevere Larsen @ 2026-09-08 13:14 UTC (permalink / raw)
  To: gdb-patches; +Cc: Guinevere Larsen

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-09-08 20:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-08 13:14 [PATCH] gdb/record: fix missing "no history" message in some situations Guinevere Larsen
2026-09-08 15:18 ` Simon Marchi
2026-09-08 20:55   ` Guinevere Larsen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox