LLVM  14.0.0git
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
llvm::Check::Size
@ Size
Definition: FileCheck.h:73
RuntimeDyldImpl.h
llvm::RuntimeDyldChecker::IsSymbolValidFunction
std::function< bool(StringRef Symbol)> IsSymbolValidFunction
Definition: RuntimeDyldChecker.h:135
llvm
---------------------— PointerInfo ------------------------------------—
Definition: AllocatorList.h:23
llvm::msgpack::Endianness
constexpr support::endianness Endianness
The endianness of all multi-byte encoded values in MessagePack.
Definition: MsgPack.h:24
llvm::RuntimeDyldCheckerImpl::RuntimeDyldCheckerImpl
RuntimeDyldCheckerImpl(IsSymbolValidFunction IsSymbolValid, GetSymbolInfoFunction GetSymbolInfo, GetSectionInfoFunction GetSectionInfo, GetStubInfoFunction GetStubInfo, GetGOTInfoFunction GetGOTInfo, support::endianness Endianness, MCDisassembler *Disassembler, MCInstPrinter *InstPrinter, llvm::raw_ostream &ErrStream)
Definition: RuntimeDyldChecker.cpp:702
llvm::Optional< uint64_t >
llvm::Expected
Tagged union holding either a T or a Error.
Definition: APFloat.h:42
llvm::MemoryBuffer
This interface provides simple read-only access to a block of memory, and provides simple methods for...
Definition: MemoryBuffer.h:50
llvm::JITSymbolResolver::LookupSet
std::set< StringRef > LookupSet
Definition: JITSymbol.h:373
llvm::RuntimeDyldChecker::GetGOTInfoFunction
std::function< Expected< MemoryRegionInfo >(StringRef GOTContainer, StringRef TargetName)> GetGOTInfoFunction
Definition: RuntimeDyldChecker.h:143
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:53
llvm::RuntimeDyldCheckerExprEval
Definition: RuntimeDyldChecker.cpp:30
llvm::RuntimeDyldChecker::GetSectionInfoFunction
std::function< Expected< MemoryRegionInfo >(StringRef FileName, StringRef SectionName)> GetSectionInfoFunction
Definition: RuntimeDyldChecker.h:139
llvm::RuntimeDyldCheckerImpl::checkAllRulesInBuffer
bool checkAllRulesInBuffer(StringRef RulePrefix, MemoryBuffer *MemBuf) const
Definition: RuntimeDyldChecker.cpp:727
uint64_t
llvm::MCInstPrinter
This is an instance of a target assembly language printer that converts an MCInst to valid target ass...
Definition: MCInstPrinter.h:43
Addr
uint64_t Addr
Definition: ELFObjHandler.cpp:80
llvm::MCDisassembler
Superclass for all disassemblers.
Definition: MCDisassembler.h:76
llvm::RuntimeDyldChecker::GetSymbolInfoFunction
std::function< Expected< MemoryRegionInfo >(StringRef SymbolName)> GetSymbolInfoFunction
Definition: RuntimeDyldChecker.h:137
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
llvm::RuntimeDyldCheckerImpl
Definition: RuntimeDyldCheckerImpl.h:16
llvm::SectionName
Definition: DWARFSection.h:21
llvm::RuntimeDyldCheckerImpl::check
bool check(StringRef CheckExpr) const
Definition: RuntimeDyldChecker.cpp:715
llvm::RuntimeDyldChecker
RuntimeDyld invariant checker for verifying that RuntimeDyld has correctly applied relocations.
Definition: RuntimeDyldChecker.h:74
llvm::ARMBuildAttrs::Symbol
@ Symbol
Definition: ARMBuildAttributes.h:79
lookup
static bool lookup(const GsymReader &GR, DataExtractor &Data, uint64_t &Offset, uint64_t BaseAddr, uint64_t Addr, SourceLocations &SrcLocs, llvm::Error &Err)
A Lookup helper functions.
Definition: InlineInfo.cpp:108
llvm::support::endianness
endianness
Definition: Endian.h:27
llvm::RuntimeDyldChecker::GetStubInfoFunction
std::function< Expected< MemoryRegionInfo >(StringRef StubContainer, StringRef TargetName)> GetStubInfoFunction
Definition: RuntimeDyldChecker.h:141