LLDB mainline
|
"lldb/Expression/UtilityFunction.h" Encapsulates a bit of source code that provides a function that is callable More...
#include <UtilityFunction.h>
Public Member Functions | |
bool | isA (const void *ClassID) const override |
UtilityFunction (ExecutionContextScope &exe_scope, std::string text, std::string name, bool enable_debugging) | |
Constructor. | |
~UtilityFunction () override | |
virtual bool | Install (DiagnosticManager &diagnostic_manager, ExecutionContext &exe_ctx)=0 |
Install the utility function into a process. | |
bool | ContainsAddress (lldb::addr_t address) |
Check whether the given address is inside the function. | |
const char * | Text () override |
Return the string that the parser should parse. | |
const char * | FunctionName () override |
Return the function name that should be used for executing the expression. | |
ExpressionVariableList * | LocalVariables () |
Return the object that the parser should use when registering local variables. | |
bool | NeedsValidation () override |
Return true if validation code should be inserted into the expression. | |
bool | NeedsVariableResolution () override |
Return true if external variables in the expression should be resolved. | |
FunctionCaller * | MakeFunctionCaller (const CompilerType &return_type, const ValueList &arg_value_list, lldb::ThreadSP compilation_thread, Status &error) |
FunctionCaller * | GetFunctionCaller () |
Public Member Functions inherited from lldb_private::Expression | |
Expression (Target &target) | |
Expression (ExecutionContextScope &exe_scope) | |
virtual | ~Expression ()=default |
Destructor. | |
virtual const char * | Text ()=0 |
Return the string that the parser should parse. | |
virtual const char * | FunctionName ()=0 |
Return the function name that should be used for executing the expression. | |
virtual SourceLanguage | Language () const |
Return the language that should be used when parsing. | |
virtual Materializer * | GetMaterializer () |
Return the Materializer that the parser should use when registering external values. | |
virtual ResultType | DesiredResultType () const |
Return the desired result type of the function, or eResultTypeAny if indifferent. | |
virtual bool | NeedsValidation ()=0 |
Flags. | |
virtual bool | NeedsVariableResolution ()=0 |
Return true if external variables in the expression should be resolved. | |
virtual EvaluateExpressionOptions * | GetOptions () |
lldb::addr_t | StartAddress () |
Return the address of the function's JIT-compiled code, or LLDB_INVALID_ADDRESS if the function is not JIT compiled. | |
virtual void | WillStartExecuting () |
Called to notify the expression that it is about to be executed. | |
virtual void | DidFinishExecuting () |
Called to notify the expression that its execution has finished. | |
virtual ExpressionTypeSystemHelper * | GetTypeSystemHelper () |
virtual bool | isA (const void *ClassID) const =0 |
Static Public Member Functions | |
static bool | classof (const Expression *obj) |
Protected Attributes | |
std::shared_ptr< IRExecutionUnit > | m_execution_unit_sp |
lldb::ModuleWP | m_jit_module_wp |
std::string | m_function_text |
The text of the function. Must be a well-formed translation unit. | |
std::string | m_function_name |
The name of the function. | |
std::unique_ptr< FunctionCaller > | m_caller_up |
Protected Attributes inherited from lldb_private::Expression | |
lldb::TargetWP | m_target_wp |
lldb::ProcessWP | m_jit_process_wp |
Expression's always have to have a target... | |
lldb::addr_t | m_jit_start_addr |
An expression might have a process, but it doesn't need to (e.g. | |
lldb::addr_t | m_jit_end_addr |
The address of the JITted function within the JIT allocation. | |
Static Private Attributes | |
static char | ID |
Additional Inherited Members | |
Public Types inherited from lldb_private::Expression | |
enum | ResultType { eResultTypeAny , eResultTypeId } |
"lldb/Expression/UtilityFunction.h" Encapsulates a bit of source code that provides a function that is callable
LLDB uses expressions for various purposes, notably to call functions and as a backend for the expr command. UtilityFunction encapsulates a self-contained function meant to be used from other code. Utility functions can perform error-checking for ClangUserExpressions,
Definition at line 30 of file UtilityFunction.h.
UtilityFunction::UtilityFunction | ( | ExecutionContextScope & | exe_scope, |
std::string | text, | ||
std::string | name, | ||
bool | enable_debugging | ||
) |
Constructor.
[in] | text | The text of the function. Must be a full translation unit. |
[in] | name | The name of the function, as used in the text. |
[in] | enable_debugging | Enable debugging of this function. |
[in] | text | The text of the function. Must be a full translation unit. |
[in] | name | The name of the function, as used in the text. |
Definition at line 38 of file UtilityFunction.cpp.
|
override |
Definition at line 44 of file UtilityFunction.cpp.
References m_jit_module_wp, and lldb_private::Expression::m_jit_process_wp.
|
inlinestatic |
Definition at line 36 of file UtilityFunction.h.
References ID, and lldb_private::Expression::isA().
|
inline |
Check whether the given address is inside the function.
Especially useful if the function dereferences nullptr to indicate a failed assert.
[in] | address | The address to check. |
Definition at line 77 of file UtilityFunction.h.
References lldb_private::Expression::m_jit_end_addr, and lldb_private::Expression::m_jit_start_addr.
|
inlineoverridevirtual |
Return the function name that should be used for executing the expression.
Text() should contain the definition of this function.
Implements lldb_private::Expression.
Definition at line 89 of file UtilityFunction.h.
References m_function_name.
Referenced by lldb_private::ClangUtilityFunction::Install().
|
inline |
Definition at line 111 of file UtilityFunction.h.
References m_caller_up.
Referenced by PlatformPOSIX::DoLoadImage(), lldb_private::PlatformWindows::DoLoadImage(), lldb_private::AppleObjCRuntimeV2::SharedCacheClassInfoExtractor::UpdateISAToDescriptorMap(), and lldb_private::AppleObjCRuntimeV2::DynamicClassInfoExtractor::UpdateISAToDescriptorMap().
|
pure virtual |
Install the utility function into a process.
[in] | diagnostic_manager | A diagnostic manager to print parse errors and warnings to. |
[in] | exe_ctx | The execution context to install the utility function to. |
Implemented in lldb_private::ClangUtilityFunction.
|
inlineoverridevirtual |
Implements lldb_private::Expression.
Reimplemented in lldb_private::ClangUtilityFunction.
Definition at line 35 of file UtilityFunction.h.
References ID.
Referenced by lldb_private::ClangUtilityFunction::isA().
|
inline |
Return the object that the parser should use when registering local variables.
May be nullptr if the Expression doesn't care.
Definition at line 93 of file UtilityFunction.h.
FunctionCaller * UtilityFunction::MakeFunctionCaller | ( | const CompilerType & | return_type, |
const ValueList & | arg_value_list, | ||
lldb::ThreadSP | compilation_thread, | ||
Status & | error | ||
) |
Definition at line 56 of file UtilityFunction.cpp.
References lldb_private::DiagnosticManager::Clear(), error(), lldb::eStateStopped, lldb_private::DiagnosticManager::GetString(), m_caller_up, m_function_name, lldb_private::Expression::m_jit_process_wp, lldb_private::Address::SetOffset(), lldb_private::Expression::StartAddress(), and lldb_private::StateAsCString().
|
inlineoverridevirtual |
Return true if validation code should be inserted into the expression.
Implements lldb_private::Expression.
Definition at line 96 of file UtilityFunction.h.
|
inlineoverridevirtual |
Return true if external variables in the expression should be resolved.
Implements lldb_private::Expression.
Definition at line 99 of file UtilityFunction.h.
|
inlineoverridevirtual |
Return the string that the parser should parse.
Must be a full translation unit.
Implements lldb_private::Expression.
Definition at line 85 of file UtilityFunction.h.
References m_function_text.
|
staticprivate |
Definition at line 32 of file UtilityFunction.h.
|
protected |
Definition at line 120 of file UtilityFunction.h.
Referenced by GetFunctionCaller(), and MakeFunctionCaller().
|
protected |
Definition at line 114 of file UtilityFunction.h.
Referenced by lldb_private::ClangUtilityFunction::Install().
|
protected |
The name of the function.
Definition at line 119 of file UtilityFunction.h.
Referenced by FunctionName(), and MakeFunctionCaller().
|
protected |
The text of the function. Must be a well-formed translation unit.
Definition at line 117 of file UtilityFunction.h.
Referenced by lldb_private::ClangUtilityFunction::ClangUtilityFunction(), and Text().
|
protected |
Definition at line 115 of file UtilityFunction.h.
Referenced by lldb_private::ClangUtilityFunction::Install(), and ~UtilityFunction().