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

Method GetAutoLocals

IDEHelper/WinDebugger.cpp:10780–10864  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10778}
10779
10780String WinDebugger::GetAutoLocals(int stackFrameIdx, bool showRegs)
10781{
10782 BP_ZONE("WinDebugger::GetAutoExpressions");
10783
10784 AutoCrit autoCrit(mDebugManager->mCritSect);
10785
10786 if (IsInRunState())
10787 return "";
10788
10789 if (!IsPaused())
10790 return "";
10791
10792 if (mCallStack.size() == 0)
10793 UpdateCallStack();
10794 String result;
10795
10796 Array<String> localList;
10797
10798 int actualStackFrameIdx = BF_MAX(0, stackFrameIdx);
10799 UpdateCallStackMethod(actualStackFrameIdx);
10800
10801 if (actualStackFrameIdx >= mCallStack.size())
10802 return "";
10803 WdStackFrame* wdStackFrame = mCallStack[actualStackFrameIdx];
10804
10805 DbgSubprogram* dwSubprogram = wdStackFrame->mSubProgram;
10806 if (dwSubprogram == NULL)
10807 return "";
10808
10809 auto langage = dwSubprogram->GetLanguage();
10810
10811 DbgLineData* dwLineData = FindLineDataInSubprogram(wdStackFrame->GetSourcePC(), dwSubprogram);
10812 if (dwLineData == NULL)
10813 return "";
10814
10815 dwSubprogram->PopulateSubprogram();
10816 mDebugTarget->GetAutoLocalsInBlock(localList, dwSubprogram, &dwSubprogram->mBlock, wdStackFrame, dwLineData);
10817
10818 String lastLocal;
10819 for (auto local : localList)
10820 {
10821 if (langage == DbgLanguage_C)
10822 {
10823 if ((local == "this") && (strncmp(dwSubprogram->mName, "<lambda_", 8) == 0))
10824 {
10825 // Use explicit "$this" so we can see the actual capture
10826 result += "$this\n";
10827 continue;
10828 }
10829 }
10830
10831 bool wasAlias = false;
10832 for (int i = 0; i < (int)local.length() - 1; i++)
10833 {
10834 if ((local[i] == '$') && (local[i + 1] == 'a'))
10835 {
10836 // Alias
10837 wasAlias = true;

Callers 1

Calls 8

StringClass · 0.85
GetSourcePCMethod · 0.80
GetAutoLocalsInBlockMethod · 0.80
SubstringMethod · 0.80
sizeMethod · 0.45
GetLanguageMethod · 0.45
PopulateSubprogramMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected