]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Change message when reaching end of reverse history.
authorGuinevere Larsen <blarsen@redhat.com>
Mon, 26 Aug 2024 13:33:17 +0000 (10:33 -0300)
committerGuinevere Larsen <blarsen@redhat.com>
Mon, 26 Aug 2024 13:33:57 +0000 (10:33 -0300)
In a record session, when we move backward, GDB switches from normal
execution to simulation. Moving forward again, the emulation continues
until the end of the reverse history. When the end is reached, the
execution stops, and a warning message is shown. This message has been
modified to indicate that the forward emulation has reached the end, but
the execution can continue as normal, and the recording will also continue.

Before this patch, the warning message shown in that case was the same as
in the reverse case. This meant that when the end of history was reached in
either backward or forward emulation, the same message was displayed:

"No more reverse-execution history."

This message has changed for these two cases. Backward emulation:

"Reached end of recorded history; stopping.
Backward execution from here not possible."

Forward emulation:

"Reached end of recorded history; stopping.
Following forward execution will be added to history."

The reason for this change is that the initial message was deceiving, for
the forward case, making the user believe that forward debugging could not
continue.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31224
Reviewed-By: Markus T. Metzger <markus.t.metzger@intel.com> (btrace)
Approved-By: Guinevere Larsen <blarsen@redhat.com>
12 files changed:
gdb/NEWS
gdb/infrun.c
gdb/testsuite/gdb.btrace/multi-thread-step.exp
gdb/testsuite/gdb.btrace/nohist.exp
gdb/testsuite/gdb.btrace/non-stop.exp
gdb/testsuite/gdb.btrace/stepi.exp
gdb/testsuite/gdb.reverse/break-precsave.exp
gdb/testsuite/gdb.reverse/break-reverse.exp
gdb/testsuite/gdb.reverse/machinestate-precsave.exp
gdb/testsuite/gdb.reverse/sigall-precsave.exp
gdb/testsuite/gdb.reverse/sigall-reverse.exp
gdb/testsuite/gdb.reverse/singlejmp-reverse.exp

index 81aa8af233862fd462f134b3169e293b71e2694a..6bded319161dd5cdd729dc63d3bdb1c2a278ea4d 100644 (file)
--- a/gdb/NEWS
+++ b/gdb/NEWS
 * Remove support (native and remote) for QNX Neutrino (triplet
   `i[3456]86-*-nto*`).
 
+* In a record session, when a forward emulation reaches the end of the reverse
+  history, the warning message has been changed to indicate that the end of the
+  history has been reached.  It also specifies that the forward execution can
+  continue, and the recording will also continue.
+
 *** Changes in GDB 15
 
 * The MPX commands "show/set mpx bound" have been deprecated, as Intel
