class RuntimeDyldChecker

Declaration

class RuntimeDyldChecker { /* full declaration omitted */ };

Description

RuntimeDyld invariant checker for verifying that RuntimeDyld has correctly applied relocations. The RuntimeDyldChecker class evaluates expressions against an attached RuntimeDyld instance to verify that relocations have been applied correctly. The expression language supports basic pointer arithmetic and bit-masking, and has limited disassembler integration for accessing instruction operands and the next PC (program counter) address for each instruction. The language syntax is: check = expr '=' expr expr = binary_expr | sliceable_expr sliceable_expr = '*{' number '}' load_addr_expr [slice] | '(' expr ')' [slice] | ident_expr [slice] | number [slice] slice = '[' high-bit-index ':' low-bit-index ']' load_addr_expr = symbol | '(' symbol '+' number ')' | '(' symbol '-' number ')' ident_expr = 'decode_operand' '(' symbol ',' operand-index ')' | 'next_pc' '(' symbol ')' | 'stub_addr' '(' stub-container-name ',' symbol ')' | 'got_addr' '(' stub-container-name ',' symbol ')' | symbol binary_expr = expr '+' expr | expr '-' expr | expr ' & ' expr | expr '|' expr | expr ' < < ' expr | expr '>>' expr

Declared at: llvm/include/llvm/ExecutionEngine/RuntimeDyldChecker.h:74

Member Variables

private std::unique_ptr<RuntimeDyldCheckerImpl> Impl

Method Overview

  • public RuntimeDyldChecker(llvm::RuntimeDyldChecker::IsSymbolValidFunction IsSymbolValid, llvm::RuntimeDyldChecker::GetSymbolInfoFunction GetSymbolInfo, llvm::RuntimeDyldChecker::GetSectionInfoFunction GetSectionInfo, llvm::RuntimeDyldChecker::GetStubInfoFunction GetStubInfo, llvm::RuntimeDyldChecker::GetGOTInfoFunction GetGOTInfo, support::endianness Endianness, llvm::MCDisassembler * Disassembler, llvm::MCInstPrinter * InstPrinter, llvm::raw_ostream & ErrStream)
  • public bool check(llvm::StringRef CheckExpr) const
  • public bool checkAllRulesInBuffer(llvm::StringRef RulePrefix, llvm::MemoryBuffer * MemBuf) const
  • public std::pair<uint64_t, std::string> getSectionAddr(llvm::StringRef FileName, llvm::StringRef SectionName, bool LocalAddress)
  • public Optional<uint64_t> getSectionLoadAddress(void * LocalAddress) const
  • public ~RuntimeDyldChecker()

Methods

RuntimeDyldChecker(
    llvm::RuntimeDyldChecker::
        IsSymbolValidFunction IsSymbolValid,
    llvm::RuntimeDyldChecker::
        GetSymbolInfoFunction GetSymbolInfo,
    llvm::RuntimeDyldChecker::
        GetSectionInfoFunction GetSectionInfo,
    llvm::RuntimeDyldChecker::GetStubInfoFunction
        GetStubInfo,
    llvm::RuntimeDyldChecker::GetGOTInfoFunction
        GetGOTInfo,
    support::endianness Endianness,
    llvm::MCDisassembler* Disassembler,
    llvm::MCInstPrinter* InstPrinter,
    llvm::raw_ostream& ErrStream)

Declared at: llvm/include/llvm/ExecutionEngine/RuntimeDyldChecker.h:145

Parameters

llvm::RuntimeDyldChecker::IsSymbolValidFunction IsSymbolValid
llvm::RuntimeDyldChecker::GetSymbolInfoFunction GetSymbolInfo
llvm::RuntimeDyldChecker::GetSectionInfoFunction GetSectionInfo
llvm::RuntimeDyldChecker::GetStubInfoFunction GetStubInfo
llvm::RuntimeDyldChecker::GetGOTInfoFunction GetGOTInfo
support::endianness Endianness
llvm::MCDisassembler* Disassembler
llvm::MCInstPrinter* InstPrinter
llvm::raw_ostream& ErrStream

bool check(llvm::StringRef CheckExpr) const

Description

Check a single expression against the attached RuntimeDyld instance.

Declared at: llvm/include/llvm/ExecutionEngine/RuntimeDyldChecker.h:157

Parameters

llvm::StringRef CheckExpr

bool checkAllRulesInBuffer(
    llvm::StringRef RulePrefix,
    llvm::MemoryBuffer* MemBuf) const

Description

Scan the given memory buffer for lines beginning with the string in RulePrefix. The remainder of the line is passed to the check method to be evaluated as an expression.

Declared at: llvm/include/llvm/ExecutionEngine/RuntimeDyldChecker.h:162

Parameters

llvm::StringRef RulePrefix
llvm::MemoryBuffer* MemBuf

std::pair<uint64_t, std::string> getSectionAddr(
    llvm::StringRef FileName,
    llvm::StringRef SectionName,
    bool LocalAddress)

Description

Returns the address of the requested section (or an error message in the second element of the pair if the address cannot be found). if 'LocalAddress' is true, this returns the address of the section within the linker's memory. If 'LocalAddress' is false it returns the address within the target process (i.e. the load address).

Declared at: llvm/include/llvm/ExecutionEngine/RuntimeDyldChecker.h:170

Parameters

llvm::StringRef FileName
llvm::StringRef SectionName
bool LocalAddress

Optional<uint64_t> getSectionLoadAddress(
    void* LocalAddress) const

Description

If there is a section at the given local address, return its load address, otherwise return none.

Declared at: llvm/include/llvm/ExecutionEngine/RuntimeDyldChecker.h:176

Parameters

void* LocalAddress

~RuntimeDyldChecker()

Declared at: llvm/include/llvm/ExecutionEngine/RuntimeDyldChecker.h:153