mirror of
https://gitee.com/openharmony/arkcompiler_toolchain
synced 2024-11-27 01:31:10 +00:00
ThreadState switch for debugger
Add threadState switch for debugger Issue:https://gitee.com/openharmony/arkcompiler_ets_runtime/issues/IA699D?from=project-issue Signed-off-by: lukai <lukai25@huawei.com> Change-Id: I14188917a1de97c248b6ba19d5395aa1ae1d1f5a
This commit is contained in:
parent
8b0e32c9ab
commit
39c6c158f5
@ -54,7 +54,7 @@ void ProtocolHandler::ProcessCommand()
|
||||
{
|
||||
std::queue<std::string> dispatchingQueue;
|
||||
do {
|
||||
DebuggerApi::SwitchThreadStateRunningOrNative(vm_, ThreadState::NATIVE);
|
||||
DebuggerApi::DebuggerNativeScope nativeScope(vm_);
|
||||
{
|
||||
std::unique_lock<std::mutex> queueLock(requestLock_);
|
||||
if (requestQueue_.empty()) {
|
||||
@ -67,15 +67,17 @@ void ProtocolHandler::ProcessCommand()
|
||||
}
|
||||
|
||||
isDispatchingMessage_ = true;
|
||||
DebuggerApi::SwitchThreadStateRunningOrNative(vm_, ThreadState::RUNNING);
|
||||
while (!dispatchingQueue.empty()) {
|
||||
std::string msg = std::move(dispatchingQueue.front());
|
||||
dispatchingQueue.pop();
|
||||
{
|
||||
DebuggerApi::DebuggerManagedScope managedScope(vm_);
|
||||
while (!dispatchingQueue.empty()) {
|
||||
std::string msg = std::move(dispatchingQueue.front());
|
||||
dispatchingQueue.pop();
|
||||
|
||||
[[maybe_unused]] LocalScope scope(vm_);
|
||||
auto exception = DebuggerApi::GetAndClearException(vm_);
|
||||
dispatcher_.Dispatch(DispatchRequest(msg));
|
||||
DebuggerApi::SetException(vm_, exception);
|
||||
[[maybe_unused]] LocalScope scope(vm_);
|
||||
auto exception = DebuggerApi::GetAndClearException(vm_);
|
||||
dispatcher_.Dispatch(DispatchRequest(msg));
|
||||
DebuggerApi::SetException(vm_, exception);
|
||||
}
|
||||
}
|
||||
isDispatchingMessage_ = false;
|
||||
} while (true);
|
||||
|
Loading…
Reference in New Issue
Block a user