LLDB mainline
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:
[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
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 SourceLanguage 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 () const
 Return the desired result type of the function, or eResultTypeAny if indifferent.
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.

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, lldb_private::UtilityFunction::UtilityFunction(), and lldb_private::NativeFile::Write().

◆ ~ClangUtilityFunction()

ClangUtilityFunction::~ClangUtilityFunction ( )
overridedefault

Member Function Documentation

◆ classof()

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

Definition at line 63 of file ClangUtilityFunction.h.

References m_type_system_helper.

Referenced by Install().

◆ 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

◆ isA()

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

Implements lldb_private::Expression.

Definition at line 39 of file ClangUtilityFunction.h.

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

◆ ResetDeclMap() [1/2]

void lldb_private::ClangUtilityFunction::ResetDeclMap ( )
inline

Definition at line 65 of file ClangUtilityFunction.h.

References m_type_system_helper.

Referenced by Install().

◆ ResetDeclMap() [2/2]

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

Definition at line 67 of file ClangUtilityFunction.h.

References m_type_system_helper.

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(), ResetDeclMap(), and ResetDeclMap().


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