class EvalContext
Defined at line 39 of file ../../src/developer/debug/zxdb/expr/eval_context.h
Interface used by expression evaluation to communicate with the outside world. This provides
access to the variables currently in scope.
PASSING CONVENTION
Prefer to pass EvalContext function parameters as:
const fxl::RefPtr
<EvalContext
>
&
context
The advantage is that this will avoid an atomic refcount in most cases, but still is
automatically ref-ed when bound in a lambda.
Public Methods
ExprLanguage GetLanguage ()
Returns the language associated with the expression.
const std::shared_ptr<Abi> & GetAbi ()
The ABI defines the calling conventions on the current platform.
FoundName FindName (const FindNameOptions & options, const ParsedIdentifier & identifier)
Looks up the given name in the current context.
These use the global FindName backend with our context from GetFindNameContext() below. The
main difference is that this call additionally allows tests to inject names without setting up
the very complex symbol system indexing.
The version that returns a FoundName is the same as the one that takes an output vector but
limits the result to 1 max.
Defined at line 11 of file ../../src/developer/debug/zxdb/expr/eval_context.cc
void FindName (const FindNameOptions & options, const ParsedIdentifier & looking_for, std::vector<FoundName> * results)
FindNameContext GetFindNameContext ()
Returns a context for looking up names via FindName. Prefer not to use this and instead
call EvalContext.FindName (which uses this context implicitly) because it additionally allows
mocking.
void GetNamedValue (const ParsedIdentifier & identifier, EvalCallback cb)
Issues the callback with the value of the given named value in the context of the current
expression evaluation. This will handle things like implicit |this| members in addition to
normal local variables.
The callback also returns the Symbol associated with the variable it found. This can be used
for diagnostics. It is possible for the symbol to be valid but the err to be set if the symbol
was found but it could not be evaluated.
The callback may be issued asynchronously in the future if communication with the remote
debugged application is required. The callback may be issued reentrantly for synchronously
available data.
If the EvalContext is destroyed before the data is ready, the callback will not be issued.
void GetVariableValue (fxl::RefPtr<Value> variable, EvalCallback cb)
Like GetNamedValue() but takes an already-identified Variable.
This will handle extern variables and will resolve them. In this case the EvalCallback's
variable will be the resolved extern one. Otherwise it will be the input Value.
The value is normally a Variable but it can also be an extern DataMember (which will transform
into a Variable when the extern is resolved).
const BuiltinFuncCallback * GetBuiltinFunction (const ParsedIdentifier & name)
Checks for a builtin function with the given name. If one exists, returns a pointer to the
callback. Returns null if it doesn't exist.
fxl::RefPtr<Type> GetConcreteType (const Type * type)
Convenience wrappers around the toplevel GetConcreteType() that uses the FindNameContext()
from this class.
Defined at line 99 of file ../../src/developer/debug/zxdb/expr/eval_context.h
fxl::RefPtr<Type> GetConcreteType (const LazySymbol & symbol)
Defined at line 102 of file ../../src/developer/debug/zxdb/expr/eval_context.h
template <typename DerivedType>
fxl::RefPtr<DerivedType> GetConcreteTypeAs (const Type * type)
Defined at line 106 of file ../../src/developer/debug/zxdb/expr/eval_context.h
template <typename DerivedType>
fxl::RefPtr<DerivedType> GetConcreteTypeAs (const LazySymbol & symbol)
Defined at line 110 of file ../../src/developer/debug/zxdb/expr/eval_context.h
const ProcessSymbols * GetProcessSymbols ()
May return null (ProcessSymbols are destroyed with the process, and the EvalContext is
refcounted and can outlive it).
fxl::RefPtr<SymbolDataProvider> GetDataProvider ()
Location GetLocationForAddress (uint64_t address)
Returns a symbolized (if possible) location for the given address.
const PrettyTypeManager & GetPrettyTypeManager ()
VectorRegisterFormat GetVectorRegisterFormat ()
Returns the format to be used for converting vector registers to values.
bool ShouldPromoteToDerived ()
Returns true if base classes should automatically be promoted to derived classes (when the
derived class is known) when pointer and references are dereferences.
Protected Methods
void ~EvalContext ()
Defined at line 135 of file ../../src/developer/debug/zxdb/expr/eval_context.h
Friends
class RefCountedThreadSafe