From c9f9977bb61c85b407b56b04a27e7c562f553a06 Mon Sep 17 00:00:00 2001 From: Igor Kulaychuk Date: Wed, 12 Jul 2017 04:20:55 +0300 Subject: [PATCH] Fix threads state display --- src/debug/debugger/main.cpp | 36 +++++++----------------------------- 1 file changed, 7 insertions(+), 29 deletions(-) diff --git a/src/debug/debugger/main.cpp b/src/debug/debugger/main.cpp index 046c23f..869016c 100644 --- a/src/debug/debugger/main.cpp +++ b/src/debug/debugger/main.cpp @@ -149,37 +149,15 @@ HRESULT PrintThread(ICorDebugThread *pThread, std::string &output) DWORD threadId = 0; IfFailRet(pThread->GetID(&threadId)); - CorDebugThreadState state = THREAD_SUSPEND; - IfFailRet(pThread->GetDebugState(&state)); - - CorDebugUserState ustate; - IfFailRet(pThread->GetUserState(&ustate)); - - static const struct { int val; const char *name; } states[] = { - { USER_STOP_REQUESTED, "USER_STOP_REQUESTED" }, - { USER_SUSPEND_REQUESTED, "USER_SUSPEND_REQUESTED" }, - { USER_BACKGROUND, "USER_BACKGROUND" }, - { USER_UNSTARTED, "USER_UNSTARTED" }, - { USER_STOPPED, "USER_STOPPED" }, - { USER_WAIT_SLEEP_JOIN, "USER_WAIT_SLEEP_JOIN" }, - { USER_SUSPENDED, "USER_SUSPENDED" }, - { USER_UNSAFE_POINT, "USER_UNSAFE_POINT" }, - { USER_THREADPOOL, "USER_THREADPOOL" } - }; - - std::string user_state; - for (int i = 0; i < sizeof(states)/sizeof(states[0]); i++) - { - if (ustate & states[i].val) - { - if (!user_state.empty()) user_state += '|'; - user_state += states[i].name; - } - } + + ToRelease pProcess; + IfFailRet(pThread->GetProcess(&pProcess)); + BOOL running = FALSE; + IfFailRet(pProcess->IsRunning(&running)); ss << "{id=\"" << threadId - << "\",name=\"\",state=\"" << (state == THREAD_RUN ? "running" : "stopped") - << "-" << user_state << "\"}"; + << "\",name=\"\",state=\"" + << (running ? "running" : "stopped") << "\"}"; output = ss.str(); -- 2.7.4