public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH v5 0/4] PR gdb/31353
@ 2024-04-10  7:46 Markus Metzger
  2024-04-10  7:46 ` [PATCH v5 1/4] gdb, infrun, btrace: fix reverse/replay stepping at end of execution history Markus Metzger
                   ` (6 more replies)
  0 siblings, 7 replies; 16+ messages in thread
From: Markus Metzger @ 2024-04-10  7:46 UTC (permalink / raw)
  To: gdb-patches; +Cc: pedro

Reviving an old patch series that was first submitted in Jan'21.

It fixes issues with breakpoints at the end of the execution history,
including PR gdb/31353, which was submitted in the meantime.

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

Guinevere Larsen reviewed most of the series and reported an issue with
applying the last patch.  I'm resending the series, rebased on current
master, to hopefully fix that issue.

The only change to v4 is that a redundant forward declaration was removed.

The changes are mostly in infrun and require global maintainer approval.

Markus Metzger (4):
  gdb, infrun, btrace: fix reverse/replay stepping at end of execution
    history
  gdb, infrun, record: fix hang when step-over fails with no-history
  gdb, infrun, record: move no-history notification into normal_stop
  gdb, infrun: fix multi-threaded reverse stepping

 gdb/gdbthread.h                               | 13 +++
 gdb/infrun.c                                  | 86 +++++++++++++-----
 gdb/infrun.h                                  |  7 --
 gdb/record-btrace.c                           | 19 ++--
 gdb/testsuite/gdb.btrace/cont-hang.exp        | 43 +++++++++
 .../gdb.btrace/implicit-stop-replaying.exp    | 90 +++++++++++++++++++
 .../gdb.btrace/multi-thread-break-hang.exp    | 84 +++++++++++++++++
 gdb/testsuite/gdb.btrace/step-hang.exp        | 42 +++++++++
 gdb/testsuite/gdb.btrace/stepn.exp            | 50 +++++++++++
 9 files changed, 398 insertions(+), 36 deletions(-)
 create mode 100644 gdb/testsuite/gdb.btrace/cont-hang.exp
 create mode 100644 gdb/testsuite/gdb.btrace/implicit-stop-replaying.exp
 create mode 100644 gdb/testsuite/gdb.btrace/multi-thread-break-hang.exp
 create mode 100644 gdb/testsuite/gdb.btrace/step-hang.exp
 create mode 100644 gdb/testsuite/gdb.btrace/stepn.exp

-- 
2.34.1

Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de <http://www.intel.de>
Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva  
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928


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

* [PATCH v5 1/4] gdb, infrun, btrace: fix reverse/replay stepping at end of execution history
  2024-04-10  7:46 [PATCH v5 0/4] PR gdb/31353 Markus Metzger
@ 2024-04-10  7:46 ` Markus Metzger
  2024-04-10  7:46 ` [PATCH v5 2/4] gdb, infrun, record: fix hang when step-over fails with no-history Markus Metzger
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 16+ messages in thread
From: Markus Metzger @ 2024-04-10  7:46 UTC (permalink / raw)
  To: gdb-patches; +Cc: pedro, Guinevere Larsen

When trying to step over a breakpoint at the end of the trace, the
step-over will fail with no-history.  This does not clear step_over_info
so a subsequent resume will cause GDB to not resume the thread and expect
a SIGTRAP to complete the step-over.  This will never come causing GDB to
hang in the wait-for-event poll.

That step-over failed after actually completing the step.  This is wrong.
The step-over itself should have failed and the step should not have
completed.  Fix it by moving the end of execution history check to before
we are stepping.

This exposes another issue, however.  When completing a step-over at the
end of the execution history, we implicitly stop replaying that thread.  A
continue command would resume after the step-over and, since we're no
longer replaying, would continue recording.

Fix that by recording the replay state in the thread's control state and
failing with no-history in keep_going if we're switching from replay to
recording.

Reviewed-By: Guinevere Larsen <blarsen@redhat.com>
---
 gdb/gdbthread.h                        |  3 ++
 gdb/infrun.c                           | 25 +++++++++++++
 gdb/record-btrace.c                    | 19 +++++-----
 gdb/testsuite/gdb.btrace/cont-hang.exp | 43 ++++++++++++++++++++++
 gdb/testsuite/gdb.btrace/step-hang.exp | 42 ++++++++++++++++++++++
 gdb/testsuite/gdb.btrace/stepn.exp     | 50 ++++++++++++++++++++++++++
 6 files changed, 173 insertions(+), 9 deletions(-)
 create mode 100644 gdb/testsuite/gdb.btrace/cont-hang.exp
 create mode 100644 gdb/testsuite/gdb.btrace/step-hang.exp
 create mode 100644 gdb/testsuite/gdb.btrace/stepn.exp

diff --git a/gdb/gdbthread.h b/gdb/gdbthread.h
index 73f6895fe46..2d6b212cd32 100644
--- a/gdb/gdbthread.h
+++ b/gdb/gdbthread.h
@@ -176,6 +176,9 @@ struct thread_control_state
 
   /* True if the thread is evaluating a BP condition.  */
   bool in_cond_eval = false;
+
+  /* Whether the thread was replaying when the command was issued.  */
+  bool is_replaying = false;
 };
 
 /* Inferior thread specific part of `struct infcall_suspend_state'.  */
diff --git a/gdb/infrun.c b/gdb/infrun.c
index a5030b16376..05022b0d7bc 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -3096,6 +3096,8 @@ clear_proceed_status_thread (struct thread_info *tp)
 
   /* Discard any remaining commands or status from previous stop.  */
   bpstat_clear (&tp->control.stop_bpstat);
+
+  tp->control.is_replaying = target_record_is_replaying (tp->ptid);
 }
 
 /* Notify the current interpreter and observers that the target is about to
@@ -9009,6 +9011,29 @@ keep_going_pass_signal (struct execution_control_state *ecs)
   gdb_assert (ecs->event_thread->ptid == inferior_ptid);
   gdb_assert (!ecs->event_thread->resumed ());
 
+  /* When a thread reaches the end of its execution history, it automatically
+     stops replaying.  This is so the user doesn't need to explicitly stop it
+     with a separate command.
+
+     We do not want a single command (e.g. continue) to transition from
+     replaying to recording, though, e.g. when starting from a breakpoint we
+     needed to step over at the end of the trace.  When we reach the end of the
+     execution history during stepping, stop with no-history.
+
+     The other direction is fine.  When we're at the end of the execution
+     history, we may reverse-continue to start replaying.  */
+  if (ecs->event_thread->control.is_replaying
+      && !target_record_is_replaying (ecs->event_thread->ptid))
+    {
+      interps_notify_no_history ();
+      ecs->ws.set_no_history ();
+      set_last_target_status (ecs->target, ecs->ptid, ecs->ws);
+      stop_print_frame = true;
+      stop_waiting (ecs);
+      normal_stop ();
+      return;
+    }
+
   /* Save the pc before execution, to compare with pc after stop.  */
   ecs->event_thread->prev_pc
     = regcache_read_pc_protected (get_thread_regcache (ecs->event_thread));
diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c
index 0ef1dfbe652..c1bd2b4bc20 100644
--- a/gdb/record-btrace.c
+++ b/gdb/record-btrace.c
@@ -2339,6 +2339,16 @@ record_btrace_single_step_forward (struct thread_info *tp)
   if (replay == NULL)
     return btrace_step_no_history ();
 
+  /* The execution trace contains (and ends with) the current instruction.
+     This instruction has not been executed, yet, so the trace really ends
+     one instruction earlier.
+
+     We'd fail later on in btrace_insn_next () but we must not trigger
+     breakpoints as we're not really able to step.  */
+  btrace_insn_end (&end, btinfo);
+  if (btrace_insn_cmp (replay, &end) == 0)
+    return btrace_step_no_history ();
+
   /* Check if we're stepping a breakpoint.  */
   if (record_btrace_replay_at_breakpoint (tp))
     return btrace_step_stopped ();
@@ -2361,15 +2371,6 @@ record_btrace_single_step_forward (struct thread_info *tp)
     }
   while (btrace_insn_get (replay) == NULL);
 
-  /* Determine the end of the instruction trace.  */
-  btrace_insn_end (&end, btinfo);
-
-  /* The execution trace contains (and ends with) the current instruction.
-     This instruction has not been executed, yet, so the trace really ends
-     one instruction earlier.  */
-  if (btrace_insn_cmp (replay, &end) == 0)
-    return btrace_step_no_history ();
-
   return btrace_step_spurious ();
 }
 
diff --git a/gdb/testsuite/gdb.btrace/cont-hang.exp b/gdb/testsuite/gdb.btrace/cont-hang.exp
new file mode 100644
index 00000000000..cddcf68b3ab
--- /dev/null
+++ b/gdb/testsuite/gdb.btrace/cont-hang.exp
@@ -0,0 +1,43 @@
+# This testcase is part of GDB, the GNU debugger.
+#
+# Copyright 2024 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 <http://www.gnu.org/licenses/>.
+
+# Test that we do not hang when trying to continue over a breakpoint at
+# the end of the trace.
+
+require allow_btrace_tests
+
+standard_testfile record_goto.c
+if [prepare_for_testing "failed to prepare" $testfile $srcfile] {
+    return -1
+}
+
+if ![runto_main] {
+    return -1
+}
+
+# Trace the call to the test function.
+gdb_test_no_output "record btrace"
+gdb_test "next" "main\.3.*"
+
+# We need to be replaying, otherwise, we'd just continue recording.
+gdb_test "reverse-stepi"
+gdb_test "break"
+
+# Continuing will step over the breakpoint and then run into the end of
+# the execution history.  This ends replay, so we can continue recording.
+gdb_test "continue" "No more reverse-execution history.*"
+gdb_continue_to_end
diff --git a/gdb/testsuite/gdb.btrace/step-hang.exp b/gdb/testsuite/gdb.btrace/step-hang.exp
new file mode 100644
index 00000000000..91ea813955d
--- /dev/null
+++ b/gdb/testsuite/gdb.btrace/step-hang.exp
@@ -0,0 +1,42 @@
+# This testcase is part of GDB, the GNU debugger.
+#
+# Copyright 2024 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 <http://www.gnu.org/licenses/>.
+
+# Test that we do not hang when trying to step over a breakpoint at the
+# end of the trace.
+
+require allow_btrace_tests
+
+standard_testfile record_goto.c
+if [prepare_for_testing "failed to prepare" $testfile $srcfile] {
+    return -1
+}
+
+if ![runto_main] {
+    return -1
+}
+
+# Trace the call to the test function.
+gdb_test_no_output "record btrace"
+gdb_test "next" "main\.3.*"
+
+# We need to be replaying, otherwise, we'd just continue recording.
+gdb_test "reverse-stepi"
+gdb_test "break"
+
+# Stepping over the breakpoint ends replaying and we can continue recording.
+gdb_test "step"  "main\.3.*"
+gdb_continue_to_end
diff --git a/gdb/testsuite/gdb.btrace/stepn.exp b/gdb/testsuite/gdb.btrace/stepn.exp
new file mode 100644
index 00000000000..4aec90adc65
--- /dev/null
+++ b/gdb/testsuite/gdb.btrace/stepn.exp
@@ -0,0 +1,50 @@
+# This testcase is part of GDB, the GNU debugger.
+#
+# Copyright 2024 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 <http://www.gnu.org/licenses/>.
+
+# Test that step n does not start recording when issued while replaying.
+
+require allow_btrace_tests
+
+standard_testfile record_goto.c
+if [prepare_for_testing "failed to prepare" $testfile $srcfile] {
+    return -1
+}
+
+if ![runto_main] {
+    return -1
+}
+
+# Trace the call to the test function.
+gdb_test_no_output "record btrace"
+gdb_test "next" "main\.3.*"
+
+# Stepping should bring us to the end of the execution history, but should
+# not resume recording.
+with_test_prefix "stepi" {
+    gdb_test "reverse-stepi"
+    gdb_test "stepi 5" "No more reverse-execution history.*main\.3.*"
+}
+
+with_test_prefix "step" {
+    gdb_test "reverse-step"
+    gdb_test "step 5" "No more reverse-execution history.*main\.3.*"
+}
+
+with_test_prefix "next" {
+    gdb_test "reverse-next"
+    gdb_test "next 5" "No more reverse-execution history.*main\.3.*"
+}
-- 
2.34.1

Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de <http://www.intel.de>
Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva  
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928


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

