1 //===-- RuntimeDyldCheckerImpl.h -- RuntimeDyld test framework --*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_LIB_EXECUTIONENGINE_RUNTIMEDYLD_RUNTIMEDYLDCHECKERIMPL_H
10 #define LLVM_LIB_EXECUTIONENGINE_RUNTIMEDYLD_RUNTIMEDYLDCHECKERIMPL_H
12 #include "RuntimeDyldImpl.h"
16 class RuntimeDyldCheckerImpl
{
17 friend class RuntimeDyldChecker
;
18 friend class RuntimeDyldCheckerExprEval
;
20 using IsSymbolValidFunction
=
21 RuntimeDyldChecker::IsSymbolValidFunction
;
22 using GetSymbolInfoFunction
= RuntimeDyldChecker::GetSymbolInfoFunction
;
23 using GetSectionInfoFunction
= RuntimeDyldChecker::GetSectionInfoFunction
;
24 using GetStubInfoFunction
= RuntimeDyldChecker::GetStubInfoFunction
;
25 using GetGOTInfoFunction
= RuntimeDyldChecker::GetGOTInfoFunction
;
28 RuntimeDyldCheckerImpl(
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
);
35 bool check(StringRef CheckExpr
) const;
36 bool checkAllRulesInBuffer(StringRef RulePrefix
, MemoryBuffer
*MemBuf
) const;
42 Expected
<JITSymbolResolver::LookupResult
>
43 lookup(const JITSymbolResolver::LookupSet
&Symbols
) const;
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;
50 StringRef
getSymbolContent(StringRef Symbol
) const;
52 std::pair
<uint64_t, std::string
> getSectionAddr(StringRef FileName
,
53 StringRef SectionName
,
54 bool IsInsideLoad
) const;
56 std::pair
<uint64_t, std::string
>
57 getStubOrGOTAddrFor(StringRef StubContainerName
, StringRef Symbol
,
58 bool IsInsideLoad
, bool IsStubAddr
) const;
60 Optional
<uint64_t> getSectionLoadAddress(void *LocalAddr
) const;
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
;