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]

Public Types

enum  ResultType { eResultTypeAny , eResultTypeId }
 

Public Member Functions

 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 lldb::LanguageType Language () const
 Return the language that should be used when parsing.
 
virtual MaterializerGetMaterializer ()
 Return the Materializer that the parser should use when registering external values.
 
virtual ResultType DesiredResultType ()
 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 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.
 
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 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...
 
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.
 

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 31 of file Expression.h.

Member Enumeration Documentation

◆ ResultType

Enumerator
eResultTypeAny 
eResultTypeId 

Definition at line 33 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 ( )
virtualdefault

Destructor.

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 62 of file Expression.h.

References eResultTypeAny.

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 82 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().

◆ 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 58 of file Expression.h.

◆ GetOptions()

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

Reimplemented in lldb_private::UserExpression.

Definition at line 72 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 52 of file Expression.h.

References lldb::eLanguageTypeUnknown.

Referenced by lldb_private::ClangExpressionParser::ClangExpressionParser(), 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 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 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 76 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::LLVMUserExpression, lldb_private::UserExpression, and lldb_private::UtilityFunction.

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

◆ WillStartExecuting()

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

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

Definition at line 79 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 97 of file Expression.h.

Referenced by lldb_private::UtilityFunction::ContainsAddress(), lldb_private::ClangUtilityFunction::Install(), lldb_private::ClangUserExpression::TryParse(), 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 90 of file Expression.h.

Referenced by Expression().


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