LLVM: include/llvm/ExecutionEngine/RuntimeDyldChecker.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9#ifndef LLVM_EXECUTIONENGINE_RUNTIMEDYLDCHECKER_H
10#define LLVM_EXECUTIONENGINE_RUNTIMEDYLDCHECKER_H
11
18#include
19
20#include
21#include
22#include
23#include
24
25namespace llvm {
26
34
35
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
82public:
84 public:
86
87
90 : ContentPtr(Content.data()), Size(Content.size()),
91 TargetAddress(TargetAddress), TargetFlags(TargetFlags) {}
92
93
95 : Size(Size), TargetAddress(TargetAddress) {}
96
97
99 assert(Size && "setContent/setZeroFill must be called first");
100 return !ContentPtr;
101 }
102
103
105 assert(!ContentPtr && !Size && "Content/zero-fill already set");
106 ContentPtr = Content.data();
107 Size = Content.size();
108 }
109
110
112 assert(!ContentPtr && !this->Size && "Content/zero-fill already set");
113 this->Size = Size;
114 }
115
116
118 assert(() && "Can't get content for a zero-fill section");
119 return {ContentPtr, static_cast<size_t>(Size)};
120 }
121
122
124 assert(isZeroFill() && "Can't get zero-fill length for content section");
125 return Size;
126 }
127
128
130 assert(!this->TargetAddress && "TargetAddress already set");
131 this->TargetAddress = TargetAddress;
132 }
133
134
136
137
139
140
142 assert(Flags <= 1 && "Add more bits to store more than one flag");
143 TargetFlags = Flags;
144 }
145
146 private:
147 const char *ContentPtr = nullptr;
151 };
152
155 std::function<Expected(StringRef SymbolName)>;
162
169
170
171
173
174
175
176
179
180
181
182
183
184
185
186 LLVM_ABI std::pair<uint64_t, std::string>
188
189
190
191 LLVM_ABI std::optional<uint64_t>
193
194private:
195 std::unique_ptr Impl;
196};
197
198}
199
200#endif
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
size_t size() const
size - Get the array size.
Superclass for all disassemblers.
This is an instance of a target assembly language printer that converts an MCInst to valid target ass...
This interface provides simple read-only access to a block of memory, and provides simple methods for...
void setContent(ArrayRef< char > Content)
Set the content for this memory region.
Definition RuntimeDyldChecker.h:104
void setZeroFill(uint64_t Size)
Set a zero-fill length for this memory region.
Definition RuntimeDyldChecker.h:111
void setTargetFlags(TargetFlagsType Flags)
Set the target flags for this Symbol.
Definition RuntimeDyldChecker.h:141
JITTargetAddress getTargetAddress() const
Return the target address for this region.
Definition RuntimeDyldChecker.h:135
MemoryRegionInfo()=default
MemoryRegionInfo(ArrayRef< char > Content, JITTargetAddress TargetAddress, TargetFlagsType TargetFlags)
Constructor for symbols/sections with content and TargetFlag.
Definition RuntimeDyldChecker.h:88
void setTargetAddress(JITTargetAddress TargetAddress)
Set the target address for this region.
Definition RuntimeDyldChecker.h:129
ArrayRef< char > getContent() const
Returns the content for this section if there is any.
Definition RuntimeDyldChecker.h:117
uint64_t getZeroFillLength() const
Returns the zero-fill length for this section.
Definition RuntimeDyldChecker.h:123
MemoryRegionInfo(uint64_t Size, JITTargetAddress TargetAddress)
Constructor for zero-fill symbols/sections.
Definition RuntimeDyldChecker.h:94
TargetFlagsType getTargetFlags() const
Get the target flags for this Symbol.
Definition RuntimeDyldChecker.h:138
bool isZeroFill() const
Returns true if this is a zero-fill symbol/section.
Definition RuntimeDyldChecker.h:98
LLVM_ABI std::pair< uint64_t, std::string > getSectionAddr(StringRef FileName, StringRef SectionName, bool LocalAddress)
Returns the address of the requested section (or an error message in the second element of the pair i...
LLVM_ABI bool checkAllRulesInBuffer(StringRef RulePrefix, MemoryBuffer *MemBuf) const
Scan the given memory buffer for lines beginning with the string in RulePrefix.
LLVM_ABI bool check(StringRef CheckExpr) const
Check a single expression against the attached RuntimeDyld instance.
std::function< bool(StringRef Symbol)> IsSymbolValidFunction
Definition RuntimeDyldChecker.h:153
LLVM_ABI ~RuntimeDyldChecker()
std::function< Expected< MemoryRegionInfo >( StringRef FileName, StringRef SectionName)> GetSectionInfoFunction
Definition RuntimeDyldChecker.h:156
LLVM_ABI RuntimeDyldChecker(IsSymbolValidFunction IsSymbolValid, GetSymbolInfoFunction GetSymbolInfo, GetSectionInfoFunction GetSectionInfo, GetStubInfoFunction GetStubInfo, GetGOTInfoFunction GetGOTInfo, llvm::endianness Endianness, Triple TT, StringRef CPU, SubtargetFeatures TF, raw_ostream &ErrStream)
LLVM_ABI std::optional< uint64_t > getSectionLoadAddress(void *LocalAddress) const
If there is a section at the given local address, return its load address, otherwise return std::null...
std::function< Expected< MemoryRegionInfo >( StringRef GOTContainer, StringRef TargetName)> GetGOTInfoFunction
Definition RuntimeDyldChecker.h:160
std::function< Expected< MemoryRegionInfo >(StringRef SymbolName)> GetSymbolInfoFunction
Definition RuntimeDyldChecker.h:154
std::function< Expected< MemoryRegionInfo >( StringRef StubContainer, StringRef TargetName, StringRef StubKindFilter)> GetStubInfoFunction
Definition RuntimeDyldChecker.h:158
StringRef - Represent a constant reference to a string, i.e.
Manages the enabling and disabling of subtarget specific features.
Triple - Helper class for working with autoconf configuration names.
This class implements an extremely fast bulk output stream that can only output to a stream.
This is an optimization pass for GlobalISel generic memory operations.
auto size(R &&Range, std::enable_if_t< std::is_base_of< std::random_access_iterator_tag, typename std::iterator_traits< decltype(Range.begin())>::iterator_category >::value, void > *=nullptr)
Get the size of a range.
uint64_t JITTargetAddress
Represents an address in the target process's address space.
uint8_t TargetFlagsType
Holds target-specific properties for a symbol.
Definition RuntimeDyldChecker.h:36