| 4269 | } |
| 4270 | |
| 4271 | String CeDebugger::GetAutoLocals(int callStackIdx, bool showRegs) |
| 4272 | { |
| 4273 | AutoCrit autoCrit(mDebugManager->mCritSect); |
| 4274 | |
| 4275 | if (!mCeMachine->mDbgPaused) |
| 4276 | return ""; |
| 4277 | |
| 4278 | String result; |
| 4279 | |
| 4280 | auto ceFrame = GetFrame(callStackIdx); |
| 4281 | if (ceFrame == NULL) |
| 4282 | return result; |
| 4283 | |
| 4284 | int scopeIdx = -1; |
| 4285 | auto ceEntry = ceFrame->mFunction->FindEmitEntry(ceFrame->GetInstIdx()); |
| 4286 | if (ceEntry != NULL) |
| 4287 | scopeIdx = ceEntry->mScope; |
| 4288 | |
| 4289 | int instIdx = ceFrame->GetInstIdx(); |
| 4290 | if (ceFrame->mFunction->mDbgInfo != NULL) |
| 4291 | { |
| 4292 | auto ceFunction = ceFrame->mFunction; |
| 4293 | |
| 4294 | struct CeDbgInfo |
| 4295 | { |
| 4296 | int mShadowCount; |
| 4297 | int mPrevShadowIdx; |
| 4298 | bool mIncluded; |
| 4299 | |
| 4300 | CeDbgInfo() |
| 4301 | { |
| 4302 | mShadowCount = 0; |
| 4303 | mPrevShadowIdx = -1; |
| 4304 | mIncluded = true; |
| 4305 | } |
| 4306 | }; |
| 4307 | |
| 4308 | Array<CeDbgInfo> dbgInfo; |
| 4309 | Dictionary<String, int> nameIndices; |
| 4310 | |
| 4311 | dbgInfo.Resize(ceFunction->mDbgInfo->mVariables.mSize); |
| 4312 | for (int i = 0; i < ceFunction->mDbgInfo->mVariables.mSize; i++) |
| 4313 | { |
| 4314 | auto& dbgVar = ceFunction->mDbgInfo->mVariables[i]; |
| 4315 | |
| 4316 | if ((dbgVar.mScope == scopeIdx) && (instIdx >= dbgVar.mStartCodePos) && (instIdx < dbgVar.mEndCodePos)) |
| 4317 | { |
| 4318 | int* idxPtr = NULL; |
| 4319 | if (!nameIndices.TryAdd(dbgVar.mName, NULL, &idxPtr)) |
| 4320 | { |
| 4321 | int checkIdx = *idxPtr; |
| 4322 | dbgInfo[i].mPrevShadowIdx = checkIdx; |
| 4323 | |
| 4324 | while (checkIdx != -1) |
| 4325 | { |
| 4326 | dbgInfo[checkIdx].mShadowCount++; |
| 4327 | checkIdx = dbgInfo[checkIdx].mPrevShadowIdx; |
| 4328 | } |
nothing calls this directly
no test coverage detected