From: Anton Zhukov Date: Wed, 22 Apr 2020 10:41:33 +0000 (-0400) Subject: Fixed threads enumerate command issue X-Git-Tag: submit/tizen/20200515.062155~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c20e119a113cec06e164ea65cecdef2274b1246d;p=sdk%2Ftools%2Fnetcoredbg.git Fixed threads enumerate command issue VSCode `threads' command failed periodically for multithread apps, because `GetUserState()' retutns failed code for running Thread. Any user/debug status is not available for running thread. Issue: https://github.sec.samsung.net/dotnet/netcoredbg/issues/195 --- diff --git a/src/debug/netcoredbg/frames.cpp b/src/debug/netcoredbg/frames.cpp index caecdf3..7e29417 100644 --- a/src/debug/netcoredbg/frames.cpp +++ b/src/debug/netcoredbg/frames.cpp @@ -26,6 +26,7 @@ HRESULT GetThreadsState(ICorDebugController *controller, std::vector &th ToRelease pThreads; IfFailRet(controller->EnumerateThreads(&pThreads)); + const std::string threadName = ""; ICorDebugThread *handle = nullptr; ULONG fetched = 0; @@ -42,18 +43,9 @@ HRESULT GetThreadsState(ICorDebugController *controller, std::vector &th BOOL running = FALSE; IfFailRet(pProcess->IsRunning(&running)); - CorDebugUserState corUserState; - IfFailRet(pThread->GetUserState(&corUserState)); - - if (!(corUserState & USER_BACKGROUND)) { - std::string name = ""; - // TODO: Need label for Main Thread. This is bad approach. - // Because not garantee the thread sequences. - //if (threads.empty()) { - // name = "Main Thread"; - //} - threads.emplace_back(threadId, name, running); - } + // Baground threads also included. GetUserState() not available for running thread. + threads.emplace_back(threadId, threadName, running); + fetched = 0; handle = nullptr; }