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"
17 class RuntimeDyldCheckerImpl {
18 friend class RuntimeDyldChecker;
19 friend class RuntimeDyldImpl;
20 friend class RuntimeDyldCheckerExprEval;
21 friend class RuntimeDyldELF;
24 RuntimeDyldCheckerImpl(RuntimeDyld &RTDyld, MCDisassembler *Disassembler,
25 MCInstPrinter *InstPrinter,
26 llvm::raw_ostream &ErrStream);
28 bool check(StringRef CheckExpr) const;
29 bool checkAllRulesInBuffer(StringRef RulePrefix, MemoryBuffer *MemBuf) const;
34 typedef std::map<std::string, uint64_t> StubOffsetsMap;
35 struct SectionAddressInfo {
37 StubOffsetsMap StubOffsets;
39 typedef std::map<std::string, SectionAddressInfo> SectionMap;
40 typedef std::map<std::string, SectionMap> StubMap;
42 RuntimeDyldImpl &getRTDyld() const { return *RTDyld.Dyld; }
44 Expected<JITSymbolResolver::LookupResult>
45 lookup(const JITSymbolResolver::LookupSet &Symbols) const;
47 bool isSymbolValid(StringRef Symbol) const;
48 uint64_t getSymbolLocalAddr(StringRef Symbol) const;
49 uint64_t getSymbolRemoteAddr(StringRef Symbol) const;
50 uint64_t readMemoryAtAddr(uint64_t Addr, unsigned Size) const;
52 std::pair<const SectionAddressInfo*, std::string> findSectionAddrInfo(
54 StringRef SectionName) const;
56 std::pair<uint64_t, std::string> getSectionAddr(StringRef FileName,
57 StringRef SectionName,
58 bool IsInsideLoad) const;
60 std::pair<uint64_t, std::string> getStubAddrFor(StringRef FileName,
61 StringRef SectionName,
63 bool IsInsideLoad) const;
64 StringRef getSubsectionStartingAt(StringRef Name) const;
66 Optional<uint64_t> getSectionLoadAddress(void *LocalAddr) const;
68 void registerSection(StringRef FilePath, unsigned SectionID);
69 void registerStubMap(StringRef FilePath, unsigned SectionID,
70 const RuntimeDyldImpl::StubMap &RTDyldStubs);
73 MCDisassembler *Disassembler;
74 MCInstPrinter *InstPrinter;
75 llvm::raw_ostream &ErrStream;