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

Method GetArrayItems

IDEHelper/Compiler/CeDebugger.cpp:2020–2075  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2018}
2019
2020String CeDebugger::GetArrayItems(DebugVisualizerEntry* debugVis, BfType* valueType, BfTypedValue& curNode, int& count, String* outContinuationData)
2021{
2022 CeEvaluationContext conditionEvaluationContext(this, debugVis->mCondition);
2023 auto ceModule = mCeMachine->mCeModule;
2024
2025 String addrs;
2026
2027 bool checkLeft = true;
2028
2029 addr_ce curNodeAddr = 0;
2030
2031 int usedCount = 0;
2032 while (usedCount < count)
2033 {
2034 if ((!curNode) || (!curNode.mType->IsPointer()))
2035 break;
2036 curNode = ceModule->LoadValue(curNode);
2037
2038 BfTypedValue condVal = conditionEvaluationContext.EvaluateInContext(curNode);
2039 if (!condVal)
2040 break;
2041
2042 auto ceTypedVal = GetAddr(curNode);
2043 if (!ceTypedVal)
2044 break;
2045
2046 if (ValueToInt(condVal) != 0)
2047 {
2048 auto val = curNode;
2049 if (valueType == NULL)
2050 {
2051 //String typeAddr = val.mType->ToStringRaw();
2052 String typeAddr = StrFormat("comptype(%d)", val.mType->mTypeId);
2053 // RPad
2054 typeAddr.Append(' ', sizeof(addr_ce) * 2 - (int)typeAddr.length());
2055 addrs += typeAddr;
2056 }
2057
2058 String addr = EncodeDataPtr((addr_ce)ceTypedVal.mAddr, false);
2059 addrs += addr;
2060 usedCount++;
2061 }
2062 auto elemType = curNode.mType->GetUnderlyingType();
2063 curNodeAddr = (addr_ce)ceTypedVal.mAddr + elemType->GetStride();
2064 curNode.mValue = ceModule->mBfIRBuilder->CreateIntToPtr(curNodeAddr, ceModule->mBfIRBuilder->MapType(curNode.mType));
2065 }
2066 count = usedCount;
2067
2068 if (outContinuationData != NULL)
2069 {
2070 *outContinuationData += EncodeDataPtr(debugVis, false) + EncodeDataPtr(valueType, false) +
2071 EncodeDataPtr(curNode.mType, false) + EncodeDataPtr(curNodeAddr, false);
2072 }
2073
2074 return addrs;
2075}
2076
2077String CeDebugger::GetLinkedListItems(DebugVisualizerEntry* debugVis, addr_ce endNodePtr, BfType* valueType, BfTypedValue& curNode, int& count, String* outContinuationData)

Callers

nothing calls this directly

Calls 9

LoadValueMethod · 0.80
AppendMethod · 0.80
CreateIntToPtrMethod · 0.80
MapTypeMethod · 0.80
IsPointerMethod · 0.45
EvaluateInContextMethod · 0.45
lengthMethod · 0.45
GetUnderlyingTypeMethod · 0.45
GetStrideMethod · 0.45

Tested by

no test coverage detected