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

Method UpdateCallStackMethod

IDEHelper/WinDebugger.cpp:11507–11564  ·  view source on GitHub ↗

It's safe to pass an invalid idx in here

Source from the content-addressed store, hash-verified

11505
11506// It's safe to pass an invalid idx in here
11507void WinDebugger::UpdateCallStackMethod(int stackFrameIdx)
11508{
11509 if (mCallStack.empty())
11510 return;
11511
11512 int startIdx = std::min(stackFrameIdx, (int)mCallStack.size() - 1);
11513 while (startIdx >= 0)
11514 {
11515 WdStackFrame* wdStackFrame = mCallStack[startIdx];
11516 if (wdStackFrame->mHasGottenSubProgram)
11517 break;
11518 startIdx--;
11519 }
11520 startIdx++;
11521
11522 for (int checkFrameIdx = startIdx; checkFrameIdx <= stackFrameIdx; checkFrameIdx++)
11523 {
11524 //BF_ASSERT(checkFrameIdx < mCallStack.size());
11525 if (checkFrameIdx >= mCallStack.size())
11526 break;
11527
11528 WdStackFrame* wdStackFrame = mCallStack[checkFrameIdx];
11529
11530 wdStackFrame->mHasGottenSubProgram = true;
11531 addr_target pcAddress = (addr_target)wdStackFrame->GetSourcePC();
11532 DbgSubprogram* dwSubprogram = mDebugTarget->FindSubProgram(pcAddress, DbgOnDemandKind_LocalOnly);
11533 wdStackFrame->mHasGottenSubProgram = true;
11534 wdStackFrame->mSubProgram = dwSubprogram;
11535
11536 if ((dwSubprogram == NULL) && (IsMiniDumpDebugger()))
11537 {
11538 // FindSymbolAt will queue up debug info if necessary...
11539 String symbolName;
11540 addr_target offset;
11541 DbgModule* dbgModule;
11542 mDebugTarget->FindSymbolAt(pcAddress, &symbolName, &offset, &dbgModule);
11543 }
11544
11545 auto prevStackFrame = wdStackFrame;
11546
11547 // Insert inlines
11548 int insertIdx = checkFrameIdx + 1;
11549 while ((dwSubprogram != NULL) && (dwSubprogram->mInlineeInfo != NULL))
11550 {
11551 WdStackFrame* inlineStackFrame = new WdStackFrame();
11552 *inlineStackFrame = *wdStackFrame;
11553 inlineStackFrame->mInInlineMethod = true;
11554 wdStackFrame->mInInlineCall = true;
11555 inlineStackFrame->mSubProgram = dwSubprogram->mInlineeInfo->mInlineParent;
11556 mCallStack.Insert(insertIdx, inlineStackFrame);
11557 dwSubprogram = dwSubprogram->mInlineeInfo->mInlineParent;
11558 insertIdx++;
11559 checkFrameIdx++;
11560
11561 prevStackFrame = inlineStackFrame;
11562 }
11563 }
11564}

Callers 3

GetCurrentMethodMethod · 0.45
LookupIdentifierMethod · 0.45
PopulateHotCallstacksMethod · 0.45

Calls 6

GetSourcePCMethod · 0.80
FindSubProgramMethod · 0.80
FindSymbolAtMethod · 0.80
emptyMethod · 0.45
sizeMethod · 0.45
InsertMethod · 0.45

Tested by

no test coverage detected