LLDB mainline
|
"lldb/Expression/LLVMUserExpression.h" Encapsulates a one-time expression for use in lldb. More...
#include <LLVMUserExpression.h>
Classes | |
struct | IRPasses |
Public Member Functions | |
bool | isA (const void *ClassID) const override |
LLVMUserExpression (ExecutionContextScope &exe_scope, llvm::StringRef expr, llvm::StringRef prefix, SourceLanguage language, ResultType desired_type, const EvaluateExpressionOptions &options) | |
~LLVMUserExpression () override | |
bool | FinalizeJITExecution (DiagnosticManager &diagnostic_manager, ExecutionContext &exe_ctx, lldb::ExpressionVariableSP &result, lldb::addr_t function_stack_bottom=LLDB_INVALID_ADDRESS, lldb::addr_t function_stack_top=LLDB_INVALID_ADDRESS) override |
Apply the side effects of the function to program state. | |
bool | CanInterpret () override |
Materializer * | GetMaterializer () override |
Return the Materializer that the parser should use when registering external values. | |
const char * | Text () override |
Return the string that the parser should parse. | |
Public Member Functions inherited from lldb_private::UserExpression | |
bool | isA (const void *ClassID) const override |
UserExpression (ExecutionContextScope &exe_scope, llvm::StringRef expr, llvm::StringRef prefix, SourceLanguage language, ResultType desired_type, const EvaluateExpressionOptions &options) | |
Constructor. | |
~UserExpression () override | |
Destructor. | |
virtual bool | Parse (DiagnosticManager &diagnostic_manager, ExecutionContext &exe_ctx, lldb_private::ExecutionPolicy execution_policy, bool keep_result_in_memory, bool generate_debug_info)=0 |
Parse the expression. | |
virtual bool | Complete (ExecutionContext &exe_ctx, CompletionRequest &request, unsigned complete_pos) |
Attempts to find possible command line completions for the given (possible incomplete) user expression. | |
virtual bool | CanInterpret ()=0 |
bool | MatchesContext (ExecutionContext &exe_ctx) |
lldb::ExpressionResults | Execute (DiagnosticManager &diagnostic_manager, ExecutionContext &exe_ctx, const EvaluateExpressionOptions &options, lldb::UserExpressionSP &shared_ptr_to_me, lldb::ExpressionVariableSP &result) |
Execute the parsed expression by callinng the derived class's DoExecute method. | |
virtual bool | FinalizeJITExecution (DiagnosticManager &diagnostic_manager, ExecutionContext &exe_ctx, lldb::ExpressionVariableSP &result, lldb::addr_t function_stack_bottom=LLDB_INVALID_ADDRESS, lldb::addr_t function_stack_top=LLDB_INVALID_ADDRESS)=0 |
Apply the side effects of the function to program state. | |
const char * | Text () override |
Return the string that the parser should parse. | |
const char * | GetUserText () |
Return the string that the user typed. | |
const char * | FunctionName () override |
Return the function name that should be used for executing the expression. | |
virtual bool | IsParseCacheable () |
Returns whether the call to Parse on this user expression is cacheable. | |
SourceLanguage | Language () const override |
Return the language that should be used when parsing. | |
ResultType | DesiredResultType () const override |
Return the desired result type of the function, or eResultTypeAny if indifferent. | |
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. | |
EvaluateExpressionOptions * | GetOptions () override |
virtual lldb::ExpressionVariableSP | GetResultAfterDematerialization (ExecutionContextScope *exe_scope) |
llvm::StringRef | GetFixedText () |
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) |
Static Public Member Functions inherited from lldb_private::UserExpression | |
static bool | classof (const Expression *obj) |
static lldb::ExpressionResults | Evaluate (ExecutionContext &exe_ctx, const EvaluateExpressionOptions &options, llvm::StringRef expr_cstr, llvm::StringRef expr_prefix, lldb::ValueObjectSP &result_valobj_sp, Status &error, std::string *fixed_expression=nullptr, ValueObject *ctx_obj=nullptr) |
Evaluate one expression in the scratch context of the target passed in the exe_ctx and return its result. | |
Protected Attributes | |
lldb::addr_t | m_stack_frame_bottom |
The bottom of the allocated stack frame. | |
lldb::addr_t | m_stack_frame_top |
The top of the allocated stack frame. | |
bool | m_allow_cxx |
True if the language allows C++. | |
bool | m_allow_objc |
True if the language allows Objective-C. | |
std::string | m_transformed_text |
The text of the expression, as send to the parser. | |
std::shared_ptr< IRExecutionUnit > | m_execution_unit_sp |
The execution unit the expression is stored in. | |
std::unique_ptr< Materializer > | m_materializer_up |
The materializer to use when running the expression. | |
lldb::ModuleWP | m_jit_module_wp |
Target * | m_target |
The target for storing persistent data like types and variables. | |
bool | m_can_interpret |
True if the expression could be evaluated statically; false otherwise. | |
lldb::addr_t | m_materialized_address |
The address at which the arguments to the expression have been materialized. | |
Materializer::DematerializerSP | m_dematerializer_sp |
The dematerializer. | |
Protected Attributes inherited from lldb_private::UserExpression | |
Address | m_address |
The address the process is stopped in. | |
std::string | m_expr_text |
The text of the expression, as typed by the user. | |
std::string | m_expr_prefix |
The text of the translation-level definitions, as provided by the user. | |
std::string | m_fixed_text |
The text of the expression with fix-its applied this won't be set if the fixed text doesn't parse. | |
SourceLanguage | m_language |
The language to use when parsing (unknown means use defaults). | |
ResultType | m_desired_type |
The type to coerce the expression's result to. | |
EvaluateExpressionOptions | m_options |
Additional options provided by the user. | |
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::UserExpression | |
enum | { kDefaultTimeout = 500000u } |
Public Types inherited from lldb_private::Expression | |
enum | ResultType { eResultTypeAny , eResultTypeId } |
Static Public Attributes inherited from lldb_private::UserExpression | |
static const Status::ValueType | kNoResult |
ValueObject::GetError() returns this if there is no result from the expression. | |
Static Protected Member Functions inherited from lldb_private::UserExpression | |
static lldb::addr_t | GetObjectPointer (lldb::StackFrameSP frame_sp, llvm::StringRef object_name, Status &err) |
static lldb::ValueObjectSP | GetObjectPointerValueObject (lldb::StackFrameSP frame, llvm::StringRef object_name, Status &err) |
Return ValueObject for a given variable name in the current stack frame. | |
"lldb/Expression/LLVMUserExpression.h" Encapsulates a one-time expression for use in lldb.
LLDB uses expressions for various purposes, notably to call functions and as a backend for the expr command. LLVMUserExpression is a virtual base class that encapsulates the objects needed to parse and JIT an expression. The actual parsing part will be provided by the specific implementations of LLVMUserExpression - which will be vended through the appropriate TypeSystem.
Definition at line 32 of file LLVMUserExpression.h.
LLVMUserExpression::LLVMUserExpression | ( | ExecutionContextScope & | exe_scope, |
llvm::StringRef | expr, | ||
llvm::StringRef | prefix, | ||
SourceLanguage | language, | ||
ResultType | desired_type, | ||
const EvaluateExpressionOptions & | options | ||
) |
Definition at line 42 of file LLVMUserExpression.cpp.
|
override |
Definition at line 55 of file LLVMUserExpression.cpp.
References lldb_private::Target::GetImages(), m_jit_module_wp, m_target, and lldb_private::ModuleList::Remove().
|
protectedpure virtual |
Implemented in lldb_private::ClangUserExpression.
Referenced by DoExecute().
|
inlineoverridevirtual |
Implements lldb_private::UserExpression.
Definition at line 66 of file LLVMUserExpression.h.
References m_can_interpret.
|
inlinestatic |
Definition at line 40 of file LLVMUserExpression.h.
References ID, and lldb_private::Expression::isA().
|
overrideprotectedvirtual |
Implements lldb_private::UserExpression.
Definition at line 64 of file LLVMUserExpression.cpp.
References AddArguments(), lldb_private::DiagnosticManager::AppendMessageToDiagnostic(), lldb_private::Status::AsCString(), lldb_private::EvaluateExpressionOptions::DoesIgnoreBreakpoints(), lldb_private::EvaluateExpressionOptions::DoesUnwindOnError(), lldb::eExpressionCompleted, lldb::eExpressionDiscarded, lldb::eExpressionHitBreakpoint, lldb::eExpressionInterrupted, lldb::eExpressionResultUnavailable, lldb::eExpressionSetupError, lldb::eExpressionStoppedForDebug, lldb::eExpressionThreadVanished, lldb::eSeverityError, lldb::eSeverityInfo, lldb_private::Process::ExecutionResultAsCString(), lldb_private::Expressions, FinalizeJITExecution(), lldb_private::ThreadPlanCallFunction::GetFunctionStackPointer(), lldb_private::UserID::GetID(), lldb_private::GetLog(), lldb_private::ExecutionContext::GetProcessPtr(), lldb_private::ExecutionContext::GetProcessRef(), lldb_private::ThreadPlanCallUserExpression::GetRealStopInfo(), lldb_private::StreamString::GetString(), lldb_private::ExecutionContext::GetThreadRef(), lldb_private::EvaluateExpressionOptions::GetTimeout(), lldb_private::ExecutionContext::HasThreadScope(), IRInterpreter::Interpret(), LLDB_INVALID_ADDRESS, LLDB_LOGF, m_can_interpret, m_execution_unit_sp, lldb_private::Expression::m_jit_start_addr, m_stack_frame_bottom, m_stack_frame_top, PrepareToExecuteJITExpression(), lldb_private::DiagnosticManager::Printf(), lldb_private::DiagnosticManager::PutString(), lldb_private::Process::RunThreadPlan(), lldb_private::Process::SetRunningUserExpression(), lldb_private::Step, lldb_private::Status::Success(), and lldb_private::ThreadPlanCallUserExpression::TransferExpressionOwnership().
|
overridevirtual |
Apply the side effects of the function to program state.
[in] | diagnostic_manager | A diagnostic manager to report errors to. |
[in] | exe_ctx | The execution context to use when looking up entities that are needed for parsing (locations of variables, etc.) |
[in] | result | A pointer to direct at the persistent variable in which the expression's result is stored. |
[in] | function_stack_bottom | A pointer to the bottom of the function's stack frame. This is used to determine whether the expression result resides in memory that will still be valid, or whether it needs to be treated as homeless for the purpose of future expressions. |
[in] | function_stack_top | A pointer to the top of the function's stack frame. This is used to determine whether the expression result resides in memory that will still be valid, or whether it needs to be treated as homeless for the purpose of future expressions. |
Implements lldb_private::UserExpression.
Definition at line 253 of file LLVMUserExpression.cpp.
References lldb_private::Status::AsCString(), lldb::eSeverityError, lldb_private::Expressions, lldb_private::ExecutionContext::GetBestExecutionContextScope(), lldb_private::GetLog(), lldb_private::UserExpression::GetResultAfterDematerialization(), LLDB_LOGF, m_dematerializer_sp, lldb_private::DiagnosticManager::Printf(), and lldb_private::Status::Success().
Referenced by DoExecute().
|
inlineoverridevirtual |
Return the Materializer that the parser should use when registering external values.
Reimplemented from lldb_private::Expression.
Definition at line 68 of file LLVMUserExpression.h.
References m_materializer_up.
Referenced by lldb_private::ClangUserExpression::Complete(), and lldb_private::ClangUserExpression::TryParse().
|
inlineoverridevirtual |
Implements lldb_private::Expression.
Reimplemented in lldb_private::ClangUserExpression.
Definition at line 37 of file LLVMUserExpression.h.
References ID, and lldb_private::UserExpression::isA().
Referenced by lldb_private::ClangUserExpression::isA().
|
protected |
Definition at line 292 of file LLVMUserExpression.cpp.
References lldb_private::Status::AsCString(), lldb_private::IRMemoryMap::eAllocationPolicyHostOnly, lldb_private::IRMemoryMap::eAllocationPolicyMirror, lldb::eSeverityError, LLDB_INVALID_ADDRESS, lldb_private::UserExpression::LockAndCheckContext(), m_can_interpret, m_dematerializer_sp, m_execution_unit_sp, lldb_private::Expression::m_jit_start_addr, m_materialized_address, m_materializer_up, m_stack_frame_bottom, m_stack_frame_top, lldb_private::DiagnosticManager::Printf(), lldb_private::DiagnosticManager::PutString(), and lldb_private::Status::Success().
Referenced by DoExecute().
|
protectedpure virtual |
Implemented in lldb_private::ClangUserExpression.
|
inlineoverridevirtual |
Return the string that the parser should parse.
Must be a full translation unit.
Implements lldb_private::Expression.
Definition at line 72 of file LLVMUserExpression.h.
References m_transformed_text.
|
staticprivate |
Definition at line 34 of file LLVMUserExpression.h.
|
protected |
True if the language allows C++.
Definition at line 97 of file LLVMUserExpression.h.
Referenced by lldb_private::ClangUserExpression::ClangUserExpression(), and lldb_private::ClangUserExpression::ScanContext().
|
protected |
True if the language allows Objective-C.
Definition at line 98 of file LLVMUserExpression.h.
Referenced by lldb_private::ClangUserExpression::ClangUserExpression(), and lldb_private::ClangUserExpression::ScanContext().
|
protected |
True if the expression could be evaluated statically; false otherwise.
Definition at line 111 of file LLVMUserExpression.h.
Referenced by CanInterpret(), DoExecute(), PrepareToExecuteJITExpression(), and lldb_private::ClangUserExpression::TryParse().
|
protected |
The dematerializer.
Definition at line 116 of file LLVMUserExpression.h.
Referenced by FinalizeJITExecution(), and PrepareToExecuteJITExpression().
|
protected |
The execution unit the expression is stored in.
Definition at line 103 of file LLVMUserExpression.h.
Referenced by DoExecute(), lldb_private::ClangUserExpression::Parse(), PrepareToExecuteJITExpression(), and lldb_private::ClangUserExpression::TryParse().
|
protected |
Definition at line 107 of file LLVMUserExpression.h.
Referenced by lldb_private::ClangUserExpression::Parse(), and ~LLVMUserExpression().
|
protected |
The address at which the arguments to the expression have been materialized.
Definition at line 113 of file LLVMUserExpression.h.
Referenced by PrepareToExecuteJITExpression().
|
protected |
The materializer to use when running the expression.
Definition at line 104 of file LLVMUserExpression.h.
Referenced by lldb_private::ClangUserExpression::Complete(), GetMaterializer(), PrepareToExecuteJITExpression(), and lldb_private::ClangUserExpression::TryParse().
|
protected |
The bottom of the allocated stack frame.
Definition at line 94 of file LLVMUserExpression.h.
Referenced by DoExecute(), and PrepareToExecuteJITExpression().
|
protected |
The top of the allocated stack frame.
Definition at line 95 of file LLVMUserExpression.h.
Referenced by DoExecute(), and PrepareToExecuteJITExpression().
|
protected |
The target for storing persistent data like types and variables.
Definition at line 108 of file LLVMUserExpression.h.
Referenced by lldb_private::ClangUserExpression::ClangUserExpressionHelper::ASTTransformer(), lldb_private::ClangUserExpression::PrepareForParsing(), lldb_private::ClangUserExpression::ScanContext(), and ~LLVMUserExpression().
|
protected |
The text of the expression, as send to the parser.
Definition at line 100 of file LLVMUserExpression.h.
Referenced by lldb_private::ClangUserExpression::Complete(), lldb_private::ClangUserExpression::CreateSourceCode(), lldb_private::ClangUserExpression::Parse(), and Text().