* [PATCH v5 2/4] gdb, infrun, record: fix hang when step-over fails with no-history
  2024-04-10  7:46 [PATCH v5 0/4] PR gdb/31353 Markus Metzger
  2024-04-10  7:46 ` [PATCH v5 1/4] gdb, infrun, btrace: fix reverse/replay stepping at end of execution history Markus Metzger
@ 2024-04-10  7:46 ` Markus Metzger
  2024-04-10  7:46 ` [PATCH v5 3/4] gdb, infrun, record: move no-history notification into normal_stop Markus Metzger
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 16+ messages in thread
From: Markus Metzger @ 2024-04-10  7:46 UTC (permalink / raw)
  To: gdb-patches; +Cc: pedro, Guinevere Larsen

When trying to step over a breakpoint at the end of the trace while
another thread is replaying, the step-over will fail with no-history.
This does not clear step_over_info so a subsequent resume will cause GDB
to not resume the thread and expect a SIGTRAP to complete the step-over.
This will never come causing GDB to hang in the wait-for-event poll.

This is a variant of the issue fixed in the parent commit.  That commit
addressed the issue for a single-threaded process and fixed an issue with
reverse/replay stepping in general.

This commit addresses the issue for a multi-threaded process.  In this
case, the single-step does not complete.

Finish an in-flight step-over when a thread stopped with NO_HISTORY.
Since we did not move, we will simply start the step-over again.

Hannes Domani reported that this fixes PR gdb/31353.

Reviewed-By: Guinevere Larsen <blarsen@redhat.com>
---
 gdb/infrun.c                                  | 12 +++
 .../gdb.btrace/multi-thread-break-hang.exp    | 84 +++++++++++++++++++
 2 files changed, 96 insertions(+)
 create mode 100644 gdb/testsuite/gdb.btrace/multi-thread-break-hang.exp

diff --git a/gdb/infrun.c b/gdb/infrun.c
index 05022b0d7bc..cda9afc3dfb 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -77,6 +77,8 @@
 #include "disasm.h"
 #include "interps.h"
 
+struct execution_control_state;
+
 /* Prototypes for local functions */
 
 static void sig_print_info (enum gdb_signal);
@@ -6572,6 +6574,16 @@ handle_inferior_event (struct execution_control_state *ecs)
 	return;
 
       interps_notify_no_history ();
+
+      /* Cancel an in-flight step-over.  It will not succeed since we
+	 won't be able to step at the end of the execution history.  */
+      {
+	/* finish_step_over may call restart_threads, which may change the
+	   current thread.  make sure we leave the event thread as the
+	   current thread.  */
+	scoped_restore_current_thread restore_thread;
+	finish_step_over (ecs);
+      }
       stop_waiting (ecs);
       return;
     }
diff --git a/gdb/testsuite/gdb.btrace/multi-thread-break-hang.exp b/gdb/testsuite/gdb.btrace/multi-thread-break-hang.exp
new file mode 100644
index 00000000000..33edcf05612
--- /dev/null
+++ b/gdb/testsuite/gdb.btrace/multi-thread-break-hang.exp
@@ -0,0 +1,84 @@
+# This testcase is part of GDB, the GNU debugger.
+#
+# Copyright 2024 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 <http://www.gnu.org/licenses/>.
+
+# Test that we cancel an in-flight step-over at the end of the execution
+# history as long as some other thread is still replaying.
+#
+# This used to cause GDB to hang in poll ().
+
+require allow_btrace_tests
+
+standard_testfile multi-thread-step.c
+if [prepare_for_testing "failed to prepare" $testfile $srcfile {debug pthreads}] {
+    return -1
+}
+
+if ![runto_main] {
+    return -1
+}
+
+# Set up breakpoints.
+set bp_1 [gdb_get_line_number "bp.1" $srcfile]
+set bp_2 [gdb_get_line_number "bp.2" $srcfile]
+
+# Trace the code between the two breakpoints.
+gdb_breakpoint $srcfile:$bp_1
+gdb_continue_to_breakpoint "continue to bp.1" ".*$srcfile:$bp_1\r\n.*"
+
+gdb_test_no_output "record btrace"
+
+# We have two threads at or close to bp.1 but handled only one stop event.
+# Remove the breakpoint so we do not need to deal with the 2nd event.
+delete_breakpoints
+gdb_breakpoint $srcfile:$bp_2
+gdb_continue_to_breakpoint "continue to bp.2" ".*$srcfile:$bp_2\r\n.*"
+
+# Determine the thread that reported the breakpoint.
+set thread [get_integer_valueof "\$_thread" bad]
+
+# Determine the other thread.
+set other "bad"
+if { $thread == 1 } {
+    set other 2
+} elseif { $thread == 2 } {
+    set other 1
+}
+
+# This test requires scheduler-locking 'on' or 'step'; 'replay' would
+# implicitly stop replaying, avoiding the problem; 'off' would step one
+# and resume the other.
+#
+# With the current record-btrace implementation that steps all resumed
+# threads in lock-step, 'off' might actually pass but we don't want to
+# bake that behavior into tests.
+gdb_test_no_output "set scheduler-locking step"
+
+# Start replaying the other thread.  This will prevent stepping the thread
+# that reported the event.
+gdb_test "thread apply $other record goto begin"
+gdb_test "thread apply $other info record" "Replay in progress.*"
+
+# We're at a breakpoint so this triggers step-over.  Since we're at the
+# end of the trace, the step will fail.
+gdb_test "stepi" "No more reverse-execution history.*" "stepi.1"
+
+# We used to hang at the second step since step-over insisted on polling
+# the next event.
+gdb_test "stepi" "No more reverse-execution history.*" "stepi.2"
+
+# Do one more just in case.
+gdb_test "stepi" "No more reverse-execution history.*" "stepi.3"
-- 
2.34.1

Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de <http://www.intel.de>
Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva  
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928


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

* [PATCH v5 3/4] gdb, infrun, record: move no-history notification into normal_stop
  2024-04-10  7:46 [PATCH v5 0/4] PR gdb/31353 Markus Metzger
  2024-04-10  7:46 ` [PATCH v5 1/4] gdb, infrun, btrace: fix reverse/replay stepping at end of execution history Markus Metzger
  2024-04-10  7:46 ` [PATCH v5 2/4] gdb, infrun, record: fix hang when step-over fails with no-history Markus Metzger
@ 2024-04-10  7:46 ` Markus Metzger
  2024-04-10  7:46 ` [PATCH v5 4/4] gdb, infrun: fix multi-threaded reverse stepping Markus Metzger
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 16+ messages in thread
From: Markus Metzger @ 2024-04-10  7:46 UTC (permalink / raw)
  To: gdb-patches; +Cc: pedro, Guinevere Larsen

Leave calling gdb::observers::no_history.notify to normal_stop based on
the last waitstatus.

Reviewed-By: Guinevere Larsen <blarsen@redhat.com>
---
 gdb/infrun.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/gdb/infrun.c b/gdb/infrun.c
index cda9afc3dfb..d3738ebbd66 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -6573,8 +6573,6 @@ handle_inferior_event (struct execution_control_state *ecs)
       if (handle_stop_requested (ecs))
 	return;
 
-      interps_notify_no_history ();
-
       /* Cancel an in-flight step-over.  It will not succeed since we
 	 won't be able to step at the end of the execution history.  */
       {
@@ -9037,7 +9035,6 @@ keep_going_pass_signal (struct execution_control_state *ecs)
   if (ecs->event_thread->control.is_replaying
       && !target_record_is_replaying (ecs->event_thread->ptid))
     {
-      interps_notify_no_history ();
       ecs->ws.set_no_history ();
       set_last_target_status (ecs->target, ecs->ptid, ecs->ws);
       stop_print_frame = true;
@@ -9677,6 +9674,9 @@ normal_stop ()
   if (saved_context.changed ())
     return true;
 
+  if (last.kind () == TARGET_WAITKIND_NO_HISTORY)
+    interps_notify_no_history ();
+
   /* Notify observers about the stop.  This is where the interpreters
      print the stop event.  */
   notify_normal_stop ((inferior_ptid != null_ptid
-- 
2.34.1

Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de <http://www.intel.de>
Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva  
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928


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

* [PATCH v5 4/4] gdb, infrun: fix multi-threaded reverse stepping
  2024-04-10  7:46 [PATCH v5 0/4] PR gdb/31353 Markus Metzger
                   ` (2 preceding siblings ...)
  2024-04-10  7:46 ` [PATCH v5 3/4] gdb, infrun, record: move no-history notification into normal_stop Markus Metzger
@ 2024-04-10  7:46 ` Markus Metzger
  2024-04-12 19:50   ` Guinevere Larsen
  2024-05-03  5:26 ` [PING] [PATCH v5 0/4] PR gdb/31353 Metzger, Markus T
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 16+ messages in thread
From: Markus Metzger @ 2024-04-10  7:46 UTC (permalink / raw)
  To: gdb-patches; +Cc: pedro

When reverse-stepping a thread that has a pending breakpoint event, the
thread is not resumed as part of the infcmd function.  A first resume
notices the event and returns without resuming the target.

If the corresponding breakpoint has been deleted, event processing results
in a second resume that performs the intended stepping action.  That
resume happens after the infcmd function returned and the temporarily
modified execution direction was restored.  We end up resuming in the
wrong direction.

Store the direction in a thread's control state and change most of
infrun to take it from there rather than using the global variable.
---
 gdb/gdbthread.h                               | 10 +++
 gdb/infrun.c                                  | 47 ++++++----
 gdb/infrun.h                                  |  7 --
 .../gdb.btrace/implicit-stop-replaying.exp    | 90 +++++++++++++++++++
 4 files changed, 128 insertions(+), 26 deletions(-)
 create mode 100644 gdb/testsuite/gdb.btrace/implicit-stop-replaying.exp

diff --git a/gdb/gdbthread.h b/gdb/gdbthread.h
index 2d6b212cd32..12773c7bb12 100644
--- a/gdb/gdbthread.h
+++ b/gdb/gdbthread.h
@@ -92,6 +92,13 @@ enum step_over_calls_kind
     STEP_OVER_UNDEBUGGABLE
   };
 
+/* Reverse execution.  */
+enum exec_direction_kind
+  {
+    EXEC_FORWARD,
+    EXEC_REVERSE
+  };
+
 /* Inferior thread specific part of `struct infcall_control_state'.
 
    Inferior process counterpart is `struct inferior_control_state'.  */
@@ -179,6 +186,9 @@ struct thread_control_state
 
   /* Whether the thread was replaying when the command was issued.  */
   bool is_replaying = false;
+
+  /* The execution direction when the command was issued.  */
+  enum exec_direction_kind execution_direction = EXEC_FORWARD;
 };
 
 /* Inferior thread specific part of `struct infcall_suspend_state'.  */
diff --git a/gdb/infrun.c b/gdb/infrun.c
index d3738ebbd66..2cdfc4b8fdc 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -95,7 +95,8 @@ static void insert_step_resume_breakpoint_at_caller (const frame_info_ptr &);
 
 static void insert_longjmp_resume_breakpoint (struct gdbarch *, CORE_ADDR);
 
-static bool maybe_software_singlestep (struct gdbarch *gdbarch);
+static bool maybe_software_singlestep (const thread_info *tp,
+				       gdbarch *gdbarch, CORE_ADDR pc);
 
 static void resume (gdb_signal sig);
 
@@ -2369,11 +2370,12 @@ bool sched_multi = false;
    GDBARCH the current gdbarch.  */
 
 static bool
