diff --git a/gdb/btrace.h b/gdb/btrace.h index 22fabb5..8eceec4 100644 --- a/gdb/btrace.h +++ b/gdb/btrace.h @@ -27,6 +27,7 @@ list of sequential control-flow blocks, one such list per thread. */ #include "btrace-common.h" +#include "target.h" struct thread_info; struct btrace_function; @@ -198,6 +199,8 @@ struct btrace_thread_info /* A bit-vector of btrace_thread_flag. */ unsigned int flags; +struct target_waitstatus status; + /* The instruction history iterator. */ struct btrace_insn_history *insn_history; diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c index 9feda30..633990a 100644 --- a/gdb/record-btrace.c +++ b/gdb/record-btrace.c @@ -1190,6 +1190,8 @@ static const struct frame_unwind record_btrace_frame_unwind = record_btrace_frame_dealloc_cache }; +static struct target_waitstatus record_btrace_step_thread (struct thread_info *tp); + /* Indicate that TP should be resumed according to FLAG. */ static void @@ -1209,6 +1211,10 @@ record_btrace_resume_thread (struct thread_info *tp, btrace_fetch (tp); btinfo->flags |= flag; + + +/* We only move a single thread. We're not able to correlate threads. */ +btinfo->status = record_btrace_step_thread (tp); } /* Find the thread to resume given a PTID. */ @@ -1248,6 +1254,7 @@ record_btrace_start_replaying (struct btrace_thread_info *btinfo) gdb_assert (btinfo->replay == NULL); btinfo->replay = replay; +#if 0 /* Make sure we're not using any stale registers or frames. */ registers_changed (); reinit_frame_cache (); @@ -1258,6 +1265,7 @@ record_btrace_start_replaying (struct btrace_thread_info *btinfo) insn = btrace_insn_get (replay); sal = find_pc_line (insn->pc, 0); set_step_info (frame, sal); +#endif return replay; } @@ -1271,6 +1279,8 @@ record_btrace_stop_replaying (struct btrace_thread_info *btinfo) btinfo->replay = NULL; } +static int forward_to_beneath; + /* The to_resume method of target record-btrace. */ static void @@ -1290,7 +1300,9 @@ record_btrace_resume (struct target_ops *ops, ptid_t ptid, int step, record_btrace_stop_replaying (&other->btrace); /* As long as we're not replaying, just forward the request. */ - if (!record_btrace_is_replaying () && execution_direction != EXEC_REVERSE) + forward_to_beneath = (!record_btrace_is_replaying () + && execution_direction != EXEC_REVERSE); + if (forward_to_beneath) { for (ops = ops->beneath; ops != NULL; ops = ops->beneath) if (ops->to_resume != NULL) @@ -1400,7 +1412,7 @@ record_btrace_step_thread (struct thread_info *tp) replay = btinfo->replay; flag = btinfo->flags & BTHR_MOVE; - btinfo->flags &= ~BTHR_MOVE; +// btinfo->flags &= ~BTHR_MOVE; DEBUG ("stepping %d (%s): %u", tp->num, target_pid_to_str (tp->ptid), flag); @@ -1517,7 +1529,7 @@ record_btrace_wait (struct target_ops *ops, ptid_t ptid, DEBUG ("wait %s (0x%x)", target_pid_to_str (ptid), options); /* As long as we're not replaying, just forward the request. */ - if (!record_btrace_is_replaying () && execution_direction != EXEC_REVERSE) + if (forward_to_beneath) { for (ops = ops->beneath; ops != NULL; ops = ops->beneath) if (ops->to_wait != NULL) @@ -1536,8 +1548,11 @@ record_btrace_wait (struct target_ops *ops, ptid_t ptid, return minus_one_ptid; } +#if 0 /* We only move a single thread. We're not able to correlate threads. */ *status = record_btrace_step_thread (tp); +#endif +*status=tp->btrace.status; /* Stop all other threads. */ if (!non_stop) @@ -1547,9 +1562,11 @@ record_btrace_wait (struct target_ops *ops, ptid_t ptid, /* Start record histories anew from the current position. */ record_btrace_clear_histories (&tp->btrace); +#if 0 /* GDB seems to need this. Without, a stale PC seems to be used resulting in the current location to be displayed incorrectly. */ registers_changed (); +#endif return tp->ptid; } diff --git a/gdb/target.h b/gdb/target.h index 4a20533..e85b063 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -62,7 +62,7 @@ struct expression; #include "memattr.h" #include "vec.h" #include "gdb_signals.h" -#include "btrace.h" +#include "btrace-common.h" #include "command.h" enum strata