1
//===-- RuntimeDyldCheckerImpl.h -- RuntimeDyld test framework --*- C++ -*-===//
3
// The LLVM Compiler Infrastructure
5
// This file is distributed under the University of Illinois Open Source
6
// License. See LICENSE.TXT for details.
8
//===----------------------------------------------------------------------===//
10
#ifndef LLVM_LIB_EXECUTIONENGINE_RUNTIMEDYLD_RUNTIMEDYLDCHECKERIMPL_H
11
#define LLVM_LIB_EXECUTIONENGINE_RUNTIMEDYLD_RUNTIMEDYLDCHECKERIMPL_H
13
#include "RuntimeDyldImpl.h"
18
class RuntimeDyldCheckerImpl {
19
friend class RuntimeDyldChecker;
20
friend class RuntimeDyldImpl;
21
friend class RuntimeDyldCheckerExprEval;
22
friend class RuntimeDyldELF;
25
RuntimeDyldCheckerImpl(RuntimeDyld &RTDyld, MCDisassembler *Disassembler,
26
MCInstPrinter *InstPrinter,
27
llvm::raw_ostream &ErrStream);
29
bool check(StringRef CheckExpr) const;
30
bool checkAllRulesInBuffer(StringRef RulePrefix, MemoryBuffer *MemBuf) const;
35
typedef std::map<std::string, uint64_t> StubOffsetsMap;
36
struct SectionAddressInfo {
38
StubOffsetsMap StubOffsets;
40
typedef std::map<std::string, SectionAddressInfo> SectionMap;
41
typedef std::map<std::string, SectionMap> StubMap;
43
RuntimeDyldImpl &getRTDyld() const { return *RTDyld.Dyld; }
45
bool isSymbolValid(StringRef Symbol) const;
46
uint64_t getSymbolLocalAddr(StringRef Symbol) const;
47
uint64_t getSymbolRemoteAddr(StringRef Symbol) const;
48
uint64_t readMemoryAtAddr(uint64_t Addr, unsigned Size) const;
50
std::pair<const SectionAddressInfo*, std::string> findSectionAddrInfo(
52
StringRef SectionName) const;
54
std::pair<uint64_t, std::string> getSectionAddr(StringRef FileName,
55
StringRef SectionName,
56
bool IsInsideLoad) const;
58
std::pair<uint64_t, std::string> getStubAddrFor(StringRef FileName,
59
StringRef SectionName,
61
bool IsInsideLoad) const;
62
StringRef getSubsectionStartingAt(StringRef Name) const;
64
void registerSection(StringRef FilePath, unsigned SectionID);
65
void registerStubMap(StringRef FilePath, unsigned SectionID,
66
const RuntimeDyldImpl::StubMap &RTDyldStubs);
69
MCDisassembler *Disassembler;
70
MCInstPrinter *InstPrinter;
71
llvm::raw_ostream &ErrStream;