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

#include <ClangUtilityFunction.h>

Inheritance diagram for lldb_private::ClangUtilityFunction:
Inheritance graph
Collaboration diagram for lldb_private::ClangUtilityFunction:
Collaboration graph


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. More...
 ~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. More...
- Public Member Functions inherited from lldb_private::UtilityFunction
 UtilityFunction (ExecutionContextScope &exe_scope, std::string text, std::string name, bool enable_debugging)
 Constructor. More...
 ~UtilityFunction () override
bool ContainsAddress (lldb::addr_t address)
 Check whether the given address is inside the function. More...
const char * Text () override
 Return the string that the parser should parse. More...
const char * FunctionName () override
 Return the function name that should be used for executing the expression. More...
ExpressionVariableListLocalVariables ()
 Return the object that the parser should use when registering local variables. More...
bool NeedsValidation () override
 Return true if validation code should be inserted into the expression. More...
bool NeedsVariableResolution () override
 Return true if external variables in the expression should be resolved. More...
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. 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 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...

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. More...

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. More...
std::string m_function_name
 The name of the function. More...
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... 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

"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 


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

◆ ~ClangUtilityFunction()

ClangUtilityFunction::~ClangUtilityFunction ( )

Member Function Documentation

◆ classof()

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

Definition at line 42 of file ClangUtilityFunction.h.

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

◆ DeclMap()

ClangExpressionDeclMap* lldb_private::ClangUtilityFunction::DeclMap ( )

◆ GetTypeSystemHelper()

ExpressionTypeSystemHelper* lldb_private::ClangUtilityFunction::GetTypeSystemHelper ( )

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 

Install the utility function into a process.

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

Implements lldb_private::UtilityFunction.

Definition at line 76 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

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

◆ ResetDeclMap() [2/2]

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

Member Data Documentation

◆ ID

char ClangUtilityFunction::ID

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

The map to use when parsing and materializing the expression.

Definition at line 107 of file ClangUtilityFunction.h.

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

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