MCPcopy Create free account
hub / github.com/beefytech/Beef / GetThreadInfo

Method GetThreadInfo

IDEHelper/WinDebugger.cpp:11033–11173  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11031}
11032
11033String WinDebugger::GetThreadInfo()
11034{
11035 AutoCrit autoCrit(mDebugManager->mCritSect);
11036
11037 String retStr;
11038 if ((mActiveThread == NULL) && (!mIsRunning))
11039 {
11040 retStr = "";
11041 }
11042 else
11043 {
11044 if (mActiveThread != NULL)
11045 retStr = StrFormat("%d", mActiveThread->mThreadId);
11046
11047 for (auto threadInfo : mThreadList)
11048 {
11049 SetAndRestoreValue<WdThreadInfo*> prevThread(mActiveThread, threadInfo);
11050
11051 retStr += "\n";
11052
11053 for (int pass = 0; pass < 2; pass++)
11054 {
11055 CPURegisters registers;
11056 PopulateRegisters(&registers);
11057
11058 String locString = EncodeDataPtr((addr_target)registers.GetPC(), true);
11059
11060 TryGetThreadName(threadInfo);
11061
11062 bool hadThreadName = true;
11063 String threadName = threadInfo->mName;
11064 if (threadName.IsEmpty())
11065 {
11066 hadThreadName = false;
11067 if (threadInfo->mThreadId == mProcessInfo.dwThreadId)
11068 threadName = "Main Thread";
11069 else
11070 threadName = "Worker Thread";
11071 }
11072
11073 bool isInvalid = false;
11074 addr_target appendAddr = 0;
11075
11076 for (int stackIdx = 0; true; stackIdx++)
11077 {
11078 auto subProgram = mDebugTarget->FindSubProgram(registers.GetPC(), DbgOnDemandKind_LocalOnly);
11079 if (subProgram != NULL)
11080 {
11081 if (subProgram->mLineInfo != NULL)
11082 {
11083 DbgModule* module = subProgram->mCompileUnit->mDbgModule;
11084 DbgModule* linkedModule = module->GetLinkedModule();
11085 if (linkedModule->mDisplayName.length() > 0)
11086 {
11087 locString = linkedModule->mDisplayName + "!" + subProgram->ToString();
11088 if (!hadThreadName)
11089 threadName = module->mDisplayName + " thread";
11090 }

Callers 1

Calls 11

FindSubProgramMethod · 0.80
GetLinkedModuleMethod · 0.80
FindSymbolAtMethod · 0.80
GetPCMethod · 0.45
IsEmptyMethod · 0.45
lengthMethod · 0.45
ToStringMethod · 0.45
RollBackStackFrameMethod · 0.45
emptyMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected