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

Method Init

IDEHelper/WinDebugger.cpp:109–157  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

107}
108
109void DbgEvaluationContext::Init(WinDebugger* winDebugger, DbgModule* dbgModule, const StringImpl& expr, DwFormatInfo* formatInfo, DbgTypedValue contextValue)
110{
111 if (expr.empty())
112 {
113 mParser = NULL;
114 mReducer = NULL;
115 mPassInstance = NULL;
116 mDbgExprEvaluator = NULL;
117 mExprNode = NULL;
118 return;
119 }
120
121 mParser = new BfParser(winDebugger->mBfSystem);
122 mParser->mCompatMode = true;
123 mPassInstance = new BfPassInstance(winDebugger->mBfSystem);
124 auto terminatedExpr = expr + ";";
125 mParser->SetSource(terminatedExpr.c_str(), terminatedExpr.length());
126 mParser->Parse(mPassInstance);
127
128 mReducer = new BfReducer();
129 mReducer->mAlloc = mParser->mAlloc;
130 mReducer->mSystem = winDebugger->mBfSystem;
131 mReducer->mPassInstance = mPassInstance;
132 mReducer->mVisitorPos = BfReducer::BfVisitorPos(mParser->mRootNode);
133 mReducer->mVisitorPos.MoveNext();
134 mReducer->mCompatMode = mParser->mCompatMode;
135 mReducer->mSource = mParser;
136 mExprNode = mReducer->CreateExpression(mParser->mRootNode->GetFirst());
137 mParser->Close();
138 mDbgExprEvaluator = new DbgExprEvaluator(winDebugger, dbgModule, mPassInstance, -1, -1);
139
140 if ((formatInfo != NULL) && (mExprNode != NULL) && (mExprNode->GetSrcEnd() < (int) expr.length()))
141 {
142 String formatFlags = expr.Substring(mExprNode->GetSrcEnd());
143 String errorString = "Invalid expression";
144 if (!winDebugger->ParseFormatInfo(dbgModule, formatFlags, formatInfo, mPassInstance, NULL, NULL, &errorString, contextValue))
145 {
146 mPassInstance->FailAt(errorString, mParser->mSourceData, mExprNode->GetSrcEnd(), (int)expr.length() - mExprNode->GetSrcEnd());
147 formatFlags = "";
148 }
149 }
150
151 if (formatInfo != NULL)
152 {
153 mDbgExprEvaluator->mExplicitThis = formatInfo->mExplicitThis;
154 mDbgExprEvaluator->mCallStackIdx = formatInfo->mCallStackIdx;
155 mDbgExprEvaluator->mLanguage = formatInfo->mLanguage;
156 }
157}
158
159bool DbgEvaluationContext::HasExpression()
160{

Callers 4

ReadTypedValueMethod · 0.45
DoUpdateMethod · 0.45
LocateSymbolMethod · 0.45

Calls 14

BfVisitorPosClass · 0.85
CreateExpressionMethod · 0.80
SubstringMethod · 0.80
FailAtMethod · 0.80
emptyMethod · 0.45
SetSourceMethod · 0.45
c_strMethod · 0.45
lengthMethod · 0.45
ParseMethod · 0.45
MoveNextMethod · 0.45
GetFirstMethod · 0.45
CloseMethod · 0.45

Tested by

no test coverage detected