LLVM  8.0.0svn
RuntimeDyldCheckerImpl.h
Go to the documentation of this file.
1 //===-- RuntimeDyldCheckerImpl.h -- RuntimeDyld test framework --*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #ifndef LLVM_LIB_EXECUTIONENGINE_RUNTIMEDYLD_RUNTIMEDYLDCHECKERIMPL_H
11 #define LLVM_LIB_EXECUTIONENGINE_RUNTIMEDYLD_RUNTIMEDYLDCHECKERIMPL_H
12 
13 #include "RuntimeDyldImpl.h"
14 
15 namespace llvm {
16 
18  friend class RuntimeDyldChecker;
19  friend class RuntimeDyldImpl;
21  friend class RuntimeDyldELF;
22 
23 public:
24  RuntimeDyldCheckerImpl(RuntimeDyld &RTDyld, MCDisassembler *Disassembler,
25  MCInstPrinter *InstPrinter,
26  llvm::raw_ostream &ErrStream);
27 
28  bool check(StringRef CheckExpr) const;
29  bool checkAllRulesInBuffer(StringRef RulePrefix, MemoryBuffer *MemBuf) const;
30 
31 private:
32 
33  // StubMap typedefs.
34  typedef std::map<std::string, uint64_t> StubOffsetsMap;
35  struct SectionAddressInfo {
36  uint64_t SectionID;
37  StubOffsetsMap StubOffsets;
38  };
39  typedef std::map<std::string, SectionAddressInfo> SectionMap;
40  typedef std::map<std::string, SectionMap> StubMap;
41 
42  RuntimeDyldImpl &getRTDyld() const { return *RTDyld.Dyld; }
43 
45  lookup(const JITSymbolResolver::LookupSet &Symbols) const;
46 
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;
51 
52  std::pair<const SectionAddressInfo*, std::string> findSectionAddrInfo(
53  StringRef FileName,
54  StringRef SectionName) const;
55 
56  std::pair<uint64_t, std::string> getSectionAddr(StringRef FileName,
58  bool IsInsideLoad) const;
59 
60  std::pair<uint64_t, std::string> getStubAddrFor(StringRef FileName,
63  bool IsInsideLoad) const;
64  StringRef getSubsectionStartingAt(StringRef Name) const;
65 
66  Optional<uint64_t> getSectionLoadAddress(void *LocalAddr) const;
67 
68  void registerSection(StringRef FilePath, unsigned SectionID);
69  void registerStubMap(StringRef FilePath, unsigned SectionID,
70  const RuntimeDyldImpl::StubMap &RTDyldStubs);
71 
72  RuntimeDyld &RTDyld;
73  MCDisassembler *Disassembler;
74  MCInstPrinter *InstPrinter;
75  llvm::raw_ostream &ErrStream;
76 
77  StubMap Stubs;
78 };
79 }
80 
81 #endif
bool checkAllRulesInBuffer(StringRef RulePrefix, MemoryBuffer *MemBuf) const
This class represents lattice values for constants.
Definition: AllocatorList.h:24
RuntimeDyldCheckerImpl(RuntimeDyld &RTDyld, MCDisassembler *Disassembler, MCInstPrinter *InstPrinter, llvm::raw_ostream &ErrStream)
Superclass for all disassemblers.
std::set< StringRef > LookupSet
Definition: JITSymbol.h:346
amdgpu Simplify well known AMD library false Value Value const Twine & Name
std::map< RelocationValueRef, uintptr_t > StubMap
Tagged union holding either a T or a Error.
Definition: CachePruning.h:23
RuntimeDyld invariant checker for verifying that RuntimeDyld has correctly applied relocations...
This interface provides simple read-only access to a block of memory, and provides simple methods for...
Definition: MemoryBuffer.h:42
This is an instance of a target assembly language printer that converts an MCInst to valid target ass...
Definition: MCInstPrinter.h:40
uint32_t Size
Definition: Profile.cpp:47
bool check(StringRef CheckExpr) const
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition: raw_ostream.h:46
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:49