LLVM  9.0.0svn
RuntimeDyldCheckerImpl.h
Go to the documentation of this file.
1 //===-- RuntimeDyldCheckerImpl.h -- RuntimeDyld test framework --*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLVM_LIB_EXECUTIONENGINE_RUNTIMEDYLD_RUNTIMEDYLDCHECKERIMPL_H
10 #define LLVM_LIB_EXECUTIONENGINE_RUNTIMEDYLD_RUNTIMEDYLDCHECKERIMPL_H
11 
12 #include "RuntimeDyldImpl.h"
13 
14 namespace llvm {
15 
17  friend class RuntimeDyldChecker;
18  friend class RuntimeDyldImpl;
20  friend class RuntimeDyldELF;
21 
22 public:
23  RuntimeDyldCheckerImpl(RuntimeDyld &RTDyld, MCDisassembler *Disassembler,
24  MCInstPrinter *InstPrinter,
25  llvm::raw_ostream &ErrStream);
26 
27  bool check(StringRef CheckExpr) const;
28  bool checkAllRulesInBuffer(StringRef RulePrefix, MemoryBuffer *MemBuf) const;
29 
30 private:
31 
32  // StubMap typedefs.
33  typedef std::map<std::string, uint64_t> StubOffsetsMap;
34  struct SectionAddressInfo {
35  uint64_t SectionID;
36  StubOffsetsMap StubOffsets;
37  };
38  typedef std::map<std::string, SectionAddressInfo> SectionMap;
39  typedef std::map<std::string, SectionMap> StubMap;
40 
41  RuntimeDyldImpl &getRTDyld() const { return *RTDyld.Dyld; }
42 
44  lookup(const JITSymbolResolver::LookupSet &Symbols) const;
45 
46  bool isSymbolValid(StringRef Symbol) const;
47  uint64_t getSymbolLocalAddr(StringRef Symbol) const;
48  uint64_t getSymbolRemoteAddr(StringRef Symbol) const;
49  uint64_t readMemoryAtAddr(uint64_t Addr, unsigned Size) const;
50 
51  std::pair<const SectionAddressInfo*, std::string> findSectionAddrInfo(
52  StringRef FileName,
53  StringRef SectionName) const;
54 
55  std::pair<uint64_t, std::string> getSectionAddr(StringRef FileName,
57  bool IsInsideLoad) const;
58 
59  std::pair<uint64_t, std::string> getStubAddrFor(StringRef FileName,
62  bool IsInsideLoad) const;
63  StringRef getSubsectionStartingAt(StringRef Name) const;
64 
65  Optional<uint64_t> getSectionLoadAddress(void *LocalAddr) const;
66 
67  void registerSection(StringRef FilePath, unsigned SectionID);
68  void registerStubMap(StringRef FilePath, unsigned SectionID,
69  const RuntimeDyldImpl::StubMap &RTDyldStubs);
70 
71  RuntimeDyld &RTDyld;
72  MCDisassembler *Disassembler;
73  MCInstPrinter *InstPrinter;
74  llvm::raw_ostream &ErrStream;
75 
76  StubMap Stubs;
77 };
78 }
79 
80 #endif
bool checkAllRulesInBuffer(StringRef RulePrefix, MemoryBuffer *MemBuf) const
This class represents lattice values for constants.
Definition: AllocatorList.h:23
RuntimeDyldCheckerImpl(RuntimeDyld &RTDyld, MCDisassembler *Disassembler, MCInstPrinter *InstPrinter, llvm::raw_ostream &ErrStream)
amdgpu Simplify well known AMD library false FunctionCallee Value const Twine & Name
Superclass for all disassemblers.
std::set< StringRef > LookupSet
Definition: JITSymbol.h:345
std::map< RelocationValueRef, uintptr_t > StubMap
Tagged union holding either a T or a Error.
Definition: CachePruning.h:22
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:41
This is an instance of a target assembly language printer that converts an MCInst to valid target ass...
Definition: MCInstPrinter.h:39
uint32_t Size
Definition: Profile.cpp:46
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:45
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:48