]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb, btrace: fix pr19340
authorMarkus Metzger <markus.t.metzger@intel.com>
Tue, 20 Feb 2024 11:45:39 +0000 (11:45 +0000)
committerMarkus Metzger <markus.t.metzger@intel.com>
Mon, 26 May 2025 07:01:14 +0000 (07:01 +0000)
GDB fails with an assertion when stopping recording on a replaying thread
and then resuming that thread.  Stopping recording left the thread
replaying but the record target is gone.

Stop replaying all threads in the selected inferior before stopping recording.

I had to change the stepping test slightly to account for different
compilers generating slightly different debug information, so when
stepping the 'return 0' after 'record stop' I would end up in a different
location depending on which compiler I used.  The test still covers all
stepping commands.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=19340

gdb/record-btrace.c
gdb/testsuite/gdb.btrace/step.exp

index 19cd576d0c3b9d169aa260d08e397576bb9709b6..98bb17dea53d17b146e942c265e5335a15c2d668 100644 (file)
@@ -413,6 +413,7 @@ record_btrace_target::stop_recording ()
 {
   DEBUG ("stop recording");
 
+  record_stop_replaying ();
   record_btrace_auto_disable ();
 
   for (thread_info *tp : current_inferior ()->non_exited_threads ())
index 7852d65524a996a19007e1e26e79a8f8c8cabe4f..2c46c76f872e0a7107b10f5c3039a9d6e3e20832 100644 (file)
@@ -28,21 +28,29 @@ if ![runto_main] {
     return -1
 }
 
-# trace the call to the test function
+# Trace the call to the test function.
 with_test_prefix "record" {
     gdb_test_no_output "record btrace"
-    gdb_test "next"
+    gdb_test "step"
+    gdb_test "next 2"
 }
 
-# let's step around a bit
+# Let's step around a bit.
 with_test_prefix "replay" {
-    gdb_test "reverse-next" ".*main\.2.*" "reverse-next.1"
+    gdb_test "reverse-finish" ".*main\.2.*" "reverse-finish.1"
     gdb_test "step" ".*fun4\.2.*" "step.1"
     gdb_test "next" ".*fun4\.3.*" "next.1"
     gdb_test "step" ".*fun2\.2.*" "step.2"
-    gdb_test "finish" ".*fun4\.4.*" "finish.1"
-    gdb_test "reverse-step" ".*fun2\.3.*" "reverse-step.1"
-    gdb_test "reverse-finish" ".*fun4\.3.*" "reverse-finish.1"
-    gdb_test "reverse-next" ".*fun4\.2.*" "reverse-next.2"
-    gdb_test "reverse-finish" ".*main\.2.*" "reverse-finish.2"
+    gdb_test "reverse-finish" ".*fun4\.3.*" "reverse-finish.2"
+    gdb_test "reverse-step" ".*fun1\.2.*" "reverse-step.1"
+    gdb_test "finish" ".*fun4\.3.*" "finish.1"
+    gdb_test "reverse-next" ".*fun4\.2.*" "reverse-next.1"
+    gdb_test "reverse-finish" ".*main\.2.*" "reverse-finish.3"
+}
+
+# Stop recording and try to step live (pr19340).
+with_test_prefix "live" {
+    gdb_test "record stop" "Process record is stopped.*"
+    gdb_test "reverse-next" "Target .* does not support this command.*"
+    gdb_test "step" ".*fun3\.2.*"
 }