Changeset View
Changeset View
Standalone View
Standalone View
source/Target/StopInfo.cpp
Show First 20 Lines • Show All 686 Lines • ▼ Show 20 Lines | if (thread_sp) { | ||||
// re-enable the watchpoint | // re-enable the watchpoint | ||||
if (process_sp) { | if (process_sp) { | ||||
uint32_t num; | uint32_t num; | ||||
bool wp_triggers_after; | bool wp_triggers_after; | ||||
if (process_sp->GetWatchpointSupportInfo(num, wp_triggers_after) | if (process_sp->GetWatchpointSupportInfo(num, wp_triggers_after) | ||||
.Success()) { | .Success()) { | ||||
if (!wp_triggers_after) { | if (!wp_triggers_after) { | ||||
process_sp->DisableWatchpoint(wp_sp.get(), false); | // We need to preserve the watch_index before watchpoint | ||||
// is disable. Since Watchpoint::SetEnabled will clear the | |||||
// watch index. | |||||
// This will fix TestWatchpointIter failure | |||||
Watchpoint *wp = wp_sp.get(); | |||||
uint32_t watch_index = wp->GetHardwareIndex(); | |||||
process_sp->DisableWatchpoint(wp, false); | |||||
StopInfoSP stored_stop_info_sp = thread_sp->GetStopInfo(); | StopInfoSP stored_stop_info_sp = thread_sp->GetStopInfo(); | ||||
assert(stored_stop_info_sp.get() == this); | assert(stored_stop_info_sp.get() == this); | ||||
ThreadPlanSP new_plan_sp( | ThreadPlanSP new_plan_sp( | ||||
thread_sp->QueueThreadPlanForStepSingleInstruction( | thread_sp->QueueThreadPlanForStepSingleInstruction( | ||||
false, // step-over | false, // step-over | ||||
false, // abort_other_plans | false, // abort_other_plans | ||||
true)); // stop_other_threads | true)); // stop_other_threads | ||||
new_plan_sp->SetIsMasterPlan(true); | new_plan_sp->SetIsMasterPlan(true); | ||||
new_plan_sp->SetOkayToDiscard(false); | new_plan_sp->SetOkayToDiscard(false); | ||||
new_plan_sp->SetPrivate(true); | new_plan_sp->SetPrivate(true); | ||||
process_sp->GetThreadList().SetSelectedThreadByID( | process_sp->GetThreadList().SetSelectedThreadByID( | ||||
thread_sp->GetID()); | thread_sp->GetID()); | ||||
process_sp->ResumeSynchronous(nullptr); | process_sp->ResumeSynchronous(nullptr); | ||||
process_sp->GetThreadList().SetSelectedThreadByID( | process_sp->GetThreadList().SetSelectedThreadByID( | ||||
thread_sp->GetID()); | thread_sp->GetID()); | ||||
thread_sp->SetStopInfo(stored_stop_info_sp); | thread_sp->SetStopInfo(stored_stop_info_sp); | ||||
process_sp->EnableWatchpoint(wp_sp.get(), false); | process_sp->EnableWatchpoint(wp, false); | ||||
wp->SetHardwareIndex(watch_index); | |||||
} | } | ||||
} | } | ||||
} | } | ||||
} | } | ||||
// This sentry object makes sure the current watchpoint is disabled | // This sentry object makes sure the current watchpoint is disabled | ||||
// while performing watchpoint actions, | // while performing watchpoint actions, | ||||
// and it is then enabled after we are finished. | // and it is then enabled after we are finished. | ||||
▲ Show 20 Lines • Show All 455 Lines • Show Last 20 Lines |