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

Method Init

IDEHelper/Compiler/CeDebugger.cpp:68–172  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

66}
67
68void CeEvaluationContext::Init(CeDebugger* ceDebugger, const StringImpl& expr, CeFormatInfo* formatInfo, BfTypedValue contextValue)
69{
70 mDebugger = ceDebugger;
71
72 mCallStackIdx = 0;
73 mParser = NULL;
74 mReducer = NULL;
75 mPassInstance = NULL;
76 mExprEvaluator = NULL;
77 mExprNode = NULL;
78
79 if (expr.empty())
80 return;
81
82 int atPos = (int)expr.IndexOf('@');
83 if ((atPos != -1) && (atPos < expr.mLength - 2) && (expr[atPos + 1] == '0') && (expr[atPos + 2] == 'x'))
84 {
85 bool isValid = true;
86 for (int i = 0; i < atPos; i++)
87 {
88 char c = expr[i];
89 if ((c < '0') || (c > '9'))
90 {
91 isValid = false;
92 break;
93 }
94 }
95
96 if (isValid)
97 {
98 int parseLength = expr.mLength;
99 for (int i = 0; i < expr.mLength; i++)
100 {
101 if ((expr[i] == ',') || (::isspace((uint8)expr[i])))
102 {
103 parseLength = i;
104 break;
105 }
106 }
107 mExprString = expr.Substring(0, parseLength);
108
109 String typeIdStr = expr.Substring(0, atPos);
110 String addrStr = expr.Substring(atPos + 3, parseLength - atPos - 3);
111
112 int typeId = strtol(typeIdStr.c_str(), NULL, 10);
113 int64 addrVal = strtoll(addrStr.c_str(), NULL, 16);
114
115 if ((typeId != 0) && (addrVal != 0))
116 {
117 auto type = ceDebugger->mCompiler->mContext->FindTypeById(typeId);
118 if (type != NULL)
119 {
120 auto module = ceDebugger->mCeMachine->mCeModule;
121
122 if (type->IsObjectOrInterface())
123 {
124 mResultOverride = BfTypedValue(module->mBfIRBuilder->CreateIntToPtr(
125 module->mBfIRBuilder->CreateConst(BfTypeCode_IntPtr, (uint64)addrVal), module->mBfIRBuilder->MapType(type)), type);

Callers 1

DoEvaluateMethod · 0.45

Calls 15

BfTypedValueClass · 0.85
BfVisitorPosClass · 0.85
SubstringMethod · 0.80
FindTypeByIdMethod · 0.80
CreateIntToPtrMethod · 0.80
MapTypeMethod · 0.80
CreateConstAggCEMethod · 0.80
CreateExpressionMethod · 0.80
FailAtMethod · 0.80
emptyMethod · 0.45
IndexOfMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected