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

Method DisassembleAt

IDEHelper/Compiler/CeDebugger.cpp:4783–4867  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4781}
4782
4783String CeDebugger::DisassembleAt(intptr address)
4784{
4785 AutoCrit autoCrit(mDebugManager->mCritSect);
4786
4787 if (!mCeMachine->mDbgPaused)
4788 return "";
4789
4790 auto ceContext = mCeMachine->mCurContext;
4791
4792 mCurDisasmFuncId = (int)(address >> 32);
4793 UpdateBreakpointAddrs();
4794
4795 CeFunction* ceFunction = NULL;
4796 if (!mCeMachine->mFunctionIdMap.TryGetValue(mCurDisasmFuncId, &ceFunction))
4797 return "";
4798
4799 CeDumpContext dumpCtx;
4800 dumpCtx.mCeFunction = ceFunction;
4801 dumpCtx.mStart = &ceFunction->mCode[0];
4802 dumpCtx.mPtr = dumpCtx.mStart;
4803 dumpCtx.mEnd = dumpCtx.mPtr + ceFunction->mCode.mSize;
4804
4805 uint8* start = dumpCtx.mStart;
4806
4807 dumpCtx.mStr += StrFormat("T Frame Size: %d\n", ceFunction->mFrameSize);
4808 dumpCtx.mStr += StrFormat("A %llX\n", (intptr)mCurDisasmFuncId << 32);
4809
4810 int curEmitIdx = 0;
4811 CeEmitEntry* prevEmitEntry = NULL;
4812 CeEmitEntry* curEmitEntry = NULL;
4813
4814 String prevSourcePath;
4815
4816 while (dumpCtx.mPtr < dumpCtx.mEnd)
4817 {
4818 int ofs = (int)(dumpCtx.mPtr - start);
4819
4820 while ((curEmitIdx < ceFunction->mEmitTable.mSize - 1) && (ofs >= ceFunction->mEmitTable[curEmitIdx + 1].mCodePos))
4821 curEmitIdx++;
4822 if (curEmitIdx < ceFunction->mEmitTable.mSize)
4823 curEmitEntry = &ceFunction->mEmitTable[curEmitIdx];
4824
4825 if (prevEmitEntry != curEmitEntry)
4826 {
4827 if ((curEmitEntry != NULL) && (curEmitEntry->mLine != -1))
4828 {
4829 bool pathChanged = false;
4830 if ((prevEmitEntry == NULL) || (curEmitEntry->mScope != prevEmitEntry->mScope))
4831 {
4832 auto ceDbgScope = &ceFunction->mDbgScopes[curEmitEntry->mScope];
4833 if (ceDbgScope->mFilePath != prevSourcePath)
4834 {
4835 pathChanged = true;
4836 dumpCtx.mStr += StrFormat("S %s\n", ceDbgScope->mFilePath.c_str());
4837 prevSourcePath = ceDbgScope->mFilePath;
4838 }
4839 }
4840

Callers

nothing calls this directly

Calls 3

TryGetValueMethod · 0.80
c_strMethod · 0.45
NextMethod · 0.45

Tested by

no test coverage detected