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

Method GetValueByNameInBlock_Helper

IDEHelper/DebugTarget.cpp:2247–2424  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2245}
2246
2247bool DebugTarget::GetValueByNameInBlock_Helper(DbgSubprogram* dwSubprogram, DbgBlock* dwBlock, String& name, WdStackFrame* stackFrame, intptr* outAddr, DbgType** outType, DbgAddrType* outAddrType)
2248{
2249 int nameLen = (int)name.length();
2250
2251 // Checks for previous version of a local name by stripping off the '@' each time we find a match, until we don't have any @'s left
2252 auto _CheckName = [&](const char* localName)
2253 {
2254 const char* namePtr = name.c_str();
2255 if (*namePtr != '@')
2256 return;
2257 while (*namePtr == '@')
2258 namePtr++;
2259 if (strcmp(localName, namePtr) == 0)
2260 {
2261 nameLen--;
2262 name.Remove(0, 1);
2263 }
2264 };
2265
2266 SizedArray<DbgVariable*, 32> checkVars;
2267 for (auto variable : dwBlock->mVariables)
2268 {
2269 checkVars.push_back(variable);
2270 }
2271
2272 auto _FixParam = [&](DbgVariable* variable)
2273 {
2274 if (dwSubprogram->GetLanguage() != DbgLanguage_Beef)
2275 {
2276 if ((*outAddrType == DbgAddrType_Target) /*&& (variable->mIsParam)*/ && (dwSubprogram->mCompileUnit->mDbgModule->mDbgFlavor == DbgFlavor_MS))
2277 {
2278 auto dbgType = *outType;
2279
2280 int size = dbgType->GetByteCount();
2281 if (dbgType->IsTypedPrimitive())
2282 {
2283 // Already correct
2284 }
2285 else if ((dbgType->IsCompositeType()) && (variable->mIsParam))
2286 {
2287 int size = (*outType)->mSize;
2288 if ((size != 1) && (size != 2) && (size != 4) && (size != sizeof(intptr_target)))
2289 {
2290 auto actualAddr = mDebugger->ReadMemory<intptr_target>(*outAddr);
2291 *outAddr = actualAddr;
2292 }
2293 }
2294 }
2295 }
2296
2297 if (variable->mSigNoPointer)
2298 {
2299 if (*outAddrType == DbgAddrType_Target)
2300 *outAddrType = DbgAddrType_TargetDeref;
2301 }
2302
2303 if ((variable->mIsParam) && (dwSubprogram->GetLanguage() == DbgLanguage_Beef))
2304 {

Callers

nothing calls this directly

Calls 14

GetByteCountMethod · 0.80
IsCompositeTypeMethod · 0.80
GetConstTypeMethod · 0.80
GetSourcePCMethod · 0.80
lengthMethod · 0.45
c_strMethod · 0.45
RemoveMethod · 0.45
push_backMethod · 0.45
GetLanguageMethod · 0.45
IsTypedPrimitiveMethod · 0.45
IsRefMethod · 0.45
IsConstMethod · 0.45

Tested by

no test coverage detected