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  ExpressionKind {
  eKindFunctionCaller, eKindClangFunctionCaller, eKindUserExpression, eKindLLVMUserExpression,
  eKindClangUserExpression, eKindUtilityFunction, eKindClangUtilityFunction
}
 Discriminator for LLVM-style RTTI (dyn_cast<> et al.) More...
 
enum  ResultType { eResultTypeAny, eResultTypeId }
 

Public Member Functions

 Expression (Target &target, ExpressionKind kind)
 
 Expression (ExecutionContextScope &exe_scope, ExpressionKind kind)
 
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 ()
 Return the language that should be used when parsing. 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 ()
 
ExpressionKind getKind () const
 LLVM-style RTTI support. More...
 

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

◆ ExpressionKind

Discriminator for LLVM-style RTTI (dyn_cast<> et al.)

Enumerator
eKindFunctionCaller 
eKindClangFunctionCaller 
eKindUserExpression 
eKindLLVMUserExpression 
eKindClangUserExpression 
eKindUtilityFunction 
eKindClangUtilityFunction 

Definition at line 36 of file Expression.h.

◆ ResultType

Enumerator
eResultTypeAny 
eResultTypeId 

Definition at line 46 of file Expression.h.

Constructor & Destructor Documentation

◆ Expression() [1/2]

Expression::Expression ( Target target,
ExpressionKind  kind 
)

Definition at line 15 of file Expression.cpp.

References m_target_wp.

◆ Expression() [2/2]

Expression::Expression ( ExecutionContextScope exe_scope,
ExpressionKind  kind 
)

Definition at line 24 of file Expression.cpp.

References m_target_wp.

◆ ~Expression()

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

Destructor.

Definition at line 53 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 69 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 89 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().

◆ getKind()

ExpressionKind lldb_private::Expression::getKind ( ) const
inline

◆ GetOptions()

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

Reimplemented in lldb_private::UserExpression.

Definition at line 79 of file Expression.h.

◆ GetTypeSystemHelper()

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

◆ Language()

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

Return the language that should be used when parsing.

To use the default, return eLanguageTypeUnknown.

Reimplemented in lldb_private::UserExpression.

Definition at line 65 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 83 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::Parse(), 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 86 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 107 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 100 of file Expression.h.

Referenced by Expression().


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