diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c index c50e11b..4a57b51 100644 --- a/gdb/record-btrace.c +++ b/gdb/record-btrace.c @@ -1662,6 +1687,8 @@ record_btrace_goto_target (struct thread_info *tp, struct btrace_insn_iterator *goto_target; struct btrace_thread_info *btinfo; struct target_waitstatus ws; + struct btrace_insn_iterator target_it; + volatile struct gdb_exception exception; btinfo = &tp->btrace; @@ -1686,11 +1713,17 @@ record_btrace_goto_target (struct thread_info *tp, btinfo->flags |= BTHR_GOTO; btinfo->goto_target = goto_target; -#if 0 + TRY_CATCH (exception, RETURN_MASK_ALL) + { + +#if 1 if (goto_target != NULL) + target_it = *goto_target; + else + btrace_insn_end (&target_it, btinfo); tp->control.exception_resume_breakpoint = set_momentary_breakpoint_at_pc (target_gdbarch (), - btrace_insn_get (goto_target)->pc, + btrace_insn_get (&target_it)->pc, bp_until); #endif #if 0 @@ -1701,8 +1734,18 @@ record_btrace_goto_target (struct thread_info *tp, proceed ((CORE_ADDR) -1, GDB_SIGNAL_0, 0); #endif - if (btinfo->goto_target != NULL || (btinfo->flags & BTHR_GOTO) != 0) + // It will need a fix if reverse mode supports target-async mode. + if ((btinfo->flags & BTHR_GOTO) != 0) error (_("Record goto failed.")); + gdb_assert (btinfo->goto_target == NULL); + + } + if (exception.reason < 0) + { + xfree (btinfo->goto_target); + btinfo->goto_target = NULL; + btinfo->flags &= ~BTHR_GOTO; + } } /* The to_goto_record_begin method of target record-btrace. */