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]

Public Member Functions

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

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.
 

Private Attributes

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

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 512 of file IRDynamicChecks.cpp.

◆ ~IRDynamicChecks()

IRDynamicChecks::~IRDynamicChecks ( )
overridedefault

Destructor.

Member Function Documentation

◆ assignPassManager()

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

Interface stub.

Definition at line 564 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 566 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 519 of file IRDynamicChecks.cpp.

References lldb_private::Expressions, lldb_private::GetLog(), lldb_private::Log::GetVerbose(), Instrumenter::Inspect(), Instrumenter::Instrument(), LLDB_LOGF, m_checker_functions, m_func_name, lldb_private::ClangDynamicCheckerFunctions::m_objc_object_check, and lldb_private::ClangDynamicCheckerFunctions::m_valid_pointer_check.

Referenced by lldb_private::ClangExpressionParser::DoPrepareForExecution().

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: