LLVM  10.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;
19 
20  using IsSymbolValidFunction =
22  using GetSymbolInfoFunction = RuntimeDyldChecker::GetSymbolInfoFunction;
23  using GetSectionInfoFunction = RuntimeDyldChecker::GetSectionInfoFunction;
24  using GetStubInfoFunction = RuntimeDyldChecker::GetStubInfoFunction;
25  using GetGOTInfoFunction = RuntimeDyldChecker::GetGOTInfoFunction;
26 
27 public:
29  IsSymbolValidFunction IsSymbolValid, GetSymbolInfoFunction GetSymbolInfo,
30  GetSectionInfoFunction GetSectionInfo, GetStubInfoFunction GetStubInfo,
31  GetGOTInfoFunction GetGOTInfo, support::endianness Endianness,
32  MCDisassembler *Disassembler, MCInstPrinter *InstPrinter,
33  llvm::raw_ostream &ErrStream);
34 
35  bool check(StringRef CheckExpr) const;
36  bool checkAllRulesInBuffer(StringRef RulePrefix, MemoryBuffer *MemBuf) const;
37 
38 private:
39 
40  // StubMap typedefs.
41 
43  lookup(const JITSymbolResolver::LookupSet &Symbols) const;
44 
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;
49 
50  StringRef getSymbolContent(StringRef Symbol) const;
51 
52  std::pair<uint64_t, std::string> getSectionAddr(StringRef FileName,
54  bool IsInsideLoad) const;
55 
56  std::pair<uint64_t, std::string>
57  getStubOrGOTAddrFor(StringRef StubContainerName, StringRef Symbol,
58  bool IsInsideLoad, bool IsStubAddr) const;
59 
60  Optional<uint64_t> getSectionLoadAddress(void *LocalAddr) const;
61 
62  IsSymbolValidFunction IsSymbolValid;
63  GetSymbolInfoFunction GetSymbolInfo;
64  GetSectionInfoFunction GetSectionInfo;
65  GetStubInfoFunction GetStubInfo;
66  GetGOTInfoFunction GetGOTInfo;
68  MCDisassembler *Disassembler;
69  MCInstPrinter *InstPrinter;
70  llvm::raw_ostream &ErrStream;
71 };
72 }
73 
74 #endif
bool checkAllRulesInBuffer(StringRef RulePrefix, MemoryBuffer *MemBuf) const
This class represents lattice values for constants.
Definition: AllocatorList.h:23
Superclass for all disassemblers.
constexpr support::endianness Endianness
The endianness of all multi-byte encoded values in MessagePack.
Definition: MsgPack.h:24
std::set< StringRef > LookupSet
Definition: JITSymbol.h:326
Tagged union holding either a T or a Error.
Definition: yaml2obj.h:21
static const uint16_t * lookup(unsigned opcode, unsigned domain, ArrayRef< uint16_t[3]> Table)
std::function< Expected< MemoryRegionInfo >(StringRef GOTContainer, StringRef TargetName)> GetGOTInfoFunction
std::function< bool(StringRef Symbol)> IsSymbolValidFunction
std::function< Expected< MemoryRegionInfo >(StringRef SymbolName)> GetSymbolInfoFunction
RuntimeDyld invariant checker for verifying that RuntimeDyld has correctly applied relocations...
std::function< Expected< MemoryRegionInfo >(StringRef StubContainer, StringRef TargetName)> GetStubInfoFunction
This interface provides simple read-only access to a block of memory, and provides simple methods for...
Definition: MemoryBuffer.h:41
RuntimeDyldCheckerImpl(IsSymbolValidFunction IsSymbolValid, GetSymbolInfoFunction GetSymbolInfo, GetSectionInfoFunction GetSectionInfo, GetStubInfoFunction GetStubInfo, GetGOTInfoFunction GetGOTInfo, support::endianness Endianness, MCDisassembler *Disassembler, MCInstPrinter *InstPrinter, llvm::raw_ostream &ErrStream)
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
std::function< Expected< MemoryRegionInfo >(StringRef FileName, StringRef SectionName)> GetSectionInfoFunction
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