LLDB mainline
Classes | Public Member Functions | Static Public Member Functions | Private Attributes | Static Private Attributes | List of all members
lldb_private::ClangUtilityFunction Class Reference

"lldb/Expression/ClangUtilityFunction.h" Encapsulates a single expression for use with Clang More...

#include <ClangUtilityFunction.h>

Inheritance diagram for lldb_private::ClangUtilityFunction:
Inheritance graph
[legend]

Classes

class  ClangUtilityFunctionHelper
 

Public Member Functions

bool isA (const void *ClassID) const override
 
 ClangUtilityFunction (ExecutionContextScope &exe_scope, std::string text, std::string name, bool enable_debugging)
 Constructor.
 
 ~ClangUtilityFunction () override
 
ExpressionTypeSystemHelperGetTypeSystemHelper () override
 
ClangExpressionDeclMapDeclMap ()
 
void ResetDeclMap ()
 
void ResetDeclMap (ExecutionContext &exe_ctx, bool keep_result_in_memory)
 
bool Install (DiagnosticManager &diagnostic_manager, ExecutionContext &exe_ctx) override
 Install the utility function into a process.
 
- Public Member Functions inherited from lldb_private::UtilityFunction
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.
 
ExpressionVariableListLocalVariables ()
 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.
 
FunctionCallerMakeFunctionCaller (const CompilerType &return_type, const ValueList &arg_value_list, lldb::ThreadSP compilation_thread, Status &error)
 
FunctionCallerGetFunctionCaller ()
 
- 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 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
 

Static Public Member Functions

static bool classof (const Expression *obj)
 
- Static Public Member Functions inherited from lldb_private::UtilityFunction
static bool classof (const Expression *obj)
 

Private Attributes

ClangUtilityFunctionHelper m_type_system_helper
 The map to use when parsing and materializing the expression.
 

Static Private Attributes

static char ID
 

Additional Inherited Members

- Public Types inherited from lldb_private::Expression
enum  ResultType { eResultTypeAny , eResultTypeId }
 
- Protected Attributes inherited from lldb_private::UtilityFunction
std::shared_ptr< IRExecutionUnitm_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< FunctionCallerm_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.
 

Detailed Description

"lldb/Expression/ClangUtilityFunction.h" Encapsulates a single expression for use with Clang

LLDB uses expressions for various purposes, notably to call functions and as a backend for the expr command. ClangUtilityFunction encapsulates a self-contained function meant to be used from other code. Utility functions can perform error-checking for ClangUserExpressions, or can simply provide a way to push a function into the target for the debugger to call later on.

Definition at line 34 of file ClangUtilityFunction.h.

Constructor & Destructor Documentation

◆ ClangUtilityFunction()

ClangUtilityFunction::ClangUtilityFunction ( ExecutionContextScope exe_scope,
std::string  text,
std::string  name,
bool  enable_debugging 
)

Constructor.

Parameters
[in]textThe text of the function. Must be a full translation unit.
[in]nameThe name of the function, as used in the text.
[in]enable_debuggingEnable debugging of this function.

Definition at line 32 of file ClangUtilityFunction.cpp.

References lldb_private::NativeFile::Close(), lldb_private::File::eOpenOptionWriteOnly, lldb_private::ClangExpressionSourceCode::g_expression_prefix, lldb_private::ClangExpressionSourceCode::g_expression_suffix, lldb_private::UtilityFunction::m_function_text, and lldb_private::NativeFile::Write().

◆ ~ClangUtilityFunction()

ClangUtilityFunction::~ClangUtilityFunction ( )
overridedefault

Member Function Documentation

◆ classof()

static bool lldb_private::ClangUtilityFunction::classof ( const Expression obj)
inlinestatic

Definition at line 42 of file ClangUtilityFunction.h.

References ID, and lldb_private::Expression::isA().

◆ DeclMap()

ClangExpressionDeclMap * lldb_private::ClangUtilityFunction::DeclMap ( )
inline

◆ GetTypeSystemHelper()

ExpressionTypeSystemHelper * lldb_private::ClangUtilityFunction::GetTypeSystemHelper ( )
inlineoverridevirtual

Reimplemented from lldb_private::Expression.

Definition at line 59 of file ClangUtilityFunction.h.

References m_type_system_helper.

◆ Install()

bool ClangUtilityFunction::Install ( DiagnosticManager diagnostic_manager,
ExecutionContext exe_ctx 
)
overridevirtual

Install the utility function into a process.

Parameters
[in]diagnostic_managerA diagnostic manager to report errors and warnings to.
[in]exe_ctxThe execution context to install the utility function to.
Returns
True on success (no errors); false otherwise.

Implements lldb_private::UtilityFunction.

Definition at line 75 of file ClangUtilityFunction.cpp.

References lldb_private::ModuleList::Append(), lldb_private::Status::AsCString(), DeclMap(), lldb_private::ClangExpressionDeclMap::DidParse(), lldb_private::eDiagnosticSeverityError, lldb_private::eDiagnosticSeverityWarning, lldb_private::eExecutionPolicyAlways, lldb::eStateStopped, lldb_private::UtilityFunction::FunctionName(), lldb_private::ExecutionContext::GetBestExecutionContextScope(), lldb_private::ExpressionParser::GetGenerateDebugInfo(), lldb_private::Target::GetImages(), lldb_private::ExecutionContext::GetProcessPtr(), lldb_private::Process::GetState(), lldb_private::ExecutionContext::GetTargetPtr(), LLDB_INVALID_ADDRESS, lldb_private::UtilityFunction::m_execution_unit_sp, lldb_private::Expression::m_jit_end_addr, lldb_private::UtilityFunction::m_jit_module_wp, lldb_private::Expression::m_jit_process_wp, lldb_private::Expression::m_jit_start_addr, lldb_private::ClangExpressionParser::Parse(), lldb_private::ClangExpressionParser::PrepareForExecution(), lldb_private::DiagnosticManager::Printf(), lldb_private::DiagnosticManager::PutString(), ResetDeclMap(), lldb_private::FileSpec::SetFilename(), and lldb_private::Status::Success().

◆ isA()

bool lldb_private::ClangUtilityFunction::isA ( const void *  ClassID) const
inlineoverridevirtual

Reimplemented from lldb_private::UtilityFunction.

Definition at line 39 of file ClangUtilityFunction.h.

References ID, and lldb_private::UtilityFunction::isA().

◆ ResetDeclMap() [1/2]

void lldb_private::ClangUtilityFunction::ResetDeclMap ( )
inline

◆ ResetDeclMap() [2/2]

void lldb_private::ClangUtilityFunction::ResetDeclMap ( ExecutionContext exe_ctx,
bool  keep_result_in_memory 
)
inline

Member Data Documentation

◆ ID

char ClangUtilityFunction::ID
staticprivate

Definition at line 36 of file ClangUtilityFunction.h.

Referenced by classof(), and isA().

◆ m_type_system_helper

ClangUtilityFunctionHelper lldb_private::ClangUtilityFunction::m_type_system_helper
private

The map to use when parsing and materializing the expression.

Definition at line 108 of file ClangUtilityFunction.h.

Referenced by DeclMap(), GetTypeSystemHelper(), and ResetDeclMap().


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