LLVM 17.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
14namespace 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
27public:
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
38private:
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 std::optional<uint64_t> getSectionLoadAddress(void *LocalAddr) const;
61
62 IsSymbolValidFunction IsSymbolValid;
63 GetSymbolInfoFunction GetSymbolInfo;
64 GetSectionInfoFunction GetSectionInfo;
65 GetStubInfoFunction GetStubInfo;
66 GetGOTInfoFunction GetGOTInfo;
67 support::endianness Endianness;
68 MCDisassembler *Disassembler;
69 MCInstPrinter *InstPrinter;
70 llvm::raw_ostream &ErrStream;
71};
72}
73
74#endif
uint64_t Addr
uint64_t Size
#define check(cond)
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:109
Tagged union holding either a T or a Error.
Definition: Error.h:470
std::set< StringRef > LookupSet
Definition: JITSymbol.h:373
Superclass for all disassemblers.
This is an instance of a target assembly language printer that converts an MCInst to valid target ass...
Definition: MCInstPrinter.h:44
This interface provides simple read-only access to a block of memory, and provides simple methods for...
Definition: MemoryBuffer.h:51
bool checkAllRulesInBuffer(StringRef RulePrefix, MemoryBuffer *MemBuf) const
RuntimeDyld invariant checker for verifying that RuntimeDyld has correctly applied relocations.
std::function< Expected< MemoryRegionInfo >(StringRef StubContainer, StringRef TargetName)> GetStubInfoFunction
std::function< bool(StringRef Symbol)> IsSymbolValidFunction
std::function< Expected< MemoryRegionInfo >(StringRef FileName, StringRef SectionName)> GetSectionInfoFunction
std::function< Expected< MemoryRegionInfo >(StringRef GOTContainer, StringRef TargetName)> GetGOTInfoFunction
std::function< Expected< MemoryRegionInfo >(StringRef SymbolName)> GetSymbolInfoFunction
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:52
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18