index f2d28cacd1ac8e0dfd1627193f672c881b5488ef..4ca15450afe0344f9acf97ca73dcf837879650e3 100644 (file)
@@ -9267,8 +9267,15 @@ print_no_history_reason (struct ui_out *uiout)
 {
   if (uiout->is_mi_like_p ())
     uiout->field_string ("reason", async_reason_lookup (EXEC_ASYNC_NO_HISTORY));
+  else if (execution_direction == EXEC_FORWARD)
+    uiout->text ("\nReached end of recorded history; stopping.\nFollowing "
+                "forward execution will be added to history.\n");
   else
-    uiout->text ("\nNo more reverse-execution history.\n");
+    {
+      gdb_assert (execution_direction == EXEC_REVERSE);
+      uiout->text ("\nReached end of recorded history; stopping.\nBackward "
+                  "execution from here not possible.\n");
+    }
 }
 
 /* Print current location without a level number, if we have changed
index 154db9ae5157c089ad8909083fd35d8ff7d80f88..cd20e8ad9f02b344afdab6e64253a91d75aadb88 100644 (file)
@@ -111,14 +111,14 @@ proc test_cont {} {
     with_test_prefix "cont" {
         gdb_test "thread 1" ".*"
         with_test_prefix "thread 1" {
-            gdb_test "continue" "No more reverse-execution history.*"
+            gdb_test "continue" "Reached end of recorded history.*"
 
             check_not_replaying 1
             check_replay_insn 2 2
         }
         gdb_test "thread 2" ".*"
         with_test_prefix "thread 2" {
-            gdb_test "continue" "No more reverse-execution history.*"
+            gdb_test "continue" "Reached end of recorded history.*"
 
             check_not_replaying 1
             check_not_replaying 2
@@ -128,7 +128,7 @@ proc test_cont {} {
 
 proc test_cont_all {} {
     with_test_prefix "cont-all" {
-        gdb_test "continue" "No more reverse-execution history.*"
+        gdb_test "continue" "Reached end of recorded history.*"
 
         # this works because we're lock-stepping threads that executed exactly
         # the same code starting from the same instruction.
index d71909181c4359a9e093e0e0eb7be824cc4de658..ac6a41c63e4342c793343e5f591d8520a729a1bf 100644 (file)
@@ -42,7 +42,7 @@ with_test_prefix "forward" {
     check_not_replaying
 }
 
-gdb_test "reverse-continue" "No more reverse-execution history\.\r\n.*"
+gdb_test "reverse-continue" "Reached end of recorded history; stopping.*"
 
 with_test_prefix "backward" {
     check_not_replaying
index 62c940e4cd612d5d3f499cbdadcff3e23d0e54a5..5e43545f6a97b131b6aee7f88bb121f609e478b6 100644 (file)
@@ -79,16 +79,26 @@ proc gdb_cont_to_bp_line { line threads nthreads } {
         $nthreads
 }
 
-proc gdb_cont_to_no_history { threads cmd nthreads } {
+proc gdb_cont_to_no_history_backward { threads cmd nthreads } {
     gdb_cont_to $threads $cmd \
         [multi_line \
-             "No more reverse-execution history\." \
+             "Reached end of recorded.*Backward execution.*" \
              "\[^\\\r\\\n\]*" \
              "\[^\\\r\\\n\]*" \
             ] \
         $nthreads
 }
 
+proc gdb_cont_to_no_history_forward { threads cmd nthreads } {
+    gdb_cont_to $threads $cmd \
+       [multi_line \
+            "Reached end of recorded.*Following forward.*" \
+            "\[^\\\r\\\n\]*" \
+            "\[^\\\r\\\n\]*" \
+           ] \
+       $nthreads
+}
+
 # trace the code between the two breakpoints
 with_test_prefix "prepare" {
     gdb_cont_to_bp_line "$srcfile:$bp_1" all 2
@@ -176,14 +186,14 @@ with_test_prefix "reverse-step" {
 with_test_prefix "continue" {
     with_test_prefix "thread 1" {
        with_test_prefix "continue" {
-           gdb_cont_to_no_history 1 "continue" 1
+           gdb_cont_to_no_history_forward 1 "continue" 1
            gdb_test "thread apply 1 info record" \
                ".*Recorded \[0-9\]+ instructions \[^\\\r\\\n\]*"
            gdb_test "thread apply 2 info record" \
                ".*Replay in progress\.  At instruction 5\."
        }
        with_test_prefix "reverse-continue" {
-           gdb_cont_to_no_history 1 "reverse-continue" 1
+           gdb_cont_to_no_history_backward 1 "reverse-continue" 1
            gdb_test "thread apply 1 info record" \
                ".*Replay in progress\.  At instruction 1\."
            gdb_test "thread apply 2 info record" \
@@ -193,14 +203,14 @@ with_test_prefix "continue" {
 
     with_test_prefix "thread 2" {
        with_test_prefix "continue" {
-           gdb_cont_to_no_history 2 "continue" 1
+           gdb_cont_to_no_history_forward 2 "continue" 1
            gdb_test "thread apply 1 info record" \
                ".*Replay in progress\.  At instruction 1\."
            gdb_test "thread apply 2 info record" \
                ".*Recorded \[0-9\]+ instructions \[^\\\r\\\n\]*"
        }
        with_test_prefix "reverse-continue" {
-           gdb_cont_to_no_history 2 "reverse-continue" 1
+           gdb_cont_to_no_history_backward 2 "reverse-continue" 1
            gdb_test "thread apply 1 info record" \
                ".*Replay in progress\.  At instruction 1\."
            gdb_test "thread apply 2 info record" \
@@ -215,8 +225,8 @@ with_test_prefix "no progress" {
         gdb_test "thread apply 1 record goto end" ".*"
         gdb_test "thread apply 2 record goto begin" ".*"
 
-        gdb_cont_to_no_history 1 "continue" 1
-        gdb_cont_to_no_history 1 "step" 1
+        gdb_cont_to_no_history_forward 1 "continue" 1
+        gdb_cont_to_no_history_forward 1 "step" 1
         gdb_test "thread apply 1 info record" \
             ".*Recorded \[0-9\]+ instructions \[^\\\r\\\n\]*"
         gdb_test "thread apply 2 info record" \
@@ -227,8 +237,8 @@ with_test_prefix "no progress" {
         gdb_test "thread apply 1 record goto begin" ".*"
         gdb_test "thread apply 2 record goto end" ".*"
 
-        gdb_cont_to_no_history 2 "continue" 1
-        gdb_cont_to_no_history 2 "step" 1
+        gdb_cont_to_no_history_forward 2 "continue" 1
+        gdb_cont_to_no_history_forward 2 "step" 1
         gdb_test "thread apply 1 info record" \
             ".*Replay in progress\.  At instruction 1\."
         gdb_test "thread apply 2 info record" \
@@ -238,7 +248,7 @@ with_test_prefix "no progress" {
     with_test_prefix "all" {
         gdb_test "thread apply all record goto begin" ".*"
 
-        gdb_cont_to_no_history all "continue" 2
+        gdb_cont_to_no_history_forward all "continue" 2
         gdb_test "thread apply 1 info record" \
             ".*Recorded \[0-9\]+ instructions \[^\\\r\\\n\]*"
         gdb_test "thread apply 2 info record" \
index a70a5adf0460eb8800cfedb4bb77f3c41fb75902..689bc792b24a6ac2ea438d152c44616cf596ed04 100644 (file)
@@ -100,7 +100,7 @@ with_test_prefix "reverse-nexti.1" {
 # we can't reverse-nexti any further
 with_test_prefix "reverse-nexti.2" {
     gdb_test "reverse-nexti" \
-       "No more reverse-execution history\.\r\n.*main\.2.*" \
+       "Reached end of recorded history; stopping\.\r\n.*main\.2.*" \
        "reverse-nexti.2"
     check_replay_at 1
 }
@@ -140,20 +140,20 @@ with_test_prefix "goto begin" {
 
     with_test_prefix "reverse-stepi" {
        gdb_test "reverse-stepi" \
-           "No more reverse-execution history\.\r\n.*main\.2.*" \
+           "Reached end of recorded history; stopping\.\r\n.*main\.2.*" \
            "reverse-stepi.1"
        gdb_test "reverse-stepi" \
-           "No more reverse-execution history\.\r\n.*main\.2.*" \
+           "Reached end of recorded history; stopping\.\r\n.*main\.2.*" \
            "reverse-stepi.2"
        check_replay_at 1
     }
 
     with_test_prefix "reverse-nexti" {
        gdb_test "reverse-nexti" \
-           "No more reverse-execution history\.\r\n.*main\.2.*" \
+           "Reached end of recorded history; stopping\.\r\n.*main\.2.*" \
            "reverse-nexti.1"
        gdb_test "reverse-nexti" \
-           "No more reverse-execution history\.\r\n.*main\.2.*" \
+           "Reached end of recorded history; stopping\.\r\n.*main\.2.*" \
            "reverse-nexti.2"
        check_replay_at 1
     }
@@ -169,10 +169,10 @@ with_test_prefix "goto begin" {
 with_test_prefix "reverse-stepi" {
     gdb_test "reverse-stepi" ".*main\.2.*" "reverse-stepi.1"
     gdb_test "reverse-stepi" \
-       "No more reverse-execution history\.\r\n.*main\.2.*" \
+       "Reached end of recorded history; stopping\.\r\n.*main\.2.*" \
        "reverse-stepi.2"
     gdb_test "reverse-stepi" \
-       "No more reverse-execution history\.\r\n.*main\.2.*" \
+       "Reached end of recorded history; stopping\.\r\n.*main\.2.*" \
        "reverse-stepi.3"
     check_replay_at 1
 }
index b9d94681247b53f2c46b6fc2f51ee6ce8a4f0ea4..6d9b312185f89c2ea269b1525037ce1dda5f164c 100644 (file)
@@ -73,7 +73,7 @@ proc precsave_tests {} {
        -re ".*Breakpoint $decimal,.*$srcfile:$end_location.*$gdb_prompt $"  {
            pass "go to end of main forward"
        }
-       -re "No more reverse-execution history.* end of main .*$gdb_prompt $" {
+       -re -wrap "Reached end of recorded.*Following forward.* end of main .*" {
            pass "go to end of main forward"
        }
     }
@@ -87,7 +87,7 @@ proc precsave_tests {} {
        -re ".*Breakpoint $decimal,.*$srcfile:$main_location.*$gdb_prompt $" {
            pass "main backward"
        }
-       -re "No more reverse-execution history.* break in main .*$gdb_prompt $" {
+       -re -wrap "Reached end of recorded.*Backward execution.* break in main .*" {
            pass "main backward"
        }
     }
@@ -103,7 +103,7 @@ proc precsave_tests {} {
        -re ".*Breakpoint $decimal,.*$srcfile:$end_location.*$gdb_prompt $" {
            pass "end of record log"
        }
-       -re "No more reverse-execution history.* end of main .*$gdb_prompt $" {
+       -re -wrap "Reached end of recorded.*Following forward.* end of main .*" {
            pass "end of record log"
        }
     }
index 1dd327ca654a723a1000147e3b33e0905c80d969..66e9712707f00866ad68ed82ab3154f1b2f580c8 100644 (file)
@@ -64,7 +64,7 @@ gdb_test_multiple "continue" "main backward" {
     -re ".*Breakpoint $decimal,.*$srcfile:$main_location.*$gdb_prompt $" {
        pass "main backward"
     }
-    -re "No more reverse-execution history.* break in main .*$gdb_prompt $" {
+    -re -wrap "Reached end of recorded history.*Backward execution.*" {
        pass "main backward"
     }
 }
@@ -80,7 +80,7 @@ gdb_test_multiple "continue" "end of record log" {
     -re ".*Breakpoint $decimal,.*$srcfile:$end_location.*$gdb_prompt $" {
        pass "end of record log"
     }
-    -re "No more reverse-execution history.* end of main .*$gdb_prompt $" {
+    -re -wrap "Reached end of recorded history.*Following forward.*" {
        pass "end of record log"
     }
 }
index 19c5934bfdf45003dfdd5aa17e0dce98b59642fa..cedca0f9b6582b4b5bb854dff0d91ba552fcbb2e 100644 (file)
@@ -85,7 +85,7 @@ gdb_test_multiple "continue" "go to end of main forward" {
     -re ".*Breakpoint $decimal,.*$srcfile:$endmain.*$gdb_prompt $"  {
        pass "go to end of main forward"
     }
-    -re "No more reverse-execution history.* end main .*$gdb_prompt $" {
+    -re -wrap "Reached end of recorded history.*Following forward.*" {
        pass "go to end of main forward"
     }
 }
index e5890ad7af764e97aab1f5f822445b968af1d8d8..aab4551c87453a3e8a27d2ac8a7b504ecaaaac1f 100644 (file)
@@ -128,7 +128,7 @@ proc test_one_sig_reverse {prevsig} {
                xfail "$testmsg (handled)"
            }
        }
-       -re "No more reverse-execution history.*kill.*$gdb_prompt " {
+       -re "Reached end of recorded history.*Backward execution.*kill.*$gdb_prompt " {
            if {$saw_signal} {
                pass "$testmsg (handled)"
            } else {
index f2cf55b8ae44c0d1068d083f57447d33fc34f451..884b178f9ee0a880a955ba6e3feae9a9e3b923d6 100644 (file)
@@ -134,7 +134,7 @@ proc test_one_sig_reverse {prevsig} {
                xfail "$testmsg (handled)"
            }
        }
-       -re "No more reverse-execution history.*kill.*$gdb_prompt " {
+       -re "Reached end of recorded.*Backward execution.*kill.*$gdb_prompt " {
            if {$saw_signal} {
                pass "$testmsg (handled)"
            } else {
index 971d88b5ce655b571796251a5728240b4f14d005..7392356451432937759b9326829c0062a7164fd8 100644 (file)
@@ -50,11 +50,13 @@ gdb_test "next" {nodebug \(\);} "next to nodebug"
 gdb_test "next" {v = 3;} "next to v = 3"
 
 # FAIL was:
-# No more reverse-execution history.
+# Reached end of recorded history; stopping.
+# Backward execution from here not possible.
 # {
 gdb_test "reverse-step" {nodebug \(\);}
 
 # FAIL was:
-# No more reverse-execution history.
+# Reached end of recorded history; stopping.
+# Backward execution from here not possible.
 # {
 gdb_test "reverse-next" {f \(\);}