Commit fcf86093 authored by ussrhero's avatar ussrhero

added default scope for evalExpr

parent 6638b172
......@@ -400,14 +400,20 @@ inline ScopePtr makeScope(const std::list < std::pair<std::wstring, TypedValue>
return ScopePtr(new ScopeList(varList));
}
ScopePtr getDefaultScope();
///////////////////////////////////////////////////////////////////////////////
TypedValue callRaw(MEMOFFSET_64 addr, CallingConventionType callingConvention, const TypedValueList& arglst);
TypedValue evalExpr(const std::wstring& expr, const ScopePtr& scope = ScopePtr(new ScopeList()),
TypedValue evalExpr(
const std::wstring& expr,
const ScopePtr& scope = getDefaultScope(),
const TypeInfoProviderPtr& typeInfoProvider = getDefaultTypeInfoProvider());
TypedValue evalExpr(const std::string& expr, const ScopePtr& scope = ScopePtr(new ScopeList()),
TypedValue evalExpr(
const std::string& expr,
const ScopePtr& scope = getDefaultScope(),
const TypeInfoProviderPtr& typeInfoProvider = getDefaultTypeInfoProvider());
///////////////////////////////////////////////////////////////////////////////
......
......@@ -104,7 +104,6 @@
<ClInclude Include="..\include\kdlib\memaccess.h" />
<ClInclude Include="..\include\kdlib\module.h" />
<ClInclude Include="..\include\kdlib\process.h" />
<ClInclude Include="..\include\kdlib\scope.h" />
<ClInclude Include="..\include\kdlib\stack.h" />
<ClInclude Include="..\include\kdlib\symengine.h" />
<ClInclude Include="..\include\kdlib\tagged.h" />
......
......@@ -190,9 +190,6 @@
<ClInclude Include="..\include\kdlib\module.h">
<Filter>kdlib/include</Filter>
</ClInclude>
<ClInclude Include="..\include\kdlib\scope.h">
<Filter>kdlib/include</Filter>
</ClInclude>
<ClInclude Include="..\include\kdlib\stack.h">
<Filter>kdlib/include</Filter>
</ClInclude>
......
......@@ -2192,4 +2192,34 @@ TypedValue makeArrayValue<double>(const std::vector<double>& data)
///////////////////////////////////////////////////////////////////////////////
class DefaultScope : public Scope
{
public:
virtual TypedValue get(const std::wstring& varName) const override
{
return loadTypedVar(varName);
}
virtual bool find(const std::wstring& varName, TypedValue& value) const override
{
try
{
value = get(varName);
return true;
}
catch (DbgException&)
{}
return false;
}
};
ScopePtr getDefaultScope()
{
return ScopePtr(new DefaultScope());
}
///////////////////////////////////////////////////////////////////////////////
} // end kdlib namesapce
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment