LLDB  mainline
Public Types | Public Member Functions | Protected Attributes | List of all members
lldb_private::Expression Class Referenceabstract

Encapsulates a single expression for use in lldb. More...

#include "lldb/Expression/Expression.h"

Inheritance diagram for lldb_private::Expression:
Inheritance graph
[legend]
Collaboration diagram for lldb_private::Expression:
Collaboration graph
[legend]

Public Types

enum  ResultType { eResultTypeAny, eResultTypeId }
 

Public Member Functions

 Expression (Target &target)
 
 Expression (ExecutionContextScope &exe_scope)
 
virtual ~Expression ()
 Destructor. More...
 
virtual const char * Text ()=0
 Return the string that the parser should parse. More...
 
virtual const char * FunctionName ()=0
 Return the function name that should be used for executing the expression. More...
 
virtual lldb::LanguageType Language () const
 Return the language that should be used when parsing. More...
 
virtual MaterializerGetMaterializer ()
 Return the Materializer that the parser should use when registering external values. More...
 
virtual ResultType DesiredResultType ()
 Return the desired result type of the function, or eResultTypeAny if indifferent. More...
 
virtual bool NeedsValidation ()=0
 Flags. More...
 
virtual bool NeedsVariableResolution ()=0
 Return true if external variables in the expression should be resolved. More...
 
virtual EvaluateExpressionOptionsGetOptions ()
 
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. More...
 
virtual void WillStartExecuting ()
 Called to notify the expression that it is about to be executed. More...
 
virtual void DidFinishExecuting ()
 Called to notify the expression that its execution has finished. More...
 
virtual ExpressionTypeSystemHelperGetTypeSystemHelper ()
 
virtual bool isA (const void *ClassID) const =0
 

Protected Attributes

lldb::TargetWP m_target_wp
 
lldb::ProcessWP m_jit_process_wp
 Expression's always have to have a target... More...
 
lldb::addr_t m_jit_start_addr
 An expression might have a process, but it doesn't need to (e.g. More...
 
lldb::addr_t m_jit_end_addr
 The address of the JITted function within the JIT allocation. More...
 

Detailed Description

Encapsulates a single expression for use in lldb.

LLDB uses expressions for various purposes, notably to call functions and as a backend for the expr command. Expression encapsulates the objects needed to parse and interpret or JIT an expression. It uses the expression parser appropriate to the language of the expression to produce LLVM IR from the expression.

Definition at line 33 of file Expression.h.

Member Enumeration Documentation

◆ ResultType

Enumerator
eResultTypeAny 
eResultTypeId 

Definition at line 35 of file Expression.h.

Constructor & Destructor Documentation

◆ Expression() [1/2]

Expression::Expression ( Target target)

Definition at line 15 of file Expression.cpp.

References m_target_wp.

◆ Expression() [2/2]

Expression::Expression ( ExecutionContextScope exe_scope)

Definition at line 23 of file Expression.cpp.

References m_target_wp.

◆ ~Expression()

virtual lldb_private::Expression::~Expression ( )
inlinevirtual

Destructor.

Definition at line 42 of file Expression.h.

References FunctionName(), and Text().

Member Function Documentation

◆ DesiredResultType()

virtual ResultType lldb_private::Expression::DesiredResultType ( )
inlinevirtual

Return the desired result type of the function, or eResultTypeAny if indifferent.

Reimplemented in lldb_private::UserExpression.

Definition at line 64 of file Expression.h.

References eResultTypeAny, NeedsValidation(), and NeedsVariableResolution().

Referenced by lldb_private::ClangExpressionParser::ClangExpressionParser().

◆ DidFinishExecuting()

virtual void lldb_private::Expression::DidFinishExecuting ( )
inlinevirtual

Called to notify the expression that its execution has finished.

Definition at line 84 of file Expression.h.

◆ FunctionName()

virtual const char* lldb_private::Expression::FunctionName ( )
pure virtual

Return the function name that should be used for executing the expression.

Text() should contain the definition of this function.

Implemented in lldb_private::FunctionCaller, lldb_private::UserExpression, and lldb_private::UtilityFunction.