-maybe_software_singlestep (struct gdbarch *gdbarch)
+maybe_software_singlestep (const thread_info *tp, gdbarch *gdbarch,
+			   CORE_ADDR pc)
 {
   bool hw_step = true;
 
-  if (execution_direction == EXEC_FORWARD
+  if (tp->control.execution_direction == EXEC_FORWARD
       && gdbarch_software_single_step_p (gdbarch))
     hw_step = !insert_single_step_breakpoints (gdbarch);
 
@@ -2532,6 +2534,10 @@ do_target_resume (ptid_t resume_ptid, bool step, enum gdb_signal sig)
   /* Install inferior's terminal modes.  */
   target_terminal::inferior ();
 
+  scoped_restore save_exec_dir
+    = make_scoped_restore (&execution_direction,
+			   tp->control.execution_direction);
+
   /* Avoid confusing the next resume, if the next stop/resume
      happens to apply to another thread.  */
   tp->set_stop_signal (GDB_SIGNAL_0);
@@ -2792,6 +2798,7 @@ resume_1 (enum gdb_signal sig)
 	      insert_breakpoints ();
 
 	      resume_ptid = internal_resume_ptid (user_step);
+
 	      do_target_resume (resume_ptid, false, GDB_SIGNAL_0);
 	      tp->set_resumed (true);
 	      return;
@@ -2841,7 +2848,7 @@ resume_1 (enum gdb_signal sig)
 	  set_step_over_info (aspace, regcache_read_pc (regcache), 0,
 			      tp->global_num);
 
-	  step = maybe_software_singlestep (gdbarch);
+	  step = maybe_software_singlestep (tp, gdbarch, pc);
 
 	  insert_breakpoints ();
 	}
@@ -2860,7 +2867,7 @@ resume_1 (enum gdb_signal sig)
 
   /* Do we need to do it the hard way, w/temp breakpoints?  */
   else if (step)
-    step = maybe_software_singlestep (gdbarch);
+    step = maybe_software_singlestep (tp, gdbarch, pc);
 
   /* Currently, our software single-step implementation leads to different
      results than hardware single-stepping in one situation: when stepping
@@ -2931,7 +2938,7 @@ resume_1 (enum gdb_signal sig)
   else
     resume_ptid = internal_resume_ptid (user_step);
 
-  if (execution_direction != EXEC_REVERSE
+  if (tp->control.execution_direction != EXEC_REVERSE
       && step && breakpoint_inserted_here_p (aspace, pc))
     {
       /* There are two cases where we currently need to step a
@@ -3100,6 +3107,7 @@ clear_proceed_status_thread (struct thread_info *tp)
   bpstat_clear (&tp->control.stop_bpstat);
 
   tp->control.is_replaying = target_record_is_replaying (tp->ptid);
+  tp->control.execution_direction = ::execution_direction;
 }
 
 /* Notify the current interpreter and observers that the target is about to
@@ -3209,7 +3217,7 @@ schedlock_applies (struct thread_info *tp)
 	      && tp->control.stepping_command)
 	  || (scheduler_mode == schedlock_replay
 	      && target_record_will_replay (minus_one_ptid,
-					    execution_direction)));
+					    tp->control.execution_direction)));
 }
 
 /* When FORCE_P is false, set process_stratum_target::COMMIT_RESUMED_STATE
@@ -3646,7 +3654,7 @@ proceed (CORE_ADDR addr, enum gdb_signal siggnal)
       if (cur_thr->stop_pc_p ()
 	  && pc == cur_thr->stop_pc ()
 	  && breakpoint_here_p (aspace, pc) == ordinary_breakpoint_here
-	  && execution_direction != EXEC_REVERSE)
+	  && cur_thr->control.execution_direction != EXEC_REVERSE)
 	/* There is a breakpoint at the address we will resume at,
 	   step one instruction before inserting breakpoints so that
 	   we do not stop right away (and report a second hit at this
@@ -4962,7 +4970,7 @@ adjust_pc_after_break (struct thread_info *thread,
      breakpoint at PC - 1.  We'd then report a hit on B1, although
      INSN1 hadn't been de-executed yet.  Doing nothing is the correct
      behaviour.  */
-  if (execution_direction == EXEC_REVERSE)
+  if (thread->control.execution_direction == EXEC_REVERSE)
     return;
 
   /* If the target can tell whether the thread hit a SW breakpoint,
@@ -7561,7 +7569,7 @@ process_event_stop_test (struct execution_control_state *ecs)
 
       delete_step_resume_breakpoint (ecs->event_thread);
       if (ecs->event_thread->control.proceed_to_finish
-	  && execution_direction == EXEC_REVERSE)
+	  && ecs->event_thread->control.execution_direction == EXEC_REVERSE)
 	{
 	  struct thread_info *tp = ecs->event_thread;
 
@@ -7576,7 +7584,7 @@ process_event_stop_test (struct execution_control_state *ecs)
 	}
       fill_in_stop_func (gdbarch, ecs);
       if (ecs->event_thread->stop_pc () == ecs->stop_func_start
-	  && execution_direction == EXEC_REVERSE)
+	  && ecs->event_thread->control.execution_direction == EXEC_REVERSE)
 	{
 	  /* We are stepping over a function call in reverse, and just
 	     hit the step-resume breakpoint at the start address of
@@ -7701,7 +7709,7 @@ process_event_stop_test (struct execution_control_state *ecs)
 
   if (pc_in_thread_step_range (ecs->event_thread->stop_pc (),
 			       ecs->event_thread)
-      && (execution_direction != EXEC_REVERSE
+      && (ecs->event_thread->control.execution_direction != EXEC_REVERSE
 	  || *curr_frame_id == original_frame_id))
     {
       infrun_debug_printf
@@ -7720,7 +7728,7 @@ process_event_stop_test (struct execution_control_state *ecs)
       CORE_ADDR stop_pc = ecs->event_thread->stop_pc ();
       if (stop_pc == ecs->event_thread->control.step_range_start
 	  && stop_pc != ecs->stop_func_start
-	  && execution_direction == EXEC_REVERSE)
+	  && ecs->event_thread->control.execution_direction == EXEC_REVERSE)
 	end_stepping_range (ecs);
       else
 	keep_going (ecs);
@@ -7742,7 +7750,7 @@ process_event_stop_test (struct execution_control_state *ecs)
      backward through the trampoline code, and that's handled further
      down, so there is nothing for us to do here.  */
 
-  if (execution_direction != EXEC_REVERSE
+  if (ecs->event_thread->control.execution_direction != EXEC_REVERSE
       && ecs->event_thread->control.step_over_calls == STEP_OVER_UNDEBUGGABLE
       && in_solib_dynsym_resolve_code (ecs->event_thread->stop_pc ())
       && (ecs->event_thread->control.step_start_function == nullptr
@@ -7891,7 +7899,7 @@ process_event_stop_test (struct execution_control_state *ecs)
 
       /* Reverse stepping through solib trampolines.  */
 
-      if (execution_direction == EXEC_REVERSE
+      if (ecs->event_thread->control.execution_direction == EXEC_REVERSE
 	  && ecs->event_thread->control.step_over_calls != STEP_OVER_NONE
 	  && (gdbarch_skip_trampoline_code (gdbarch, frame, stop_pc)
 	      || (ecs->stop_func_start == 0
@@ -7919,7 +7927,7 @@ process_event_stop_test (struct execution_control_state *ecs)
 	     stepped into (backwards), and continue to there.  When we
 	     get there, we'll need to single-step back to the caller.  */
 
-	  if (execution_direction == EXEC_REVERSE)
+	  if (ecs->event_thread->control.execution_direction == EXEC_REVERSE)
 	    {
 	      /* If we're already at the start of the function, we've either
 		 just stepped backward into a single instruction function,
@@ -7982,7 +7990,7 @@ process_event_stop_test (struct execution_control_state *ecs)
 						  tmp_sal)
 	    && !inline_frame_is_marked_for_skip (true, ecs->event_thread))
 	  {
-	    if (execution_direction == EXEC_REVERSE)
+	    if (ecs->event_thread->control.execution_direction == EXEC_REVERSE)
 	      handle_step_into_function_backward (gdbarch, ecs);
 	    else
 	      handle_step_into_function (gdbarch, ecs);
@@ -8000,7 +8008,7 @@ process_event_stop_test (struct execution_control_state *ecs)
 	  return;
 	}
 
-      if (execution_direction == EXEC_REVERSE)
+      if (ecs->event_thread->control.execution_direction == EXEC_REVERSE)
 	{
 	  /* If we're already at the start of the function, we've either just
 	     stepped backward into a single instruction function without line
@@ -8029,7 +8037,7 @@ process_event_stop_test (struct execution_control_state *ecs)
 
   /* Reverse stepping through solib trampolines.  */
 
-  if (execution_direction == EXEC_REVERSE
+  if (ecs->event_thread->control.execution_direction == EXEC_REVERSE
       && ecs->event_thread->control.step_over_calls != STEP_OVER_NONE)
     {
       CORE_ADDR stop_pc = ecs->event_thread->stop_pc ();
@@ -8612,6 +8620,7 @@ keep_going_stepped_thread (struct thread_info *tp)
 
       tp->set_resumed (true);
       resume_ptid = internal_resume_ptid (tp->control.stepping_command);
+
       do_target_resume (resume_ptid, false, GDB_SIGNAL_0);
     }
   else
diff --git a/gdb/infrun.h b/gdb/infrun.h
index 5f83ca2b4c3..c3d27c3dea3 100644
--- a/gdb/infrun.h
+++ b/gdb/infrun.h
@@ -107,13 +107,6 @@ extern bool disable_randomization;
    current location.  */
 extern ULONGEST get_stop_id (void);
 
-/* Reverse execution.  */
-enum exec_direction_kind
-  {
-    EXEC_FORWARD,
-    EXEC_REVERSE
-  };
-
 /* The current execution direction.  */
 extern enum exec_direction_kind execution_direction;
 
diff --git a/gdb/testsuite/gdb.btrace/implicit-stop-replaying.exp b/gdb/testsuite/gdb.btrace/implicit-stop-replaying.exp
new file mode 100644
index 00000000000..20240da1dc1
--- /dev/null
+++ b/gdb/testsuite/gdb.btrace/implicit-stop-replaying.exp
@@ -0,0 +1,90 @@
+# This testcase is part of GDB, the GNU debugger.
+#
+# Copyright 2024 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 <http://www.gnu.org/licenses/>.
+
+# Test that we stop replaying other threads when stepping a thread at the
+# end of its execution history.
+#
+# This is similar to the last test in multi-thread-step.exp, except that
+# we reverse-step instead of record goto begin to start replaying and we
+# step instead of continuing.
+#
+# This triggered a bug where GDB confused the execution direction and kept
+# stepping both threads backwards instead of forwards.
+
+require allow_btrace_tests
+
+standard_testfile multi-thread-step.c
+if [prepare_for_testing "failed to prepare" $testfile $srcfile \
+    {debug pthreads}] {
+    return -1
+}
+
+if ![runto_main] {
+    return -1
+}
+
+# Set up breakpoints.
+set bp_1 [gdb_get_line_number "bp.1" $srcfile]
+set bp_2 [gdb_get_line_number "bp.2" $srcfile]
+
+# Trace the code between the two breakpoints.
+gdb_breakpoint $srcfile:$bp_1
+gdb_continue_to_breakpoint "continue to bp.1" ".*$srcfile:$bp_1\r\n.*"
+
+# Make sure GDB knows about the new thread.
+gdb_test "info threads"
+gdb_test_no_output "record btrace"
+
+# We have two threads at or close to bp.1 but handled only one stop event.
+# Remove the breakpoint so we do not need to deal with the 2nd event.
+delete_breakpoints
+gdb_breakpoint $srcfile:$bp_2
+gdb_continue_to_breakpoint "continue to bp.2" ".*$srcfile:$bp_2\r\n.*"
+
+# Determine the thread that reported the breakpoint.
+set thread "bad"
+gdb_test_multiple "thread" "thread" {
+    -re -wrap "Current thread is \($decimal\).*" {
+	set thread $expect_out(1,string)
+    }
+}
+
+# Determine the other thread.
+set other "bad"
+if { $thread == 1 } {
+    set other 2
+} elseif { $thread == 2 } {
+    set other 1
+}
+
+# This test only works for scheduler-locking 'replay'.
+gdb_test_no_output "set scheduler-locking replay"
+
+# Remove breakpoints or we might run into it right away.
+delete_breakpoints
+
+# Start replaying the other thread.
+gdb_test "thread apply $other reverse-stepi"
+gdb_test "thread apply $other info record" "Replay in progress.*" \
+    "other thread is replaying"
+
+# Step the thread that reported the breakpoint, which is not replaying.
+gdb_test "next" "return arg;.*"
+
+# The other thread stopped replaying.
+gdb_test "thread apply $other info record" "Recorded \[^\\\r\\\n\]*" \
+    "other thread stopped replaying"
-- 
2.34.1

Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de <http://www.intel.de>
Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva  
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928


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

* Re: [PATCH v5 4/4] gdb, infrun: fix multi-threaded reverse stepping
  2024-04-10  7:46 ` [PATCH v5 4/4] gdb, infrun: fix multi-threaded reverse stepping Markus Metzger
@ 2024-04-12 19:50   ` Guinevere Larsen
  2024-04-15  9:03     ` Metzger, Markus T
  0 siblings, 1 reply; 16+ messages in thread
From: Guinevere Larsen @ 2024-04-12 19:50 UTC (permalink / raw)
  To: Markus Metzger, gdb-patches; +Cc: pedro

On 4/10/24 04:46, Markus Metzger wrote:
> When reverse-stepping a thread that has a pending breakpoint event, the
> thread is not resumed as part of the infcmd function.  A first resume
> notices the event and returns without resuming the target.
>
> If the corresponding breakpoint has been deleted, event processing results
> in a second resume that performs the intended stepping action.  That
> resume happens after the infcmd function returned and the temporarily
> modified execution direction was restored.  We end up resuming in the
> wrong direction.
>
> Store the direction in a thread's control state and change most of
> infrun to take it from there rather than using the global variable.
Change as a whole looks good. Just one question inlined.
> ---
>   gdb/gdbthread.h                               | 10 +++
>   gdb/infrun.c                                  | 47 ++++++----
>   gdb/infrun.h                                  |  7 --
>   .../gdb.btrace/implicit-stop-replaying.exp    | 90 +++++++++++++++++++
>   4 files changed, 128 insertions(+), 26 deletions(-)
>   create mode 100644 gdb/testsuite/gdb.btrace/implicit-stop-replaying.exp
>
> diff --git a/gdb/gdbthread.h b/gdb/gdbthread.h
> index 2d6b212cd32..12773c7bb12 100644
> --- a/gdb/gdbthread.h
> +++ b/gdb/gdbthread.h
> @@ -92,6 +92,13 @@ enum step_over_calls_kind
>       STEP_OVER_UNDEBUGGABLE
>     };
>   
> +/* Reverse execution.  */
> +enum exec_direction_kind
> +  {
> +    EXEC_FORWARD,
> +    EXEC_REVERSE
> +  };
> +
>   /* Inferior thread specific part of `struct infcall_control_state'.
>   
>      Inferior process counterpart is `struct inferior_control_state'.  */
> @@ -179,6 +186,9 @@ struct thread_control_state
>   
>     /* Whether the thread was replaying when the command was issued.  */
>     bool is_replaying = false;
> +
> +  /* The execution direction when the command was issued.  */
> +  enum exec_direction_kind execution_direction = EXEC_FORWARD;

I'm a bit unsure of this... Mostly wondering if this makes sense to be a 
thread-specific information. Does it make sense for one thread to have a 
direction being forward and another backwards? I would think this is not 
a good idea (if not impossible).

I think this would make more sense as a member of inferior_control_state 
instead.

-- 
Cheers,
Guinevere Larsen
She/Her/Hers

>   };
>   
>   /* Inferior thread specific part of `struct infcall_suspend_state'.  */
> diff --git a/gdb/infrun.c b/gdb/infrun.c
> index d3738ebbd66..2cdfc4b8fdc 100644
> --- a/gdb/infrun.c
> +++ b/gdb/infrun.c
> @@ -95,7 +95,8 @@ static void insert_step_resume_breakpoint_at_caller (const frame_info_ptr &);
>   
>   static void insert_longjmp_resume_breakpoint (struct gdbarch *, CORE_ADDR);
>   
> -static bool maybe_software_singlestep (struct gdbarch *gdbarch);
> +static bool maybe_software_singlestep (const thread_info *tp,
> +				       gdbarch *gdbarch, CORE_ADDR pc);
>   
>   static void resume (gdb_signal sig);
>   
> @@ -2369,11 +2370,12 @@ bool sched_multi = false;
>      GDBARCH the current gdbarch.  */
>   
>   static bool
> -maybe_software_singlestep (struct gdbarch *gdbarch)
> +maybe_software_singlestep (const thread_info *tp, gdbarch *gdbarch,
> +			   CORE_ADDR pc)
>   {
>     bool hw_step = true;
>   
> -  if (execution_direction == EXEC_FORWARD
> +  if (tp->control.execution_direction == EXEC_FORWARD
>         && gdbarch_software_single_step_p (gdbarch))
>       hw_step = !insert_single_step_breakpoints (gdbarch);
>   
> @@ -2532,6 +2534,10 @@ do_target_resume (ptid_t resume_ptid, bool step, enum gdb_signal sig)
>     /* Install inferior's terminal modes.  */
>     target_terminal::inferior ();
>   
> +  scoped_restore save_exec_dir
> +    = make_scoped_restore (&execution_direction,
> +			   tp->control.execution_direction);
> +
>     /* Avoid confusing the next resume, if the next stop/resume
>        happens to apply to another thread.  */
>     tp->set_stop_signal (GDB_SIGNAL_0);
> @@ -2792,6 +2798,7 @@ resume_1 (enum gdb_signal sig)
>   	      insert_breakpoints ();
>   
>   	      resume_ptid = internal_resume_ptid (user_step);
> +
>   	      do_target_resume (resume_ptid, false, GDB_SIGNAL_0);
>   	      tp->set_resumed (true);
>   	      return;
> @@ -2841,7 +2848,7 @@ resume_1 (enum gdb_signal sig)
>   	  set_step_over_info (aspace, regcache_read_pc (regcache), 0,
>   			      tp->global_num);
>   
> -	  step = maybe_software_singlestep (gdbarch);
> +	  step = maybe_software_singlestep (tp, gdbarch, pc);
>   
>   	  insert_breakpoints ();
>   	}
> @@ -2860,7 +2867,7 @@ resume_1 (enum gdb_signal sig)
>   
>     /* Do we need to do it the hard way, w/temp breakpoints?  */
>     else if (step)
> -    step = maybe_software_singlestep (gdbarch);
> +    step = maybe_software_singlestep (tp, gdbarch, pc);
>   
>     /* Currently, our software single-step implementation leads to different
>        results than hardware single-stepping in one situation: when stepping
> @@ -2931,7 +2938,7 @@ resume_1 (enum gdb_signal sig)
>     else
>       resume_ptid = internal_resume_ptid (user_step);
>   
> -  if (execution_direction != EXEC_REVERSE
> +  if (tp->control.execution_direction != EXEC_REVERSE
>         && step && breakpoint_inserted_here_p (aspace, pc))
>       {
>         /* There are two cases where we currently need to step a
> @@ -3100,6 +3107,7 @@ clear_proceed_status_thread (struct thread_info *tp)
>     bpstat_clear (&tp->control.stop_bpstat);
>   
>     tp->control.is_replaying = target_record_is_replaying (tp->ptid);
> +  tp->control.execution_direction = ::execution_direction;
>   }
>   
>   /* Notify the current interpreter and observers that the target is about to
> @@ -3209,7 +3217,7 @@ schedlock_applies (struct thread_info *tp)
>   	      && tp->control.stepping_command)
>   	  || (scheduler_mode == schedlock_replay
>   	      && target_record_will_replay (minus_one_ptid,
> -					    execution_direction)));
> +					    tp->control.execution_direction)));
>   }
>   
>   /* When FORCE_P is false, set process_stratum_target::COMMIT_RESUMED_STATE
> @@ -3646,7 +3654,7 @@ proceed (CORE_ADDR addr, enum gdb_signal siggnal)
>         if (cur_thr->stop_pc_p ()
>   	  && pc == cur_thr->stop_pc ()
>   	  && breakpoint_here_p (aspace, pc) == ordinary_breakpoint_here
> -	  && execution_direction != EXEC_REVERSE)
> +	  && cur_thr->control.execution_direction != EXEC_REVERSE)
>   	/* There is a breakpoint at the address we will resume at,
>   	   step one instruction before inserting breakpoints so that
>   	   we do not stop right away (and report a second hit at this
> @@ -4962,7 +4970,7 @@ adjust_pc_after_break (struct thread_info *thread,
>        breakpoint at PC - 1.  We'd then report a hit on B1, although
>        INSN1 hadn't been de-executed yet.  Doing nothing is the correct
>        behaviour.  */
> -  if (execution_direction == EXEC_REVERSE)
> +  if (thread->control.execution_direction == EXEC_REVERSE)
>       return;
>   
>     /* If the target can tell whether the thread hit a SW breakpoint,
> @@ -7561,7 +7569,7 @@ process_event_stop_test (struct execution_control_state *ecs)
>   
>         delete_step_resume_breakpoint (ecs->event_thread);
>         if (ecs->event_thread->control.proceed_to_finish
> -	  && execution_direction == EXEC_REVERSE)
> +	  && ecs->event_thread->control.execution_direction == EXEC_REVERSE)
>   	{
>   	  struct thread_info *tp = ecs->event_thread;
>   
> @@ -7576,7 +7584,7 @@ process_event_stop_test (struct execution_control_state *ecs)
>   	}
>         fill_in_stop_func (gdbarch, ecs);
>         if (ecs->event_thread->stop_pc () == ecs->stop_func_start
> -	  && execution_direction == EXEC_REVERSE)
> +	  && ecs->event_thread->control.execution_direction == EXEC_REVERSE)
>   	{
>   	  /* We are stepping over a function call in reverse, and just
>   	     hit the step-resume breakpoint at the start address of
> @@ -7701,7 +7709,7 @@ process_event_stop_test (struct execution_control_state *ecs)
>   
>     if (pc_in_thread_step_range (ecs->event_thread->stop_pc (),
>   			       ecs->event_thread)
> -      && (execution_direction != EXEC_REVERSE
> +      && (ecs->event_thread->control.execution_direction != EXEC_REVERSE
>   	  || *curr_frame_id == original_frame_id))
>       {
>         infrun_debug_printf
> @@ -7720,7 +7728,7 @@ process_event_stop_test (struct execution_control_state *ecs)
>         CORE_ADDR stop_pc = ecs->event_thread->stop_pc ();
>         if (stop_pc == ecs->event_thread->control.step_range_start
>   	  && stop_pc != ecs->stop_func_start
> -	  && execution_direction == EXEC_REVERSE)
> +	  && ecs->event_thread->control.execution_direction == EXEC_REVERSE)
>   	end_stepping_range (ecs);
>         else
>   	keep_going (ecs);
> @@ -7742,7 +7750,7 @@ process_event_stop_test (struct execution_control_state *ecs)
>        backward through the trampoline code, and that's handled further
>        down, so there is nothing for us to do here.  */
>   
> -  if (execution_direction != EXEC_REVERSE
> +  if (ecs->event_thread->control.execution_direction != EXEC_REVERSE
>         && ecs->event_thread->control.step_over_calls == STEP_OVER_UNDEBUGGABLE
>         && in_solib_dynsym_resolve_code (ecs->event_thread->stop_pc ())
>         && (ecs->event_thread->control.step_start_function == nullptr
> @@ -7891,7 +7899,7 @@ process_event_stop_test (struct execution_control_state *ecs)
>   
>         /* Reverse stepping through solib trampolines.  */
>   
> -      if (execution_direction == EXEC_REVERSE
> +      if (ecs->event_thread->control.execution_direction == EXEC_REVERSE
>   	  && ecs->event_thread->control.step_over_calls != STEP_OVER_NONE
>   	  && (gdbarch_skip_trampoline_code (gdbarch, frame, stop_pc)
>   	      || (ecs->stop_func_start == 0
> @@ -7919,7 +7927,7 @@ process_event_stop_test (struct execution_control_state *ecs)
>   	     stepped into (backwards), and continue to there.  When we
>   	     get there, we'll need to single-step back to the caller.  */
>   
> -	  if (execution_direction == EXEC_REVERSE)
> +	  if (ecs->event_thread->control.execution_direction == EXEC_REVERSE)
>   	    {
>   	      /* If we're already at the start of the function, we've either
>   		 just stepped backward into a single instruction function,
> @@ -7982,7 +7990,7 @@ process_event_stop_test (struct execution_control_state *ecs)
>   						  tmp_sal)
>   	    && !inline_frame_is_marked_for_skip (true, ecs->event_thread))
>   	  {
> -	    if (execution_direction == EXEC_REVERSE)
> +	    if (ecs->event_thread->control.execution_direction == EXEC_REVERSE)
>   	      handle_step_into_function_backward (gdbarch, ecs);
>   	    else
>   	      handle_step_into_function (gdbarch, ecs);
> @@ -8000,7 +8008,7 @@ process_event_stop_test (struct execution_control_state *ecs)
>   	  return;
>   	}
>   
> -      if (execution_direction == EXEC_REVERSE)
> +      if (ecs->event_thread->control.execution_direction == EXEC_REVERSE)
>   	{
>   	  /* If we're already at the start of the function, we've either just
>   	     stepped backward into a single instruction function without line
> @@ -8029,7 +8037,7 @@ process_event_stop_test (struct execution_control_state *ecs)
>   
>     /* Reverse stepping through solib trampolines.  */
>   
> -  if (execution_direction == EXEC_REVERSE
> +  if (ecs->event_thread->control.execution_direction == EXEC_REVERSE
>         && ecs->event_thread->control.step_over_calls != STEP_OVER_NONE)
>       {
>         CORE_ADDR stop_pc = ecs->event_thread->stop_pc ();
> @@ -8612,6 +8620,7 @@ keep_going_stepped_thread (struct thread_info *tp)
>   
>         tp->set_resumed (true);
>         resume_ptid = internal_resume_ptid (tp->control.stepping_command);
> +
>         do_target_resume (resume_ptid, false, GDB_SIGNAL_0);
>       }
>     else
> diff --git a/gdb/infrun.h b/gdb/infrun.h
> index 5f83ca2b4c3..c3d27c3dea3 100644
> --- a/gdb/infrun.h
> +++ b/gdb/infrun.h
> @@ -107,13 +107,6 @@ extern bool disable_randomization;
>      current location.  */
>   extern ULONGEST get_stop_id (void);
>   
> -/* Reverse execution.  */
> -enum exec_direction_kind
> -  {
> -    EXEC_FORWARD,
> -    EXEC_REVERSE
> -  };
> -
>   /* The current execution direction.  */
>   extern enum exec_direction_kind execution_direction;
>   
> diff --git a/gdb/testsuite/gdb.btrace/implicit-stop-replaying.exp b/gdb/testsuite/gdb.btrace/implicit-stop-replaying.exp
> new file mode 100644
> index 00000000000..20240da1dc1
> --- /dev/null
> +++ b/gdb/testsuite/gdb.btrace/implicit-stop-replaying.exp
> @@ -0,0 +1,90 @@
> +# This testcase is part of GDB, the GNU debugger.
> +#
> +# Copyright 2024 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 <http://www.gnu.org/licenses/>.
> +
> +# Test that we stop replaying other threads when stepping a thread at the
> +# end of its execution history.
> +#
> +# This is similar to the last test in multi-thread-step.exp, except that
> +# we reverse-step instead of record goto begin to start replaying and we
> +# step instead of continuing.
> +#
> +# This triggered a bug where GDB confused the execution direction and kept
> +# stepping both threads backwards instead of forwards.
> +
> +require allow_btrace_tests
> +
> +standard_testfile multi-thread-step.c
> +if [prepare_for_testing "failed to prepare" $testfile $srcfile \
> +    {debug pthreads}] {
> +    return -1
> +}
> +
> +if ![runto_main] {
> +    return -1
> +}
> +
> +# Set up breakpoints.
> +set bp_1 [gdb_get_line_number "bp.1" $srcfile]
> +set bp_2 [gdb_get_line_number "bp.2" $srcfile]
> +
> +# Trace the code between the two breakpoints.
> +gdb_breakpoint $srcfile:$bp_1
> +gdb_continue_to_breakpoint "continue to bp.1" ".*$srcfile:$bp_1\r\n.*"
> +
> +# Make sure GDB knows about the new thread.
> +gdb_test "info threads"
> +gdb_test_no_output "record btrace"
> +
> +# We have two threads at or close to bp.1 but handled only one stop event.
> +# Remove the breakpoint so we do not need to deal with the 2nd event.
> +delete_breakpoints
> +gdb_breakpoint $srcfile:$bp_2
> +gdb_continue_to_breakpoint "continue to bp.2" ".*$srcfile:$bp_2\r\n.*"
> +
> +# Determine the thread that reported the breakpoint.
> +set thread "bad"
> +gdb_test_multiple "thread" "thread" {
> +    -re -wrap "Current thread is \($decimal\).*" {
> +	set thread $expect_out(1,string)
> +    }
> +}
> +
> +# Determine the other thread.
> +set other "bad"
> +if { $thread == 1 } {
> +    set other 2
> +} elseif { $thread == 2 } {
> +    set other 1
> +}
> +
> +# This test only works for scheduler-locking 'replay'.
> +gdb_test_no_output "set scheduler-locking replay"
> +
> +# Remove breakpoints or we might run into it right away.
> +delete_breakpoints
> +
> +# Start replaying the other thread.
> +gdb_test "thread apply $other reverse-stepi"
> +gdb_test "thread apply $other info record" "Replay in progress.*" \
> +    "other thread is replaying"
> +
> +# Step the thread that reported the breakpoint, which is not replaying.
> +gdb_test "next" "return arg;.*"
> +
> +# The other thread stopped replaying.
> +gdb_test "thread apply $other info record" "Recorded \[^\\\r\\\n\]*" \
> +    "other thread stopped replaying"


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

* RE: [PATCH v5 4/4] gdb, infrun: fix multi-threaded reverse stepping
  2024-04-12 19:50   ` Guinevere Larsen
@ 2024-04-15  9:03     ` Metzger, Markus T
  2024-04-15 12:44       ` Guinevere Larsen
  0 siblings, 1 reply; 16+ messages in thread
From: Metzger, Markus T @ 2024-04-15  9:03 UTC (permalink / raw)
  To: Guinevere Larsen; +Cc: pedro, gdb-patches

>> @@ -179,6 +186,9 @@ struct thread_control_state
>>
>>     /* Whether the thread was replaying when the command was issued.  */
>>     bool is_replaying = false;
>> +
>> +  /* The execution direction when the command was issued.  */
>> +  enum exec_direction_kind execution_direction = EXEC_FORWARD;
>
>I'm a bit unsure of this... Mostly wondering if this makes sense to be a
>thread-specific information. Does it make sense for one thread to have a
>direction being forward and another backwards? I would think this is not
>a good idea (if not impossible).

You can have one thread going forward and the other going backward.
Both are replaying; we do not allow recording one thread while another
thread in the same inferior is replaying.

Regards,
Markus.
Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de <http://www.intel.de>
Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva  
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928

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

* Re: [PATCH v5 4/4] gdb, infrun: fix multi-threaded reverse stepping
  2024-04-15  9:03     ` Metzger, Markus T
@ 2024-04-15 12:44       ` Guinevere Larsen
  0 siblings, 0 replies; 16+ messages in thread
From: Guinevere Larsen @ 2024-04-15 12:44 UTC (permalink / raw)
  To: Metzger, Markus T; +Cc: pedro, gdb-patches

On 4/15/24 06:03, Metzger, Markus T wrote:
>>> @@ -179,6 +186,9 @@ struct thread_control_state
>>>
>>>      /* Whether the thread was replaying when the command was issued.  */
>>>      bool is_replaying = false;
>>> +
>>> +  /* The execution direction when the command was issued.  */
>>> +  enum exec_direction_kind execution_direction = EXEC_FORWARD;
>> I'm a bit unsure of this... Mostly wondering if this makes sense to be a
>> thread-specific information. Does it make sense for one thread to have a
>> direction being forward and another backwards? I would think this is not
>> a good idea (if not impossible).
> You can have one thread going forward and the other going backward.
> Both are replaying; we do not allow recording one thread while another
> thread in the same inferior is replaying.

Oh you can? I didn't know btrace was this fancy!

The whole series seems fine to me, then. Reviewed-By: Guinevere Larsen 
<blarsen@redhat.com>

-- 
Cheers,
Guinevere Larsen
She/Her/Hers

>
> Regards,
> Markus.
> Intel Deutschland GmbH
> Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
> Tel: +49 89 99 8853-0, www.intel.de <http://www.intel.de>
> Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva
> Chairperson of the Supervisory Board: Nicole Lau
> Registered Office: Munich
> Commercial Register: Amtsgericht Muenchen HRB 186928


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

* [PING] [PATCH v5 0/4] PR gdb/31353
  2024-04-10  7:46 [PATCH v5 0/4] PR gdb/31353 Markus Metzger
                   ` (3 preceding siblings ...)
  2024-04-10  7:46 ` [PATCH v5 4/4] gdb, infrun: fix multi-threaded reverse stepping Markus Metzger
@ 2024-05-03  5:26 ` Metzger, Markus T
  2024-06-07  5:06   ` [PING v2] " Metzger, Markus T
  2024-10-21  8:45 ` Andrew Burgess
  2024-10-21  9:13 ` Andrew Burgess
  6 siblings, 1 reply; 16+ messages in thread
From: Metzger, Markus T @ 2024-05-03  5:26 UTC (permalink / raw)
  To: gdb-patches; +Cc: pedro

Kindly pinging.

Markus.

>-----Original Message-----
>From: Metzger, Markus T <markus.t.metzger@intel.com>
>Sent: Wednesday, April 10, 2024 9:46 AM
>To: gdb-patches@sourceware.org
>Cc: pedro@palves.net
>Subject: [PATCH v5 0/4] PR gdb/31353
>
>Reviving an old patch series that was first submitted in Jan'21.
>
>It fixes issues with breakpoints at the end of the execution history,
>including PR gdb/31353, which was submitted in the meantime.
>
>Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31353
>
>Guinevere Larsen reviewed most of the series and reported an issue with
>applying the last patch.  I'm resending the series, rebased on current
>master, to hopefully fix that issue.
>
>The only change to v4 is that a redundant forward declaration was removed.
>
>The changes are mostly in infrun and require global maintainer approval.
>
>Markus Metzger (4):
>  gdb, infrun, btrace: fix reverse/replay stepping at end of execution
>    history
>  gdb, infrun, record: fix hang when step-over fails with no-history
>  gdb, infrun, record: move no-history notification into normal_stop
>  gdb, infrun: fix multi-threaded reverse stepping
>
> gdb/gdbthread.h                               | 13 +++
> gdb/infrun.c                                  | 86 +++++++++++++-----
> gdb/infrun.h                                  |  7 --
> gdb/record-btrace.c                           | 19 ++--
> gdb/testsuite/gdb.btrace/cont-hang.exp        | 43 +++++++++
> .../gdb.btrace/implicit-stop-replaying.exp    | 90 +++++++++++++++++++
> .../gdb.btrace/multi-thread-break-hang.exp    | 84 +++++++++++++++++
> gdb/testsuite/gdb.btrace/step-hang.exp        | 42 +++++++++
> gdb/testsuite/gdb.btrace/stepn.exp            | 50 +++++++++++
> 9 files changed, 398 insertions(+), 36 deletions(-)
> create mode 100644 gdb/testsuite/gdb.btrace/cont-hang.exp
> create mode 100644 gdb/testsuite/gdb.btrace/implicit-stop-replaying.exp
> create mode 100644 gdb/testsuite/gdb.btrace/multi-thread-break-hang.exp
> create mode 100644 gdb/testsuite/gdb.btrace/step-hang.exp
> create mode 100644 gdb/testsuite/gdb.btrace/stepn.exp
>
>--
>2.34.1

Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de <http://www.intel.de>
Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva  
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928


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

* [PING v2] [PATCH v5 0/4] PR gdb/31353
  2024-05-03  5:26 ` [PING] [PATCH v5 0/4] PR gdb/31353 Metzger, Markus T
@ 2024-06-07  5:06   ` Metzger, Markus T
  2024-06-27 19:12     ` Guinevere Larsen
  0 siblings, 1 reply; 16+ messages in thread
From: Metzger, Markus T @ 2024-06-07  5:06 UTC (permalink / raw)
  To: gdb-patches

Kindly pinging.

Markus.

>-----Original Message-----
>From: Metzger, Markus T <markus.t.metzger@intel.com>
>Sent: Friday, May 3, 2024 7:26 AM
>To: gdb-patches@sourceware.org
>Cc: pedro@palves.net
>Subject: [PING] [PATCH v5 0/4] PR gdb/31353
>
>Kindly pinging.
>
>Markus.
>
>>-----Original Message-----
>>From: Metzger, Markus T <markus.t.metzger@intel.com>
>>Sent: Wednesday, April 10, 2024 9:46 AM
>>To: gdb-patches@sourceware.org
>>Cc: pedro@palves.net
>>Subject: [PATCH v5 0/4] PR gdb/31353
>>
>>Reviving an old patch series that was first submitted in Jan'21.
>>
>>It fixes issues with breakpoints at the end of the execution history,
>>including PR gdb/31353, which was submitted in the meantime.
>>
>>Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31353
>>
>>Guinevere Larsen reviewed most of the series and reported an issue with
>>applying the last patch.  I'm resending the series, rebased on current
>>master, to hopefully fix that issue.
>>
>>The only change to v4 is that a redundant forward declaration was removed.
>>
>>The changes are mostly in infrun and require global maintainer approval.
>>
>>Markus Metzger (4):
>>  gdb, infrun, btrace: fix reverse/replay stepping at end of execution
>>    history
>>  gdb, infrun, record: fix hang when step-over fails with no-history
>>  gdb, infrun, record: move no-history notification into normal_stop
>>  gdb, infrun: fix multi-threaded reverse stepping
>>
>> gdb/gdbthread.h                               | 13 +++
>> gdb/infrun.c                                  | 86 +++++++++++++-----
>> gdb/infrun.h                                  |  7 --
>> gdb/record-btrace.c                           | 19 ++--
>> gdb/testsuite/gdb.btrace/cont-hang.exp        | 43 +++++++++
>> .../gdb.btrace/implicit-stop-replaying.exp    | 90 +++++++++++++++++++
>> .../gdb.btrace/multi-thread-break-hang.exp    | 84 +++++++++++++++++
>> gdb/testsuite/gdb.btrace/step-hang.exp        | 42 +++++++++
>> gdb/testsuite/gdb.btrace/stepn.exp            | 50 +++++++++++
>> 9 files changed, 398 insertions(+), 36 deletions(-)
>> create mode 100644 gdb/testsuite/gdb.btrace/cont-hang.exp
>> create mode 100644 gdb/testsuite/gdb.btrace/implicit-stop-replaying.exp
>> create mode 100644 gdb/testsuite/gdb.btrace/multi-thread-break-hang.exp
>> create mode 100644 gdb/testsuite/gdb.btrace/step-hang.exp
>> create mode 100644 gdb/testsuite/gdb.btrace/stepn.exp
>>
>>--
>>2.34.1

Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Sean Fennelly, Jeffrey Schneiderman, Tiffany Doon Silva
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928


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

* Re: [PING v2] [PATCH v5 0/4] PR gdb/31353
  2024-06-07  5:06   ` [PING v2] " Metzger, Markus T
@ 2024-06-27 19:12     ` Guinevere Larsen
  2024-09-13 10:43       ` [PING v3] " Metzger, Markus T
  0 siblings, 1 reply; 16+ messages in thread
From: Guinevere Larsen @ 2024-06-27 19:12 UTC (permalink / raw)
  To: Metzger, Markus T, gdb-patches, Guinevere Larsen

Pinging on behalf of Makus because I ran into a problem that this series 
fixes and I would love if this was merged :)

-- 
Cheers,
Guinevere Larsen
She/Her/Hers

On 6/7/24 2:06 AM, Metzger, Markus T wrote:
> Kindly pinging.
>
> Markus.
>
>> -----Original Message-----
>> From: Metzger, Markus T <markus.t.metzger@intel.com>
>> Sent: Friday, May 3, 2024 7:26 AM
>> To: gdb-patches@sourceware.org
>> Cc: pedro@palves.net
>> Subject: [PING] [PATCH v5 0/4] PR gdb/31353
>>
>> Kindly pinging.
>>
>> Markus.
>>
>>> -----Original Message-----
>>> From: Metzger, Markus T <markus.t.metzger@intel.com>
>>> Sent: Wednesday, April 10, 2024 9:46 AM
>>> To: gdb-patches@sourceware.org
>>> Cc: pedro@palves.net
>>> Subject: [PATCH v5 0/4] PR gdb/31353
>>>
>>> Reviving an old patch series that was first submitted in Jan'21.
>>>
>>> It fixes issues with breakpoints at the end of the execution history,
>>> including PR gdb/31353, which was submitted in the meantime.
>>>
>>> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31353
>>>
>>> Guinevere Larsen reviewed most of the series and reported an issue with
>>> applying the last patch.  I'm resending the series, rebased on current
>>> master, to hopefully fix that issue.
>>>
>>> The only change to v4 is that a redundant forward declaration was removed.
>>>
>>> The changes are mostly in infrun and require global maintainer approval.
>>>
>>> Markus Metzger (4):
>>>   gdb, infrun, btrace: fix reverse/replay stepping at end of execution
>>>     history
>>>   gdb, infrun, record: fix hang when step-over fails with no-history
>>>   gdb, infrun, record: move no-history notification into normal_stop
>>>   gdb, infrun: fix multi-threaded reverse stepping
>>>
>>> gdb/gdbthread.h                               | 13 +++
>>> gdb/infrun.c                                  | 86 +++++++++++++-----
>>> gdb/infrun.h                                  |  7 --
>>> gdb/record-btrace.c                           | 19 ++--
>>> gdb/testsuite/gdb.btrace/cont-hang.exp        | 43 +++++++++
>>> .../gdb.btrace/implicit-stop-replaying.exp    | 90 +++++++++++++++++++
>>> .../gdb.btrace/multi-thread-break-hang.exp    | 84 +++++++++++++++++
>>> gdb/testsuite/gdb.btrace/step-hang.exp        | 42 +++++++++
>>> gdb/testsuite/gdb.btrace/stepn.exp            | 50 +++++++++++
>>> 9 files changed, 398 insertions(+), 36 deletions(-)
>>> create mode 100644 gdb/testsuite/gdb.btrace/cont-hang.exp
>>> create mode 100644 gdb/testsuite/gdb.btrace/implicit-stop-replaying.exp
>>> create mode 100644 gdb/testsuite/gdb.btrace/multi-thread-break-hang.exp
>>> create mode 100644 gdb/testsuite/gdb.btrace/step-hang.exp
>>> create mode 100644 gdb/testsuite/gdb.btrace/stepn.exp
>>>
>>> --
>>> 2.34.1
> Intel Deutschland GmbH
> Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
> Tel: +49 89 99 8853-0, www.intel.de
> Managing Directors: Sean Fennelly, Jeffrey Schneiderman, Tiffany Doon Silva
> Chairperson of the Supervisory Board: Nicole Lau
> Registered Office: Munich
> Commercial Register: Amtsgericht Muenchen HRB 186928
>


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

* [PING v3] [PATCH v5 0/4] PR gdb/31353
  2024-06-27 19:12     ` Guinevere Larsen
@ 2024-09-13 10:43       ` Metzger, Markus T
  2024-10-09 14:10         ` [PING v4] " Metzger, Markus T
  0 siblings, 1 reply; 16+ messages in thread
From: Metzger, Markus T @ 2024-09-13 10:43 UTC (permalink / raw)
  To: gdb-patches; +Cc: Guinevere Larsen

Kindly pinging.

I rebased and pushed the updated version to users/mmetzger/pr31353.

Regards,
Markus.

>-----Original Message-----
>From: Guinevere Larsen <blarsen@redhat.com>
>Sent: Thursday, June 27, 2024 9:13 PM
>To: Metzger, Markus T <markus.t.metzger@intel.com>; gdb-
>patches@sourceware.org; Guinevere Larsen <blarsen@redhat.com>
>Subject: Re: [PING v2] [PATCH v5 0/4] PR gdb/31353
>
>Pinging on behalf of Makus because I ran into a problem that this series
>fixes and I would love if this was merged :)
>
>--
>Cheers,
>Guinevere Larsen
>She/Her/Hers
>
>On 6/7/24 2:06 AM, Metzger, Markus T wrote:
>> Kindly pinging.
>>
>> Markus.
>>
>>> -----Original Message-----
>>> From: Metzger, Markus T <markus.t.metzger@intel.com>
>>> Sent: Friday, May 3, 2024 7:26 AM
>>> To: gdb-patches@sourceware.org
>>> Cc: pedro@palves.net
>>> Subject: [PING] [PATCH v5 0/4] PR gdb/31353
>>>
>>> Kindly pinging.
>>>
>>> Markus.
>>>
>>>> -----Original Message-----
>>>> From: Metzger, Markus T <markus.t.metzger@intel.com>
>>>> Sent: Wednesday, April 10, 2024 9:46 AM
>>>> To: gdb-patches@sourceware.org
>>>> Cc: pedro@palves.net
>>>> Subject: [PATCH v5 0/4] PR gdb/31353
>>>>
>>>> Reviving an old patch series that was first submitted in Jan'21.
>>>>
>>>> It fixes issues with breakpoints at the end of the execution history,
>>>> including PR gdb/31353, which was submitted in the meantime.
>>>>
>>>> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31353
>>>>
>>>> Guinevere Larsen reviewed most of the series and reported an issue with
>>>> applying the last patch.  I'm resending the series, rebased on current
>>>> master, to hopefully fix that issue.
>>>>
>>>> The only change to v4 is that a redundant forward declaration was
>removed.
>>>>
>>>> The changes are mostly in infrun and require global maintainer approval.
>>>>
>>>> Markus Metzger (4):
>>>>   gdb, infrun, btrace: fix reverse/replay stepping at end of execution
>>>>     history
>>>>   gdb, infrun, record: fix hang when step-over fails with no-history
>>>>   gdb, infrun, record: move no-history notification into normal_stop
>>>>   gdb, infrun: fix multi-threaded reverse stepping
>>>>
>>>> gdb/gdbthread.h                               | 13 +++
>>>> gdb/infrun.c                                  | 86 +++++++++++++-----
>>>> gdb/infrun.h                                  |  7 --
>>>> gdb/record-btrace.c                           | 19 ++--
>>>> gdb/testsuite/gdb.btrace/cont-hang.exp        | 43 +++++++++
>>>> .../gdb.btrace/implicit-stop-replaying.exp    | 90 +++++++++++++++++++
>>>> .../gdb.btrace/multi-thread-break-hang.exp    | 84 +++++++++++++++++
>>>> gdb/testsuite/gdb.btrace/step-hang.exp        | 42 +++++++++
>>>> gdb/testsuite/gdb.btrace/stepn.exp            | 50 +++++++++++
>>>> 9 files changed, 398 insertions(+), 36 deletions(-)
>>>> create mode 100644 gdb/testsuite/gdb.btrace/cont-hang.exp
>>>> create mode 100644 gdb/testsuite/gdb.btrace/implicit-stop-replaying.exp
>>>> create mode 100644 gdb/testsuite/gdb.btrace/multi-thread-break-
>hang.exp
>>>> create mode 100644 gdb/testsuite/gdb.btrace/step-hang.exp
>>>> create mode 100644 gdb/testsuite/gdb.btrace/stepn.exp
>>>>
>>>> --
>>>> 2.34.1
>> Intel Deutschland GmbH
>> Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
>> Tel: +49 89 99 8853-0, www.intel.de
>> Managing Directors: Sean Fennelly, Jeffrey Schneiderman, Tiffany Doon Silva
>> Chairperson of the Supervisory Board: Nicole Lau
>> Registered Office: Munich
>> Commercial Register: Amtsgericht Muenchen HRB 186928
>>

Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Sean Fennelly, Jeffrey Schneiderman, Tiffany Doon Silva
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928

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

* RE: [PING v4] [PATCH v5 0/4] PR gdb/31353
  2024-09-13 10:43       ` [PING v3] " Metzger, Markus T
@ 2024-10-09 14:10         ` Metzger, Markus T
  0 siblings, 0 replies; 16+ messages in thread
From: Metzger, Markus T @ 2024-10-09 14:10 UTC (permalink / raw)
  To: gdb-patches

Kindly pinging.

Markus.

>-----Original Message-----
>From: Metzger, Markus T <markus.t.metzger@intel.com>
>Sent: Friday, September 13, 2024 12:43 PM
>To: gdb-patches@sourceware.org
>Cc: Guinevere Larsen <blarsen@redhat.com>
>Subject: [PING v3] [PATCH v5 0/4] PR gdb/31353
>
>Kindly pinging.
>
>I rebased and pushed the updated version to users/mmetzger/pr31353.
>
>Regards,
>Markus.
>
>>-----Original Message-----
>>From: Guinevere Larsen <blarsen@redhat.com>
>>Sent: Thursday, June 27, 2024 9:13 PM
>>To: Metzger, Markus T <markus.t.metzger@intel.com>; gdb-
>>patches@sourceware.org; Guinevere Larsen <blarsen@redhat.com>
>>Subject: Re: [PING v2] [PATCH v5 0/4] PR gdb/31353
>>
>>Pinging on behalf of Makus because I ran into a problem that this series
>>fixes and I would love if this was merged :)
>>
>>--
>>Cheers,
>>Guinevere Larsen
>>She/Her/Hers
>>
>>On 6/7/24 2:06 AM, Metzger, Markus T wrote:
>>> Kindly pinging.
>>>
>>> Markus.
>>>
>>>> -----Original Message-----
>>>> From: Metzger, Markus T <markus.t.metzger@intel.com>
>>>> Sent: Friday, May 3, 2024 7:26 AM
>>>> To: gdb-patches@sourceware.org
>>>> Cc: pedro@palves.net
>>>> Subject: [PING] [PATCH v5 0/4] PR gdb/31353
>>>>
>>>> Kindly pinging.
>>>>
>>>> Markus.
>>>>
>>>>> -----Original Message-----
>>>>> From: Metzger, Markus T <markus.t.metzger@intel.com>
>>>>> Sent: Wednesday, April 10, 2024 9:46 AM
>>>>> To: gdb-patches@sourceware.org
>>>>> Cc: pedro@palves.net
>>>>> Subject: [PATCH v5 0/4] PR gdb/31353
>>>>>
>>>>> Reviving an old patch series that was first submitted in Jan'21.
>>>>>
>>>>> It fixes issues with breakpoints at the end of the execution history,
>>>>> including PR gdb/31353, which was submitted in the meantime.
>>>>>
>>>>> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31353
>>>>>
>>>>> Guinevere Larsen reviewed most of the series and reported an issue with
>>>>> applying the last patch.  I'm resending the series, rebased on current
>>>>> master, to hopefully fix that issue.
>>>>>
>>>>> The only change to v4 is that a redundant forward declaration was
>>removed.
>>>>>
>>>>> The changes are mostly in infrun and require global maintainer approval.
>>>>>
>>>>> Markus Metzger (4):
>>>>>   gdb, infrun, btrace: fix reverse/replay stepping at end of execution
>>>>>     history
>>>>>   gdb, infrun, record: fix hang when step-over fails with no-history
>>>>>   gdb, infrun, record: move no-history notification into normal_stop
>>>>>   gdb, infrun: fix multi-threaded reverse stepping
>>>>>
>>>>> gdb/gdbthread.h                               | 13 +++
>>>>> gdb/infrun.c                                  | 86 +++++++++++++-----
>>>>> gdb/infrun.h                                  |  7 --
>>>>> gdb/record-btrace.c                           | 19 ++--
>>>>> gdb/testsuite/gdb.btrace/cont-hang.exp        | 43 +++++++++
>>>>> .../gdb.btrace/implicit-stop-replaying.exp    | 90 +++++++++++++++++++
>>>>> .../gdb.btrace/multi-thread-break-hang.exp    | 84 +++++++++++++++++
>>>>> gdb/testsuite/gdb.btrace/step-hang.exp        | 42 +++++++++
>>>>> gdb/testsuite/gdb.btrace/stepn.exp            | 50 +++++++++++
>>>>> 9 files changed, 398 insertions(+), 36 deletions(-)
>>>>> create mode 100644 gdb/testsuite/gdb.btrace/cont-hang.exp
>>>>> create mode 100644 gdb/testsuite/gdb.btrace/implicit-stop-
>replaying.exp
>>>>> create mode 100644 gdb/testsuite/gdb.btrace/multi-thread-break-
>>hang.exp
>>>>> create mode 100644 gdb/testsuite/gdb.btrace/step-hang.exp
>>>>> create mode 100644 gdb/testsuite/gdb.btrace/stepn.exp
>>>>>
>>>>> --
>>>>> 2.34.1
>>> Intel Deutschland GmbH
>>> Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
>>> Tel: +49 89 99 8853-0, www.intel.de
>>> Managing Directors: Sean Fennelly, Jeffrey Schneiderman, Tiffany Doon
>Silva
>>> Chairperson of the Supervisory Board: Nicole Lau
>>> Registered Office: Munich
>>> Commercial Register: Amtsgericht Muenchen HRB 186928
>>>

Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Sean Fennelly, Jeffrey Schneiderman, Tiffany Doon Silva
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928

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

* Re: [PATCH v5 0/4] PR gdb/31353
  2024-04-10  7:46 [PATCH v5 0/4] PR gdb/31353 Markus Metzger
                   ` (4 preceding siblings ...)
  2024-05-03  5:26 ` [PING] [PATCH v5 0/4] PR gdb/31353 Metzger, Markus T
@ 2024-10-21  8:45 ` Andrew Burgess
  2024-10-21  9:13 ` Andrew Burgess
  6 siblings, 0 replies; 16+ messages in thread
From: Andrew Burgess @ 2024-10-21  8:45 UTC (permalink / raw)
  To: Markus Metzger, gdb-patches; +Cc: pedro

Markus Metzger <markus.t.metzger@intel.com> writes:

> Reviving an old patch series that was first submitted in Jan'21.
>
> It fixes issues with breakpoints at the end of the execution history,
> including PR gdb/31353, which was submitted in the meantime.
>
> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31353

You should include this 'Bug: ...' tag at the bottom of every commit
message for commits that relate to this bug.  Do 'git log' and search
for 'Bug:' if I've not been clear what I mean.

No need to repost with this change, I'm going to have a read through the
rest of the series this week.

Thanks,
Andrew


>
> Guinevere Larsen reviewed most of the series and reported an issue with
> applying the last patch.  I'm resending the series, rebased on current
> master, to hopefully fix that issue.
>
> The only change to v4 is that a redundant forward declaration was removed.
>
> The changes are mostly in infrun and require global maintainer approval.
>
> Markus Metzger (4):
>   gdb, infrun, btrace: fix reverse/replay stepping at end of execution
>     history
>   gdb, infrun, record: fix hang when step-over fails with no-history
>   gdb, infrun, record: move no-history notification into normal_stop
>   gdb, infrun: fix multi-threaded reverse stepping
>
>  gdb/gdbthread.h                               | 13 +++
>  gdb/infrun.c                                  | 86 +++++++++++++-----
>  gdb/infrun.h                                  |  7 --
>  gdb/record-btrace.c                           | 19 ++--
>  gdb/testsuite/gdb.btrace/cont-hang.exp        | 43 +++++++++
>  .../gdb.btrace/implicit-stop-replaying.exp    | 90 +++++++++++++++++++
>  .../gdb.btrace/multi-thread-break-hang.exp    | 84 +++++++++++++++++
>  gdb/testsuite/gdb.btrace/step-hang.exp        | 42 +++++++++
>  gdb/testsuite/gdb.btrace/stepn.exp            | 50 +++++++++++
>  9 files changed, 398 insertions(+), 36 deletions(-)
>  create mode 100644 gdb/testsuite/gdb.btrace/cont-hang.exp
>  create mode 100644 gdb/testsuite/gdb.btrace/implicit-stop-replaying.exp
>  create mode 100644 gdb/testsuite/gdb.btrace/multi-thread-break-hang.exp
>  create mode 100644 gdb/testsuite/gdb.btrace/step-hang.exp
>  create mode 100644 gdb/testsuite/gdb.btrace/stepn.exp
>
> -- 
> 2.34.1
>
> Intel Deutschland GmbH
> Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
> Tel: +49 89 99 8853-0, www.intel.de <http://www.intel.de>
> Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva  
> Chairperson of the Supervisory Board: Nicole Lau
> Registered Office: Munich
> Commercial Register: Amtsgericht Muenchen HRB 186928


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

* Re: [PATCH v5 0/4] PR gdb/31353
  2024-04-10  7:46 [PATCH v5 0/4] PR gdb/31353 Markus Metzger
                   ` (5 preceding siblings ...)
  2024-10-21  8:45 ` Andrew Burgess
@ 2024-10-21  9:13 ` Andrew Burgess
  2024-10-21  9:46   ` Metzger, Markus T
  6 siblings, 1 reply; 16+ messages in thread
From: Andrew Burgess @ 2024-10-21  9:13 UTC (permalink / raw)
  To: Markus Metzger, gdb-patches; +Cc: pedro

Markus Metzger <markus.t.metzger@intel.com> writes:

> Reviving an old patch series that was first submitted in Jan'21.
>
> It fixes issues with breakpoints at the end of the execution history,
> including PR gdb/31353, which was submitted in the meantime.
>
> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31353
>
> Guinevere Larsen reviewed most of the series and reported an issue with
> applying the last patch.  I'm resending the series, rebased on current
> master, to hopefully fix that issue.
>
> The only change to v4 is that a redundant forward declaration was removed.
>
> The changes are mostly in infrun and require global maintainer approval.
>
> Markus Metzger (4):
>   gdb, infrun, btrace: fix reverse/replay stepping at end of execution
>     history
>   gdb, infrun, record: fix hang when step-over fails with no-history
>   gdb, infrun, record: move no-history notification into normal_stop
>   gdb, infrun: fix multi-threaded reverse stepping
>
>  gdb/gdbthread.h                               | 13 +++
>  gdb/infrun.c                                  | 86 +++++++++++++-----
>  gdb/infrun.h                                  |  7 --
>  gdb/record-btrace.c                           | 19 ++--
>  gdb/testsuite/gdb.btrace/cont-hang.exp        | 43 +++++++++
>  .../gdb.btrace/implicit-stop-replaying.exp    | 90 +++++++++++++++++++
>  .../gdb.btrace/multi-thread-break-hang.exp    | 84 +++++++++++++++++
>  gdb/testsuite/gdb.btrace/step-hang.exp        | 42 +++++++++
>  gdb/testsuite/gdb.btrace/stepn.exp            | 50 +++++++++++

I built this series off current master, ran these tests and saw 6
unexpected failures:

  FAIL: gdb.btrace/stepn.exp: stepi: stepi 5
  FAIL: gdb.btrace/stepn.exp: step: step 5
  FAIL: gdb.btrace/stepn.exp: next: next 5
  FAIL: gdb.btrace/multi-thread-break-hang.exp: stepi.1
  FAIL: gdb.btrace/multi-thread-break-hang.exp: stepi.2
  FAIL: gdb.btrace/multi-thread-break-hang.exp: stepi.3

The full gdb.log is included below.  I'll hold off reviewing this series
and take a look at the other (for PR gdb/19340) for now.  If there's any
additional information you need to help debug the failures, please just
ask.

Thanks,
Andrew

---

Test run by andrew on Mon Oct 21 10:08:53 2024
Native configuration is x86_64-pc-linux-gnu

		=== gdb tests ===

Schedule of variations:
    unix

Running target unix
Using /home/andrew/.software/packages/dejagnu/1.6.3/share/dejagnu/baseboards/unix.exp as board description file for target.
Using /home/andrew/.software/packages/dejagnu/1.6.3/share/dejagnu/config/unix.exp as generic interface file for target.
Using /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/../../../src.dev-d/gdb/testsuite/config/unix.exp as tool-and-target-specific interface file.
Running /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/../../../src.dev-d/gdb/testsuite/gdb.btrace/stepn.exp ...
Executing on build: rm -rf /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/outputs/gdb.btrace/stepn    (timeout = 300)
builtin_spawn -ignore SIGHUP rm -rf /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/outputs/gdb.btrace/stepn
gdb_do_cache: allow_btrace_tests (  )
gdb_do_cache: universal_compile_options_c (  )
Executing on host: gcc    -fdiagnostics-color=never -c -o /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/temp/2224305/ccopts.o /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/temp/2224305/ccopts.c    (timeout = 300)
builtin_spawn -ignore SIGHUP gcc -fdiagnostics-color=never -c -o /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/temp/2224305/ccopts.o /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/temp/2224305/ccopts.c
get_compiler_info: gcc-9-3-1
Executing on host: gcc  -fno-stack-protector /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/temp/2224305/allow_btrace_tests.c  -fdiagnostics-color=never -w -g  -lm   -o /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/temp/2224305/allow_btrace_tests.x    (timeout = 300)
builtin_spawn -ignore SIGHUP gcc -fno-stack-protector /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/temp/2224305/allow_btrace_tests.c -fdiagnostics-color=never -w -g -lm -o /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/temp/2224305/allow_btrace_tests.x
builtin_spawn /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/../../gdb/gdb -nw -nx -q -iex set height 0 -iex set width 0 -data-directory /home/andrew/projects/binutils-gdb/build.dev-d/gdb/data-directory
(gdb) set height 0
(gdb) set width 0
(gdb) dir
Reinitialize source path to empty? (y or n) y
Source directories searched: $cdir:$cwd
(gdb) dir /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/../../../src.dev-d/gdb/testsuite/gdb.btrace
Source directories searched: /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/../../../src.dev-d/gdb/testsuite/gdb.btrace:$cdir:$cwd
(gdb) kill
The program is not being run.
(gdb) file /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/temp/2224305/allow_btrace_tests.x
Reading symbols from /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/temp/2224305/allow_btrace_tests.x...
(gdb) delete breakpoints
(gdb) info breakpoints
No breakpoints, watchpoints, tracepoints, or catchpoints.
(gdb) break -qualified main
Breakpoint 1 at 0x40110a: file /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/temp/2224305/allow_btrace_tests.c, line 1.
(gdb) run 
Starting program: /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/temp/2224305/allow_btrace_tests.x 

Breakpoint 1, main () at /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/temp/2224305/allow_btrace_tests.c:1
warning: 1	/home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/temp/2224305/allow_btrace_tests.c: No such file or directory
(gdb) record btrace
(gdb) gdb_caching_proc allow_btrace_tests caused gdb_exit to be called
  gdb_caching_proc allow_btrace_tests marked as called
  gdb_caching_proc universal_compile_options_c marked as called
gdb_do_cache: universal_compile_options_c (  )
Executing on host: gcc  -fno-stack-protector  -fdiagnostics-color=never -c -g  -o /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/outputs/gdb.btrace/stepn/stepn0.o /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/../../../src.dev-d/gdb/testsuite/gdb.btrace/record_goto.c    (timeout = 300)
builtin_spawn -ignore SIGHUP gcc -fno-stack-protector -fdiagnostics-color=never -c -g -o /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/outputs/gdb.btrace/stepn/stepn0.o /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/../../../src.dev-d/gdb/testsuite/gdb.btrace/record_goto.c
gdb_do_cache: universal_compile_options_c (  )
Executing on host: gcc  -fno-stack-protector /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/outputs/gdb.btrace/stepn/stepn0.o  -fdiagnostics-color=never -g  -lm   -o /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/outputs/gdb.btrace/stepn/stepn    (timeout = 300)
builtin_spawn -ignore SIGHUP gcc -fno-stack-protector /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/outputs/gdb.btrace/stepn/stepn0.o -fdiagnostics-color=never -g -lm -o /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/outputs/gdb.btrace/stepn/stepn
builtin_spawn /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/../../gdb/gdb -nw -nx -q -iex set height 0 -iex set width 0 -data-directory /home/andrew/projects/binutils-gdb/build.dev-d/gdb/data-directory
(gdb) set height 0
(gdb) set width 0
(gdb) dir
Reinitialize source path to empty? (y or n) y
Source directories searched: $cdir:$cwd
(gdb) dir /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/../../../src.dev-d/gdb/testsuite/gdb.btrace
Source directories searched: /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/../../../src.dev-d/gdb/testsuite/gdb.btrace:$cdir:$cwd
(gdb) kill
The program is not being run.
(gdb) file /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/outputs/gdb.btrace/stepn/stepn
Reading symbols from /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/outputs/gdb.btrace/stepn/stepn...
(gdb) delete breakpoints
(gdb) info breakpoints
No breakpoints, watchpoints, tracepoints, or catchpoints.
(gdb) break -qualified main
Breakpoint 1 at 0x401144: file /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/../../../src.dev-d/gdb/testsuite/gdb.btrace/record_goto.c, line 49.
(gdb) run 
Starting program: /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/outputs/gdb.btrace/stepn/stepn 

Breakpoint 1, main () at /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/../../../src.dev-d/gdb/testsuite/gdb.btrace/record_goto.c:49
49	  fun4 ();	/* main.2 */
(gdb) record btrace
(gdb) PASS: gdb.btrace/stepn.exp: record btrace
next
50	  return 0;	/* main.3 */
(gdb) PASS: gdb.btrace/stepn.exp: next
reverse-stepi
0x000000000040113f in fun4 () at /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/../../../src.dev-d/gdb/testsuite/gdb.btrace/record_goto.c:44
44	}		/* fun4.5 */
(gdb) PASS: gdb.btrace/stepn.exp: stepi: reverse-stepi
stepi 5

Reached end of recorded history; stopping.
Following forward execution will be added to history.
50	  return 0;	/* main.3 */
(gdb) FAIL: gdb.btrace/stepn.exp: stepi: stepi 5
reverse-step
fun4 () at /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/../../../src.dev-d/gdb/testsuite/gdb.btrace/record_goto.c:44
44	}		/* fun4.5 */
(gdb) PASS: gdb.btrace/stepn.exp: step: reverse-step
step 5

Reached end of recorded history; stopping.
Following forward execution will be added to history.
50	  return 0;	/* main.3 */
(gdb) FAIL: gdb.btrace/stepn.exp: step: step 5
reverse-next

Breakpoint 1, main () at /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/../../../src.dev-d/gdb/testsuite/gdb.btrace/record_goto.c:49
49	  fun4 ();	/* main.2 */
(gdb) PASS: gdb.btrace/stepn.exp: next: reverse-next
next 5

Reached end of recorded history; stopping.
Following forward execution will be added to history.
main () at /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/../../../src.dev-d/gdb/testsuite/gdb.btrace/record_goto.c:50
50	  return 0;	/* main.3 */
(gdb) FAIL: gdb.btrace/stepn.exp: next: next 5
testcase /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/../../../src.dev-d/gdb/testsuite/gdb.btrace/stepn.exp completed in 1 seconds
Running /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/../../../src.dev-d/gdb/testsuite/gdb.btrace/implicit-stop-replaying.exp ...
Executing on build: rm -rf /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/outputs/gdb.btrace/implicit-stop-replaying    (timeout = 300)
builtin_spawn -ignore SIGHUP rm -rf /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/outputs/gdb.btrace/implicit-stop-replaying
gdb_do_cache: allow_btrace_tests (  )
gdb_caching_proc allow_btrace_tests caused gdb_exit to be called
  gdb_caching_proc allow_btrace_tests marked as called
  gdb_caching_proc universal_compile_options_c marked as called
gdb_do_cache: universal_compile_options_c (  )
Executing on host: gcc  -fno-stack-protector  -fdiagnostics-color=never -c -g  -o /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/outputs/gdb.btrace/implicit-stop-replaying/implicit-stop-replaying0.o /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/../../../src.dev-d/gdb/testsuite/gdb.btrace/multi-thread-step.c    (timeout = 300)
builtin_spawn -ignore SIGHUP gcc -fno-stack-protector -fdiagnostics-color=never -c -g -o /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/outputs/gdb.btrace/implicit-stop-replaying/implicit-stop-replaying0.o /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/../../../src.dev-d/gdb/testsuite/gdb.btrace/multi-thread-step.c
gdb_do_cache: universal_compile_options_c (  )
Executing on host: gcc  -fno-stack-protector /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/outputs/gdb.btrace/implicit-stop-replaying/implicit-stop-replaying0.o  -fdiagnostics-color=never -g  -lpthreads -lm   -o /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/outputs/gdb.btrace/implicit-stop-replaying/implicit-stop-replaying    (timeout = 300)
builtin_spawn -ignore SIGHUP gcc -fno-stack-protector /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/outputs/gdb.btrace/implicit-stop-replaying/implicit-stop-replaying0.o -fdiagnostics-color=never -g -lpthreads -lm -o /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/outputs/gdb.btrace/implicit-stop-replaying/implicit-stop-replaying
/usr/bin/ld: cannot find -lpthreads
collect2: error: ld returned 1 exit status
compiler exited with status 1
output is:
/usr/bin/ld: cannot find -lpthreads
collect2: error: ld returned 1 exit status

gdb_do_cache: universal_compile_options_c (  )
Executing on host: gcc  -fno-stack-protector /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/outputs/gdb.btrace/implicit-stop-replaying/implicit-stop-replaying0.o  -fdiagnostics-color=never -g  -lpthread -lm   -o /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/outputs/gdb.btrace/implicit-stop-replaying/implicit-stop-replaying    (timeout = 300)
builtin_spawn -ignore SIGHUP gcc -fno-stack-protector /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/outputs/gdb.btrace/implicit-stop-replaying/implicit-stop-replaying0.o -fdiagnostics-color=never -g -lpthread -lm -o /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/outputs/gdb.btrace/implicit-stop-replaying/implicit-stop-replaying
PASS: gdb.btrace/implicit-stop-replaying.exp: successfully compiled posix threads test case
builtin_spawn /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/../../gdb/gdb -nw -nx -q -iex set height 0 -iex set width 0 -data-directory /home/andrew/projects/binutils-gdb/build.dev-d/gdb/data-directory
(gdb) set height 0
(gdb) set width 0
(gdb) dir
Reinitialize source path to empty? (y or n) y
Source directories searched: $cdir:$cwd
(gdb) dir /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/../../../src.dev-d/gdb/testsuite/gdb.btrace
Source directories searched: /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/../../../src.dev-d/gdb/testsuite/gdb.btrace:$cdir:$cwd
(gdb) kill
The program is not being run.
(gdb) file /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/outputs/gdb.btrace/implicit-stop-replaying/implicit-stop-replaying
Reading symbols from /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/outputs/gdb.btrace/implicit-stop-replaying/implicit-stop-replaying...
(gdb) delete breakpoints
(gdb) info breakpoints
No breakpoints, watchpoints, tracepoints, or catchpoints.
(gdb) break -qualified main
Breakpoint 1 at 0x4011a8: file /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/../../../src.dev-d/gdb/testsuite/gdb.btrace/multi-thread-step.c, line 44.
(gdb) run 
Starting program: /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/outputs/gdb.btrace/implicit-stop-replaying/implicit-stop-replaying 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".

Breakpoint 1, main () at /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/../../../src.dev-d/gdb/testsuite/gdb.btrace/multi-thread-step.c:44
44	  pthread_barrier_init (&barrier, NULL, 2);
(gdb) break multi-thread-step.c:30
Breakpoint 2 at 0x40117c: file /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/../../../src.dev-d/gdb/testsuite/gdb.btrace/multi-thread-step.c, line 30.
(gdb) continue
Continuing.
[New Thread 0x7ffff7c5c700 (LWP 2224488)]
[Switching to Thread 0x7ffff7c5c700 (LWP 2224488)]

Thread 2 "implicit-stop-r" hit Breakpoint 2, test (arg=0x0) at /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/../../../src.dev-d/gdb/testsuite/gdb.btrace/multi-thread-step.c:30
30	  global = 42; /* bp.1 */
(gdb) PASS: gdb.btrace/implicit-stop-replaying.exp: continue to breakpoint: continue to bp.1
info threads
  Id   Target Id                                             Frame 
  1    Thread 0x7ffff7c5e100 (LWP 2224484) "implicit-stop-r" test (arg=0x0) at /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/../../../src.dev-d/gdb/testsuite/gdb.btrace/multi-thread-step.c:30
* 2    Thread 0x7ffff7c5c700 (LWP 2224488) "implicit-stop-r" test (arg=0x0) at /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/../../../src.dev-d/gdb/testsuite/gdb.btrace/multi-thread-step.c:30
(gdb) PASS: gdb.btrace/implicit-stop-replaying.exp: info threads
record btrace
(gdb) PASS: gdb.btrace/implicit-stop-replaying.exp: record btrace
delete breakpoints
Delete all breakpoints, watchpoints, tracepoints, and catchpoints? (y or n) y
(gdb) info breakpoints
No breakpoints, watchpoints, tracepoints, or catchpoints.
(gdb) break multi-thread-step.c:34
Breakpoint 3 at 0x401190: file /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/../../../src.dev-d/gdb/testsuite/gdb.btrace/multi-thread-step.c, line 34.
(gdb) continue
Continuing.

Thread 2 "implicit-stop-r" hit Breakpoint 3, test (arg=0x0) at /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/../../../src.dev-d/gdb/testsuite/gdb.btrace/multi-thread-step.c:34
34	  global = 42; /* bp.2 */
(gdb) PASS: gdb.btrace/implicit-stop-replaying.exp: continue to breakpoint: continue to bp.2
thread
[Current thread is 2 (Thread 0x7ffff7c5c700 (LWP 2224488))]
(gdb) set scheduler-locking replay
(gdb) PASS: gdb.btrace/implicit-stop-replaying.exp: set scheduler-locking replay
delete breakpoints
Delete all breakpoints, watchpoints, tracepoints, and catchpoints? (y or n) y
(gdb) info breakpoints
No breakpoints, watchpoints, tracepoints, or catchpoints.
(gdb) thread apply 1 reverse-stepi

Thread 1 (Thread 0x7ffff7c5e100 (LWP 2224484) "implicit-stop-r"):
0x00007ffff7f7f135 in pthread_barrier_wait () from /lib64/libpthread.so.0
(gdb) PASS: gdb.btrace/implicit-stop-replaying.exp: thread apply 1 reverse-stepi
thread apply 1 info record

Thread 1 (Thread 0x7ffff7c5e100 (LWP 2224484) "implicit-stop-r"):
Active record target: record-btrace
Recording format: Intel Processor Trace.
Buffer size: 16kB.
Recorded 70 instructions in 3 functions (0 gaps) for thread 1 (Thread 0x7ffff7c5e100 (LWP 2224484)).
Replay in progress.  At instruction 70.
(gdb) PASS: gdb.btrace/implicit-stop-replaying.exp: other thread is replaying
next
36	  return arg;
(gdb) PASS: gdb.btrace/implicit-stop-replaying.exp: next
thread apply 1 info record

Thread 1 (Thread 0x7ffff7c5e100 (LWP 2224484) "implicit-stop-r"):
Active record target: record-btrace
Recording format: Intel Processor Trace.
Buffer size: 16kB.
Recorded 825 instructions in 26 functions (0 gaps) for thread 1 (Thread 0x7ffff7c5e100 (LWP 2224484)).
(gdb) PASS: gdb.btrace/implicit-stop-replaying.exp: other thread stopped replaying
testcase /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/../../../src.dev-d/gdb/testsuite/gdb.btrace/implicit-stop-replaying.exp completed in 0 seconds
Running /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/../../../src.dev-d/gdb/testsuite/gdb.btrace/step-hang.exp ...
Executing on build: rm -rf /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/outputs/gdb.btrace/step-hang    (timeout = 300)
builtin_spawn -ignore SIGHUP rm -rf /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/outputs/gdb.btrace/step-hang
gdb_do_cache: allow_btrace_tests (  )
gdb_caching_proc allow_btrace_tests caused gdb_exit to be called
  gdb_caching_proc allow_btrace_tests marked as called
  gdb_caching_proc universal_compile_options_c marked as called
gdb_do_cache: universal_compile_options_c (  )
Executing on host: gcc  -fno-stack-protector  -fdiagnostics-color=never -c -g  -o /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/outputs/gdb.btrace/step-hang/step-hang0.o /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/../../../src.dev-d/gdb/testsuite/gdb.btrace/record_goto.c    (timeout = 300)
builtin_spawn -ignore SIGHUP gcc -fno-stack-protector -fdiagnostics-color=never -c -g -o /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/outputs/gdb.btrace/step-hang/step-hang0.o /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/../../../src.dev-d/gdb/testsuite/gdb.btrace/record_goto.c
gdb_do_cache: universal_compile_options_c (  )
Executing on host: gcc  -fno-stack-protector /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/outputs/gdb.btrace/step-hang/step-hang0.o  -fdiagnostics-color=never -g  -lm   -o /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/outputs/gdb.btrace/step-hang/step-hang    (timeout = 300)
builtin_spawn -ignore SIGHUP gcc -fno-stack-protector /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/outputs/gdb.btrace/step-hang/step-hang0.o -fdiagnostics-color=never -g -lm -o /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/outputs/gdb.btrace/step-hang/step-hang
builtin_spawn /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/../../gdb/gdb -nw -nx -q -iex set height 0 -iex set width 0 -data-directory /home/andrew/projects/binutils-gdb/build.dev-d/gdb/data-directory
(gdb) set height 0
(gdb) set width 0
(gdb) dir
Reinitialize source path to empty? (y or n) y
Source directories searched: $cdir:$cwd
(gdb) dir /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/../../../src.dev-d/gdb/testsuite/gdb.btrace
Source directories searched: /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/../../../src.dev-d/gdb/testsuite/gdb.btrace:$cdir:$cwd
(gdb) kill
The program is not being run.
(gdb) file /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/outputs/gdb.btrace/step-hang/step-hang
Reading symbols from /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/outputs/gdb.btrace/step-hang/step-hang...
(gdb) delete breakpoints
(gdb) info breakpoints
No breakpoints, watchpoints, tracepoints, or catchpoints.
(gdb) break -qualified main
Breakpoint 1 at 0x401144: file /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/../../../src.dev-d/gdb/testsuite/gdb.btrace/record_goto.c, line 49.
(gdb) run 
Starting program: /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/outputs/gdb.btrace/step-hang/step-hang 

Breakpoint 1, main () at /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/../../../src.dev-d/gdb/testsuite/gdb.btrace/record_goto.c:49
49	  fun4 ();	/* main.2 */
(gdb) record btrace
(gdb) PASS: gdb.btrace/step-hang.exp: record btrace
next
50	  return 0;	/* main.3 */
(gdb) PASS: gdb.btrace/step-hang.exp: next
reverse-stepi
0x000000000040113f in fun4 () at /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/../../../src.dev-d/gdb/testsuite/gdb.btrace/record_goto.c:44
44	}		/* fun4.5 */
(gdb) PASS: gdb.btrace/step-hang.exp: reverse-stepi
break
Breakpoint 2 at 0x40113f: file /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/../../../src.dev-d/gdb/testsuite/gdb.btrace/record_goto.c, line 44.
(gdb) PASS: gdb.btrace/step-hang.exp: break
step
main () at /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/../../../src.dev-d/gdb/testsuite/gdb.btrace/record_goto.c:50
50	  return 0;	/* main.3 */
(gdb) PASS: gdb.btrace/step-hang.exp: step
continue
Continuing.
[Inferior 1 (process 2224541) exited normally]
(gdb) PASS: gdb.btrace/step-hang.exp: continue until exit
testcase /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/../../../src.dev-d/gdb/testsuite/gdb.btrace/step-hang.exp completed in 1 seconds
Running /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/../../../src.dev-d/gdb/testsuite/gdb.btrace/multi-thread-break-hang.exp ...
Executing on build: rm -rf /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/outputs/gdb.btrace/multi-thread-break-hang    (timeout = 300)
builtin_spawn -ignore SIGHUP rm -rf /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/outputs/gdb.btrace/multi-thread-break-hang
gdb_do_cache: allow_btrace_tests (  )
gdb_caching_proc allow_btrace_tests caused gdb_exit to be called
  gdb_caching_proc allow_btrace_tests marked as called
  gdb_caching_proc universal_compile_options_c marked as called
gdb_do_cache: universal_compile_options_c (  )
Executing on host: gcc  -fno-stack-protector  -fdiagnostics-color=never -c -g  -o /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/outputs/gdb.btrace/multi-thread-break-hang/multi-thread-break-hang0.o /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/../../../src.dev-d/gdb/testsuite/gdb.btrace/multi-thread-step.c    (timeout = 300)
builtin_spawn -ignore SIGHUP gcc -fno-stack-protector -fdiagnostics-color=never -c -g -o /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/outputs/gdb.btrace/multi-thread-break-hang/multi-thread-break-hang0.o /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/../../../src.dev-d/gdb/testsuite/gdb.btrace/multi-thread-step.c
gdb_do_cache: universal_compile_options_c (  )
Executing on host: gcc  -fno-stack-protector /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/outputs/gdb.btrace/multi-thread-break-hang/multi-thread-break-hang0.o  -fdiagnostics-color=never -g  -lpthreads -lm   -o /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/outputs/gdb.btrace/multi-thread-break-hang/multi-thread-break-hang    (timeout = 300)
builtin_spawn -ignore SIGHUP gcc -fno-stack-protector /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/outputs/gdb.btrace/multi-thread-break-hang/multi-thread-break-hang0.o -fdiagnostics-color=never -g -lpthreads -lm -o /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/outputs/gdb.btrace/multi-thread-break-hang/multi-thread-break-hang
/usr/bin/ld: cannot find -lpthreads
collect2: error: ld returned 1 exit status
compiler exited with status 1
output is:
/usr/bin/ld: cannot find -lpthreads
collect2: error: ld returned 1 exit status

gdb_do_cache: universal_compile_options_c (  )
Executing on host: gcc  -fno-stack-protector /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/outputs/gdb.btrace/multi-thread-break-hang/multi-thread-break-hang0.o  -fdiagnostics-color=never -g  -lpthread -lm   -o /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/outputs/gdb.btrace/multi-thread-break-hang/multi-thread-break-hang    (timeout = 300)
builtin_spawn -ignore SIGHUP gcc -fno-stack-protector /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/outputs/gdb.btrace/multi-thread-break-hang/multi-thread-break-hang0.o -fdiagnostics-color=never -g -lpthread -lm -o /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/outputs/gdb.btrace/multi-thread-break-hang/multi-thread-break-hang
PASS: gdb.btrace/multi-thread-break-hang.exp: successfully compiled posix threads test case
builtin_spawn /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/../../gdb/gdb -nw -nx -q -iex set height 0 -iex set width 0 -data-directory /home/andrew/projects/binutils-gdb/build.dev-d/gdb/data-directory
(gdb) set height 0
(gdb) set width 0
(gdb) dir
Reinitialize source path to empty? (y or n) y
Source directories searched: $cdir:$cwd
(gdb) dir /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/../../../src.dev-d/gdb/testsuite/gdb.btrace
Source directories searched: /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/../../../src.dev-d/gdb/testsuite/gdb.btrace:$cdir:$cwd
(gdb) kill
The program is not being run.
(gdb) file /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/outputs/gdb.btrace/multi-thread-break-hang/multi-thread-break-hang
Reading symbols from /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/outputs/gdb.btrace/multi-thread-break-hang/multi-thread-break-hang...
(gdb) delete breakpoints
(gdb) info breakpoints
No breakpoints, watchpoints, tracepoints, or catchpoints.
(gdb) break -qualified main
Breakpoint 1 at 0x4011a8: file /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/../../../src.dev-d/gdb/testsuite/gdb.btrace/multi-thread-step.c, line 44.
(gdb) run 
Starting program: /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/outputs/gdb.btrace/multi-thread-break-hang/multi-thread-break-hang 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".

Breakpoint 1, main () at /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/../../../src.dev-d/gdb/testsuite/gdb.btrace/multi-thread-step.c:44
44	  pthread_barrier_init (&barrier, NULL, 2);
(gdb) break multi-thread-step.c:30
Breakpoint 2 at 0x40117c: file /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/../../../src.dev-d/gdb/testsuite/gdb.btrace/multi-thread-step.c, line 30.
(gdb) continue
Continuing.
[New Thread 0x7ffff7c5c700 (LWP 2224606)]
[Switching to Thread 0x7ffff7c5c700 (LWP 2224606)]

Thread 2 "multi-thread-br" hit Breakpoint 2, test (arg=0x0) at /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/../../../src.dev-d/gdb/testsuite/gdb.btrace/multi-thread-step.c:30
30	  global = 42; /* bp.1 */
(gdb) PASS: gdb.btrace/multi-thread-break-hang.exp: continue to breakpoint: continue to bp.1
record btrace
(gdb) PASS: gdb.btrace/multi-thread-break-hang.exp: record btrace
delete breakpoints
Delete all breakpoints, watchpoints, tracepoints, and catchpoints? (y or n) y
(gdb) info breakpoints
No breakpoints, watchpoints, tracepoints, or catchpoints.
(gdb) break multi-thread-step.c:34
Breakpoint 3 at 0x401190: file /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/../../../src.dev-d/gdb/testsuite/gdb.btrace/multi-thread-step.c, line 34.
(gdb) continue
Continuing.

Thread 2 "multi-thread-br" hit Breakpoint 3, test (arg=0x0) at /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/../../../src.dev-d/gdb/testsuite/gdb.btrace/multi-thread-step.c:34
34	  global = 42; /* bp.2 */
(gdb) PASS: gdb.btrace/multi-thread-break-hang.exp: continue to breakpoint: continue to bp.2
print /d $_thread
$1 = 2
(gdb) PASS: gdb.btrace/multi-thread-break-hang.exp: get integer valueof "$_thread"
set scheduler-locking step
(gdb) PASS: gdb.btrace/multi-thread-break-hang.exp: set scheduler-locking step
thread apply 1 record goto begin

Thread 1 (Thread 0x7ffff7c5e100 (LWP 2224603) "multi-thread-br"):
#0  test (arg=<unavailable>) at /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/../../../src.dev-d/gdb/testsuite/gdb.btrace/multi-thread-step.c:30
30	  global = 42; /* bp.1 */
(gdb) PASS: gdb.btrace/multi-thread-break-hang.exp: thread apply 1 record goto begin
thread apply 1 info record

Thread 1 (Thread 0x7ffff7c5e100 (LWP 2224603) "multi-thread-br"):
Active record target: record-btrace
Recording format: Intel Processor Trace.
Buffer size: 16kB.
Recorded 70 instructions in 3 functions (0 gaps) for thread 1 (Thread 0x7ffff7c5e100 (LWP 2224603)).
Replay in progress.  At instruction 1.
(gdb) PASS: gdb.btrace/multi-thread-break-hang.exp: thread apply 1 info record
stepi

Reached end of recorded history; stopping.
Following forward execution will be added to history.
test (arg=0x0) at /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/../../../src.dev-d/gdb/testsuite/gdb.btrace/multi-thread-step.c:34
34	  global = 42; /* bp.2 */
(gdb) FAIL: gdb.btrace/multi-thread-break-hang.exp: stepi.1
stepi

Reached end of recorded history; stopping.
Following forward execution will be added to history.
test (arg=0x0) at /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/../../../src.dev-d/gdb/testsuite/gdb.btrace/multi-thread-step.c:34
34	  global = 42; /* bp.2 */
(gdb) FAIL: gdb.btrace/multi-thread-break-hang.exp: stepi.2
stepi

Reached end of recorded history; stopping.
Following forward execution will be added to history.
test (arg=0x0) at /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/../../../src.dev-d/gdb/testsuite/gdb.btrace/multi-thread-step.c:34
34	  global = 42; /* bp.2 */
(gdb) FAIL: gdb.btrace/multi-thread-break-hang.exp: stepi.3
testcase /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/../../../src.dev-d/gdb/testsuite/gdb.btrace/multi-thread-break-hang.exp completed in 1 seconds

		=== gdb Summary ===

# of expected passes		29
# of unexpected failures	6
Executing on host: /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/../../gdb/gdb -nw -nx -q -iex "set height 0" -iex "set width 0" -data-directory /home/andrew/projects/binutils-gdb/build.dev-d/gdb/data-directory --version    (timeout = 300)
builtin_spawn -ignore SIGHUP /home/andrew/projects/binutils-gdb/build.dev-d/gdb/testsuite/../../gdb/gdb -nw -nx -q -iex set height 0 -iex set width 0 -data-directory /home/andrew/projects/binutils-gdb/build.dev-d/gdb/data-directory --version
GNU gdb (GDB) 16.0.50.20241020-git
Copyright (C) 2024 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
/home/andrew/projects/binutils-gdb/build.dev-d/gdb/gdb version  16.0.50.20241020-git -nw -nx -q -iex "set height 0" -iex "set width 0" -data-directory /home/andrew/projects/binutils-gdb/build.dev-d/gdb/data-directory 

runtest completed at Mon Oct 21 10:08:56 2024


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

* RE: [PATCH v5 0/4] PR gdb/31353
  2024-10-21  9:13 ` Andrew Burgess
@ 2024-10-21  9:46   ` Metzger, Markus T
  0 siblings, 0 replies; 16+ messages in thread
From: Metzger, Markus T @ 2024-10-21  9:46 UTC (permalink / raw)
  To: Andrew Burgess, gdb-patches; +Cc: pedro

Hello Andrew,

>I built this series off current master, ran these tests and saw 6
>unexpected failures:
>
>  FAIL: gdb.btrace/stepn.exp: stepi: stepi 5
>  FAIL: gdb.btrace/stepn.exp: step: step 5
>  FAIL: gdb.btrace/stepn.exp: next: next 5
>  FAIL: gdb.btrace/multi-thread-break-hang.exp: stepi.1
>  FAIL: gdb.btrace/multi-thread-break-hang.exp: stepi.2
>  FAIL: gdb.btrace/multi-thread-break-hang.exp: stepi.3

Those fails are caused by some rewording of the end-of-history message.

I fixed them on the user branch but have not sent another version of the
patch series.  I noted this in the wrong patch series (the one for gdb/19340).

I'll send an update.

Regards,
Markus.
Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Sean Fennelly, Jeffrey Schneiderman, Tiffany Doon Silva
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928


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

end of thread, other threads:[~2024-10-21  9:46 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-10  7:46 [PATCH v5 0/4] PR gdb/31353 Markus Metzger
2024-04-10  7:46 ` [PATCH v5 1/4] gdb, infrun, btrace: fix reverse/replay stepping at end of execution history Markus Metzger
2024-04-10  7:46 ` [PATCH v5 2/4] gdb, infrun, record: fix hang when step-over fails with no-history Markus Metzger
2024-04-10  7:46 ` [PATCH v5 3/4] gdb, infrun, record: move no-history notification into normal_stop Markus Metzger
2024-04-10  7:46 ` [PATCH v5 4/4] gdb, infrun: fix multi-threaded reverse stepping Markus Metzger
2024-04-12 19:50   ` Guinevere Larsen
2024-04-15  9:03     ` Metzger, Markus T
2024-04-15 12:44       ` Guinevere Larsen
2024-05-03  5:26 ` [PING] [PATCH v5 0/4] PR gdb/31353 Metzger, Markus T
2024-06-07  5:06   ` [PING v2] " Metzger, Markus T
2024-06-27 19:12     ` Guinevere Larsen
2024-09-13 10:43       ` [PING v3] " Metzger, Markus T
2024-10-09 14:10         ` [PING v4] " Metzger, Markus T
2024-10-21  8:45 ` Andrew Burgess
2024-10-21  9:13 ` Andrew Burgess
2024-10-21  9:46   ` Metzger, Markus T

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).