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

"lldb/Expression/IRDynamicChecks.h" Adds dynamic checks to a user-entered expression to reduce its likelihood of crashing More...

#include <IRDynamicChecks.h>

Inheritance diagram for lldb_private::IRDynamicChecks:
Inheritance graph
[legend]
Collaboration diagram for lldb_private::IRDynamicChecks:
Collaboration graph
[legend]

Public Member Functions

 IRDynamicChecks (ClangDynamicCheckerFunctions &checker_functions, const char *func_name="$__lldb_expr")
 Constructor. More...
 
 ~IRDynamicChecks () override
 Destructor. More...
 
bool runOnModule (llvm::Module &M) override
 Run this IR transformer on a single module. More...
 
void assignPassManager (llvm::PMStack &PMS, llvm::PassManagerType T=llvm::PMT_ModulePassManager) override
 Interface stub. More...
 
llvm::PassManagerType getPotentialPassManagerType () const override
 Returns PMT_ModulePassManager. More...
 

Private Member Functions

bool FindDataLoads (llvm::Module &M, llvm::BasicBlock &BB)
 A basic block-level pass to find all pointer dereferences and validate them before use. More...
 

Private Attributes

std::string m_func_name
 The name of the function to add checks to. More...
 
ClangDynamicCheckerFunctionsm_checker_functions
 The checker functions for the process. More...
 

Detailed Description

"lldb/Expression/IRDynamicChecks.h" Adds dynamic checks to a user-entered expression to reduce its likelihood of crashing

When an IR function is executed in the target process, it may cause crashes or hangs by dereferencing NULL pointers, trying to call Objective-C methods on objects that do not respond to them, and so forth.

IRDynamicChecks adds calls to the functions in DynamicCheckerFunctions to appropriate locations in an expression's IR.

Definition at line 70 of file IRDynamicChecks.h.

Constructor & Destructor Documentation

◆ IRDynamicChecks()

IRDynamicChecks::IRDynamicChecks ( ClangDynamicCheckerFunctions checker_functions,
const char *  func_name = "$__lldb_expr" 
)

Constructor.

Parameters
[in]checker_functionsThe checker functions for the target process.
[in]func_nameThe name of the function to prepare for execution in the target.

Definition at line 535 of file IRDynamicChecks.cpp.

References ~IRDynamicChecks().

◆ ~IRDynamicChecks()

IRDynamicChecks::~IRDynamicChecks ( )
overridedefault

Destructor.

Referenced by IRDynamicChecks().

Member Function Documentation

◆ assignPassManager()

void IRDynamicChecks::assignPassManager ( llvm::PMStack &  PMS,
llvm::PassManagerType  T = llvm::PMT_ModulePassManager 
)
override

Interface stub.

Definition at line 587 of file IRDynamicChecks.cpp.

◆ FindDataLoads()

bool lldb_private::IRDynamicChecks::FindDataLoads ( llvm::Module M,
llvm::BasicBlock &  BB 
)
private

A basic block-level pass to find all pointer dereferences and validate them before use.

The top-level pass implementation

Parameters
[in]MThe module currently being processed.
[in]BBThe basic block currently being processed.
Returns
True on success; false otherwise

◆ getPotentialPassManagerType()

PassManagerType IRDynamicChecks::getPotentialPassManagerType ( ) const
override

Returns PMT_ModulePassManager.

Definition at line 589 of file IRDynamicChecks.cpp.

◆ runOnModule()

bool IRDynamicChecks::runOnModule ( llvm::Module M)
override

Run this IR transformer on a single module.

Parameters
[in]MThe module to run on. This module is searched for the function $__lldb_expr, and that function is passed to the passes one by one.
Returns
True on success; false otherwise

Definition at line 542 of file IRDynamicChecks.cpp.

References lldb_private::Function, lldb_private::GetLogIfAllCategoriesSet(), lldb_private::Log::GetVerbose(), Instrumenter::Inspect(), Instrumenter::Instrument(), LIBLLDB_LOG_EXPRESSIONS, LLDB_LOGF, m_checker_functions, m_func_name, lldb_private::ClangDynamicCheckerFunctions::m_objc_object_check, and lldb_private::ClangDynamicCheckerFunctions::m_valid_pointer_check.

Member Data Documentation

◆ m_checker_functions

ClangDynamicCheckerFunctions& lldb_private::IRDynamicChecks::m_checker_functions
private

The checker functions for the process.

Definition at line 122 of file IRDynamicChecks.h.

Referenced by runOnModule().

◆ m_func_name

std::string lldb_private::IRDynamicChecks::m_func_name
private

The name of the function to add checks to.

Definition at line 120 of file IRDynamicChecks.h.

Referenced by runOnModule().


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