Referenced by lldb_private::ClangExpressionParser::PrepareForExecution(), and ~Expression().

◆ GetMaterializer()

virtual Materializer* lldb_private::Expression::GetMaterializer ( )
inlinevirtual

Return the Materializer that the parser should use when registering external values.

Reimplemented in lldb_private::LLVMUserExpression.

Definition at line 60 of file Expression.h.

◆ GetOptions()

virtual EvaluateExpressionOptions* lldb_private::Expression::GetOptions ( )
inlinevirtual

Reimplemented in lldb_private::UserExpression.

Definition at line 74 of file Expression.h.

◆ GetTypeSystemHelper()

virtual ExpressionTypeSystemHelper* lldb_private::Expression::GetTypeSystemHelper ( )
inlinevirtual

◆ isA()

virtual bool lldb_private::Expression::isA ( const void *  ClassID) const
pure virtual

◆ Language()

virtual lldb::LanguageType lldb_private::Expression::Language ( ) const
inlinevirtual

Return the language that should be used when parsing.

To use the default, return eLanguageTypeUnknown.

Reimplemented in lldb_private::UserExpression.

Definition at line 54 of file Expression.h.

References lldb::eLanguageTypeUnknown.

Referenced by lldb_private::ClangExpressionParser::ClangExpressionParser(), lldb_private::UtilityFunction::MakeFunctionCaller(), and lldb_private::ClangExpressionParser::PrepareForExecution().

◆ NeedsValidation()

virtual bool lldb_private::Expression::NeedsValidation ( )
pure virtual

Flags.

Return true if validation code should be inserted into the expression.

Implemented in lldb_private::FunctionCaller, lldb_private::UserExpression, and lldb_private::UtilityFunction.

Referenced by DesiredResultType(), and lldb_private::ClangExpressionParser::PrepareForExecution().

◆ NeedsVariableResolution()

virtual bool lldb_private::Expression::NeedsVariableResolution ( )
pure virtual

Return true if external variables in the expression should be resolved.

Implemented in lldb_private::FunctionCaller, lldb_private::UserExpression, and lldb_private::UtilityFunction.

Referenced by DesiredResultType(), and lldb_private::ClangExpressionParser::PrepareForExecution().

◆ StartAddress()

lldb::addr_t lldb_private::Expression::StartAddress ( )
inline

Return the address of the function's JIT-compiled code, or LLDB_INVALID_ADDRESS if the function is not JIT compiled.

Definition at line 78 of file Expression.h.

References m_jit_start_addr.

Referenced by lldb_private::UtilityFunction::MakeFunctionCaller().

◆ Text()

virtual const char* lldb_private::Expression::Text ( )
pure virtual

Return the string that the parser should parse.

Must be a full translation unit.

Implemented in lldb_private::FunctionCaller, lldb_private::UserExpression, lldb_private::UtilityFunction, and lldb_private::LLVMUserExpression.

Referenced by lldb_private::ClangExpressionParser::ParseInternal(), and ~Expression().

◆ WillStartExecuting()

virtual void lldb_private::Expression::WillStartExecuting ( )
inlinevirtual

Called to notify the expression that it is about to be executed.

Definition at line 81 of file Expression.h.

Member Data Documentation

◆ m_jit_end_addr

lldb::addr_t lldb_private::Expression::m_jit_end_addr
protected

The address of the JITted function within the JIT allocation.

LLDB_INVALID_ADDRESS if invalid.

Definition at line 99 of file Expression.h.

Referenced by lldb_private::UtilityFunction::ContainsAddress(), lldb_private::ClangUtilityFunction::Install(), lldb_private::ClangUserExpression::Parse(), and lldb_private::FunctionCaller::WriteFunctionWrapper().

◆ m_jit_process_wp

lldb::ProcessWP lldb_private::Expression::m_jit_process_wp
protected

◆ m_jit_start_addr

lldb::addr_t lldb_private::Expression::m_jit_start_addr
protected

◆ m_target_wp

lldb::TargetWP lldb_private::Expression::m_target_wp
protected

Definition at line 92 of file Expression.h.

Referenced by Expression().


The documentation for this class was generated from the following files: