Add SuspendReason enum and change Suspension functions.
More self-documenting and more type safe.
Bug: 62821960
Test: ./test.py
Change-Id: Ic7a1ae6a25e687d65f5aa10c1aad54a7b80dd086
diff --git a/runtime/debugger.cc b/runtime/debugger.cc
index cc12439..c94a8e0 100644
--- a/runtime/debugger.cc
+++ b/runtime/debugger.cc
@@ -2446,7 +2446,7 @@
ThreadList* thread_list = Runtime::Current()->GetThreadList();
Thread* thread = thread_list->SuspendThreadByPeer(peer.get(),
request_suspension,
- /* debug_suspension */ true,
+ SuspendReason::kForDebugger,
&timed_out);
if (thread != nullptr) {
return JDWP::ERR_NONE;
@@ -2477,7 +2477,7 @@
needs_resume = thread->GetDebugSuspendCount() > 0;
}
if (needs_resume) {
- Runtime::Current()->GetThreadList()->Resume(thread, true);
+ Runtime::Current()->GetThreadList()->Resume(thread, SuspendReason::kForDebugger);
}
}
@@ -3694,7 +3694,7 @@
ThreadList* const thread_list = Runtime::Current()->GetThreadList();
suspended_thread = thread_list->SuspendThreadByPeer(thread_peer,
/* request_suspension */ true,
- /* debug_suspension */ true,
+ SuspendReason::kForDebugger,
&timed_out);
}
if (suspended_thread == nullptr) {
@@ -3718,7 +3718,7 @@
~ScopedDebuggerThreadSuspension() {
if (other_suspend_) {
- Runtime::Current()->GetThreadList()->Resume(thread_, true);
+ Runtime::Current()->GetThreadList()->Resume(thread_, SuspendReason::kForDebugger);
}
}
@@ -4040,7 +4040,7 @@
thread_list->UndoDebuggerSuspensions();
} else {
VLOG(jdwp) << " Resuming event thread only";
- thread_list->Resume(targetThread, true);
+ thread_list->Resume(targetThread, SuspendReason::kForDebugger);
}
return JDWP::ERR_NONE;