LLDB mainline
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:
[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 69 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 430 of file IRDynamicChecks.cpp.

References ID, m_checker_functions, and m_func_name.

◆ ~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 470 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 472 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 437 of file IRDynamicChecks.cpp.

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

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 121 of file IRDynamicChecks.h.

Referenced by IRDynamicChecks(), and 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 119 of file IRDynamicChecks.h.

Referenced by IRDynamicChecks(), and runOnModule().


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