Movatterモバイル変換


[0]ホーム

URL:


LLVM 20.0.0git
DebugObjectManagerPlugin.cpp
Go to the documentation of this file.
1//===------- DebugObjectManagerPlugin.cpp - JITLink debug objects ---------===//
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// FIXME: Update Plugin to poke the debug object into a new JITLink section,
10// rather than creating a new allocation.
11//
12//===----------------------------------------------------------------------===//
13
14#include "llvm/ExecutionEngine/Orc/DebugObjectManagerPlugin.h"
15
16#include "llvm/ADT/ArrayRef.h"
17#include "llvm/ADT/StringMap.h"
18#include "llvm/ADT/StringRef.h"
19#include "llvm/BinaryFormat/ELF.h"
20#include "llvm/ExecutionEngine/JITLink/JITLinkDylib.h"
21#include "llvm/ExecutionEngine/JITLink/JITLinkMemoryManager.h"
22#include "llvm/Object/ELFObjectFile.h"
23#include "llvm/Support/Errc.h"
24#include "llvm/Support/MSVCErrorWorkarounds.h"
25#include "llvm/Support/MemoryBuffer.h"
26#include "llvm/Support/Process.h"
27#include "llvm/Support/raw_ostream.h"
28
29#include <set>
30
31#define DEBUG_TYPE "orc"
32
33using namespacellvm::jitlink;
34using namespacellvm::object;
35
36namespacellvm {
37namespaceorc {
38
39classDebugObjectSection {
40public:
41virtualvoidsetTargetMemoryRange(SectionRangeRange) = 0;
42virtualvoiddump(raw_ostream &OS,StringRefName) {}
43virtual~DebugObjectSection() =default;
44};
45
46template <typename ELFT>
47classELFDebugObjectSection :publicDebugObjectSection {
48public:
49// BinaryFormat ELF is not meant as a mutable format. We can only make changes
50// that don't invalidate the file structure.
51ELFDebugObjectSection(consttypename ELFT::Shdr *Header)
52 : Header(const_cast<typename ELFT::Shdr *>(Header)) {}
53
54voidsetTargetMemoryRange(SectionRangeRange)override;
55voiddump(raw_ostream &OS,StringRefName)override;
56
57ErrorvalidateInBounds(StringRef Buffer,constchar *Name)const;
58
59private:
60typename ELFT::Shdr *Header;
61};
62
63template <typename ELFT>
64voidELFDebugObjectSection<ELFT>::setTargetMemoryRange(SectionRangeRange) {
65// All recorded sections are candidates for load-address patching.
66 Header->sh_addr =
67static_cast<typename ELFT::uint>(Range.getStart().getValue());
68}
69
70template <typename ELFT>
71ErrorELFDebugObjectSection<ELFT>::validateInBounds(StringRef Buffer,
72constchar *Name) const{
73constuint8_t *Start = Buffer.bytes_begin();
74constuint8_t *End = Buffer.bytes_end();
75constuint8_t *HeaderPtr =reinterpret_cast<uint8_t *>(Header);
76if (HeaderPtr < Start || HeaderPtr +sizeof(typename ELFT::Shdr) >End)
77return make_error<StringError>(
78formatv("{0} section header at {1:x16} not within bounds of the "
79"given debug object buffer [{2:x16} - {3:x16}]",
80Name, &Header->sh_addr, Start,End),
81inconvertibleErrorCode());
82if (Header->sh_offset + Header->sh_size > Buffer.size())
83return make_error<StringError>(
84formatv("{0} section data [{1:x16} - {2:x16}] not within bounds of "
85"the given debug object buffer [{3:x16} - {4:x16}]",
86Name, Start + Header->sh_offset,
87 Start + Header->sh_offset + Header->sh_size, Start,End),
88inconvertibleErrorCode());
89returnError::success();
90}
91
92template <typename ELFT>
93voidELFDebugObjectSection<ELFT>::dump(raw_ostream &OS,StringRefName) {
94if (uint64_tAddr = Header->sh_addr) {
95OS <<formatv(" {0:x16} {1}\n",Addr,Name);
96 }else {
97OS <<formatv(" {0}\n",Name);
98 }
99}
100
101enumDebugObjectFlags :int {
102// Request final target memory load-addresses for all sections.
103ReportFinalSectionLoadAddresses = 1 << 0,
104
105// We found sections with debug information when processing the input object.
106HasDebugSections = 1 << 1,
107};
108
109/// The plugin creates a debug object from when JITLink starts processing the
110/// corresponding LinkGraph. It provides access to the pass configuration of
111/// the LinkGraph and calls the finalization function, once the resulting link
112/// artifact was emitted.
113///
114classDebugObject {
115public:
116DebugObject(JITLinkMemoryManager &MemMgr,constJITLinkDylib *JD,
117ExecutionSession &ES)
118 :MemMgr(MemMgr),JD(JD),ES(ES), Flags(DebugObjectFlags{}) {}
119
120boolhasFlags(DebugObjectFlagsF) const{return Flags &F; }
121voidsetFlags(DebugObjectFlagsF) {
122 Flags =static_cast<DebugObjectFlags>(Flags |F);
123 }
124voidclearFlags(DebugObjectFlagsF) {
125 Flags =static_cast<DebugObjectFlags>(Flags & ~F);
126 }
127
128usingFinalizeContinuation = std::function<void(Expected<ExecutorAddrRange>)>;
129
130voidfinalizeAsync(FinalizeContinuation OnFinalize);
131
132virtual~DebugObject() {
133if (Alloc) {
134 std::vector<FinalizedAlloc> Allocs;
135 Allocs.push_back(std::move(Alloc));
136if (Error Err =MemMgr.deallocate(std::move(Allocs)))
137ES.reportError(std::move(Err));
138 }
139 }
140
141virtualvoidreportSectionTargetMemoryRange(StringRefName,
142SectionRange TargetMem) {}
143
144protected:
145usingInFlightAlloc =JITLinkMemoryManager::InFlightAlloc;
146usingFinalizedAlloc =JITLinkMemoryManager::FinalizedAlloc;
147
148virtualExpected<SimpleSegmentAlloc>finalizeWorkingMemory() = 0;
149
150JITLinkMemoryManager &MemMgr;
151constJITLinkDylib *JD =nullptr;
152ExecutionSession &ES;
153
154private:
155DebugObjectFlags Flags;
156FinalizedAlloc Alloc;
157};
158
159// Finalize working memory and take ownership of the resulting allocation. Start
160// copying memory over to the target and pass on the result once we're done.
161// Ownership of the allocation remains with us for the rest of our lifetime.
162voidDebugObject::finalizeAsync(FinalizeContinuation OnFinalize) {
163assert(!Alloc &&"Cannot finalize more than once");
164
165if (auto SimpleSegAlloc =finalizeWorkingMemory()) {
166auto ROSeg = SimpleSegAlloc->getSegInfo(MemProt::Read);
167ExecutorAddrRange DebugObjRange(ROSeg.Addr, ROSeg.WorkingMem.size());
168 SimpleSegAlloc->finalize(
169 [this, DebugObjRange,
170 OnFinalize = std::move(OnFinalize)](Expected<FinalizedAlloc> FA) {
171if (FA) {
172 Alloc = std::move(*FA);
173 OnFinalize(DebugObjRange);
174 }else
175 OnFinalize(FA.takeError());
176 });
177 }else
178 OnFinalize(SimpleSegAlloc.takeError());
179}
180
181/// The current implementation of ELFDebugObject replicates the approach used in
182/// RuntimeDyld: It patches executable and data section headers in the given
183/// object buffer with load-addresses of their corresponding sections in target
184/// memory.
185///
186classELFDebugObject :publicDebugObject {
187public:
188staticExpected<std::unique_ptr<DebugObject>>
189Create(MemoryBufferRef Buffer,JITLinkContext &Ctx,ExecutionSession &ES);
190
191voidreportSectionTargetMemoryRange(StringRefName,
192SectionRange TargetMem)override;
193
194StringRefgetBuffer() const{return Buffer->getMemBufferRef().getBuffer(); }
195
196protected:
197Expected<SimpleSegmentAlloc>finalizeWorkingMemory()override;
198
199template <typename ELFT>
200ErrorrecordSection(StringRefName,
201 std::unique_ptr<ELFDebugObjectSection<ELFT>>Section);
202DebugObjectSection *getSection(StringRefName);
203
204private:
205template <typename ELFT>
206staticExpected<std::unique_ptr<ELFDebugObject>>
207 CreateArchType(MemoryBufferRef Buffer,JITLinkMemoryManager &MemMgr,
208constJITLinkDylib *JD,ExecutionSession &ES);
209
210static std::unique_ptr<WritableMemoryBuffer>
211 CopyBuffer(MemoryBufferRef Buffer,Error &Err);
212
213ELFDebugObject(std::unique_ptr<WritableMemoryBuffer> Buffer,
214JITLinkMemoryManager &MemMgr,constJITLinkDylib *JD,
215ExecutionSession &ES)
216 :DebugObject(MemMgr,JD,ES), Buffer(std::move(Buffer)) {
217setFlags(ReportFinalSectionLoadAddresses);
218 }
219
220 std::unique_ptr<WritableMemoryBuffer> Buffer;
221StringMap<std::unique_ptr<DebugObjectSection>> Sections;
222};
223
224staticconst std::set<StringRef>DwarfSectionNames = {
225#define HANDLE_DWARF_SECTION(ENUM_NAME, ELF_NAME, CMDLINE_NAME, OPTION) \
226 ELF_NAME,
227#include "llvm/BinaryFormat/Dwarf.def"
228#undef HANDLE_DWARF_SECTION
229};
230
231staticboolisDwarfSection(StringRefSectionName) {
232returnDwarfSectionNames.count(SectionName) == 1;
233}
234
235std::unique_ptr<WritableMemoryBuffer>
236ELFDebugObject::CopyBuffer(MemoryBufferRef Buffer,Error &Err) {
237ErrorAsOutParameter_(Err);
238size_tSize = Buffer.getBufferSize();
239StringRefName = Buffer.getBufferIdentifier();
240if (auto Copy =WritableMemoryBuffer::getNewUninitMemBuffer(Size,Name)) {
241 memcpy(Copy->getBufferStart(), Buffer.getBufferStart(),Size);
242return Copy;
243 }
244
245 Err =errorCodeToError(make_error_code(errc::not_enough_memory));
246returnnullptr;
247}
248
249template <typename ELFT>
250Expected<std::unique_ptr<ELFDebugObject>>
251ELFDebugObject::CreateArchType(MemoryBufferRef Buffer,
252JITLinkMemoryManager &MemMgr,
253constJITLinkDylib *JD, ExecutionSession &ES) {
254usingSectionHeader =typename ELFT::Shdr;
255
256Error Err =Error::success();
257 std::unique_ptr<ELFDebugObject> DebugObj(
258new ELFDebugObject(CopyBuffer(Buffer, Err),MemMgr,JD,ES));
259if (Err)
260return std::move(Err);
261
262Expected<ELFFile<ELFT>> ObjRef =ELFFile<ELFT>::create(DebugObj->getBuffer());
263if (!ObjRef)
264return ObjRef.takeError();
265
266Expected<ArrayRef<SectionHeader>> Sections = ObjRef->sections();
267if (!Sections)
268return Sections.takeError();
269
270for (const SectionHeader &Header : *Sections) {
271Expected<StringRef>Name = ObjRef->getSectionName(Header);
272if (!Name)
273returnName.takeError();
274if (Name->empty())
275continue;
276if (isDwarfSection(*Name))
277 DebugObj->setFlags(HasDebugSections);
278
279// Only record text and data sections (i.e. no bss, comments, rel, etc.)
280if (Header.sh_type !=ELF::SHT_PROGBITS &&
281 Header.sh_type !=ELF::SHT_X86_64_UNWIND)
282continue;
283if (!(Header.sh_flags &ELF::SHF_ALLOC))
284continue;
285
286auto Wrapped = std::make_unique<ELFDebugObjectSection<ELFT>>(&Header);
287if (Error Err = DebugObj->recordSection(*Name, std::move(Wrapped)))
288return std::move(Err);
289 }
290
291return std::move(DebugObj);
292}
293
294Expected<std::unique_ptr<DebugObject>>
295ELFDebugObject::Create(MemoryBufferRef Buffer,JITLinkContext &Ctx,
296ExecutionSession &ES) {
297unsignedchar Class,Endian;
298 std::tie(Class,Endian) =getElfArchType(Buffer.getBuffer());
299
300if (Class ==ELF::ELFCLASS32) {
301if (Endian ==ELF::ELFDATA2LSB)
302return CreateArchType<ELF32LE>(Buffer, Ctx.getMemoryManager(),
303 Ctx.getJITLinkDylib(),ES);
304if (Endian ==ELF::ELFDATA2MSB)
305return CreateArchType<ELF32BE>(Buffer, Ctx.getMemoryManager(),
306 Ctx.getJITLinkDylib(),ES);
307returnnullptr;
308 }
309if (Class ==ELF::ELFCLASS64) {
310if (Endian ==ELF::ELFDATA2LSB)
311return CreateArchType<ELF64LE>(Buffer, Ctx.getMemoryManager(),
312 Ctx.getJITLinkDylib(),ES);
313if (Endian ==ELF::ELFDATA2MSB)
314return CreateArchType<ELF64BE>(Buffer, Ctx.getMemoryManager(),
315 Ctx.getJITLinkDylib(),ES);
316returnnullptr;
317 }
318returnnullptr;
319}
320
321Expected<SimpleSegmentAlloc>ELFDebugObject::finalizeWorkingMemory() {
322LLVM_DEBUG({
323dbgs() <<"Section load-addresses in debug object for \""
324 << Buffer->getBufferIdentifier() <<"\":\n";
325for (constauto &KV : Sections)
326 KV.second->dump(dbgs(), KV.first());
327 });
328
329// TODO: This works, but what actual alignment requirements do we have?
330unsignedPageSize =sys::Process::getPageSizeEstimate();
331size_tSize = Buffer->getBufferSize();
332
333// Allocate working memory for debug object in read-only segment.
334auto Alloc =SimpleSegmentAlloc::Create(
335MemMgr,ES.getSymbolStringPool(),ES.getTargetTriple(),JD,
336 {{MemProt::Read, {Size, Align(PageSize)}}});
337if (!Alloc)
338returnAlloc;
339
340// Initialize working memory with a copy of our object buffer.
341auto SegInfo =Alloc->getSegInfo(MemProt::Read);
342 memcpy(SegInfo.WorkingMem.data(), Buffer->getBufferStart(),Size);
343 Buffer.reset();
344
345returnAlloc;
346}
347
348void ELFDebugObject::reportSectionTargetMemoryRange(StringRefName,
349SectionRange TargetMem) {
350if (auto *DebugObjSection =getSection(Name))
351 DebugObjSection->setTargetMemoryRange(TargetMem);
352}
353
354template <typename ELFT>
355Error ELFDebugObject::recordSection(
356StringRefName, std::unique_ptr<ELFDebugObjectSection<ELFT>>Section) {
357if (Error Err =Section->validateInBounds(this->getBuffer(),Name.data()))
358return Err;
359bool Inserted = Sections.try_emplace(Name, std::move(Section)).second;
360if (!Inserted)
361LLVM_DEBUG(dbgs() <<"Skipping debug registration for section '" <<Name
362 <<"' in object " << Buffer->getBufferIdentifier()
363 <<" (duplicate name)\n");
364returnError::success();
365}
366
367DebugObjectSection *ELFDebugObject::getSection(StringRefName) {
368auto It = Sections.find(Name);
369return It == Sections.end() ? nullptr : It->second.get();
370}
371
372/// Creates a debug object based on the input object file from
373/// ObjectLinkingLayerJITLinkContext.
374///
375staticExpected<std::unique_ptr<DebugObject>>
376createDebugObjectFromBuffer(ExecutionSession &ES,LinkGraph &G,
377JITLinkContext &Ctx,MemoryBufferRef ObjBuffer) {
378switch (G.getTargetTriple().getObjectFormat()) {
379caseTriple::ELF:
380return ELFDebugObject::Create(ObjBuffer, Ctx, ES);
381
382default:
383// TODO: Once we add support for other formats, we might want to split this
384// into multiple files.
385returnnullptr;
386 }
387}
388
389DebugObjectManagerPlugin::DebugObjectManagerPlugin(
390ExecutionSession &ES, std::unique_ptr<DebugObjectRegistrar>Target,
391bool RequireDebugSections,bool AutoRegisterCode)
392 : ES(ES),Target(std::move(Target)),
393 RequireDebugSections(RequireDebugSections),
394 AutoRegisterCode(AutoRegisterCode) {}
395
396DebugObjectManagerPlugin::DebugObjectManagerPlugin(
397ExecutionSession &ES, std::unique_ptr<DebugObjectRegistrar>Target)
398 :DebugObjectManagerPlugin(ES,std::move(Target),true,true) {}
399
400DebugObjectManagerPlugin::~DebugObjectManagerPlugin() =default;
401
402voidDebugObjectManagerPlugin::notifyMaterializing(
403MaterializationResponsibility &MR,LinkGraph &G,JITLinkContext &Ctx,
404MemoryBufferRef ObjBuffer) {
405 std::lock_guard<std::mutex> Lock(PendingObjsLock);
406assert(PendingObjs.count(&MR) == 0 &&
407"Cannot have more than one pending debug object per "
408"MaterializationResponsibility");
409
410if (auto DebugObj =createDebugObjectFromBuffer(ES,G, Ctx, ObjBuffer)) {
411// Not all link artifacts allow debugging.
412if (*DebugObj ==nullptr)
413return;
414if (RequireDebugSections && !(**DebugObj).hasFlags(HasDebugSections)) {
415LLVM_DEBUG(dbgs() <<"Skipping debug registration for LinkGraph '"
416 <<G.getName() <<"': no debug info\n");
417return;
418 }
419 PendingObjs[&MR] = std::move(*DebugObj);
420 }else {
421 ES.reportError(DebugObj.takeError());
422 }
423}
424
425voidDebugObjectManagerPlugin::modifyPassConfig(
426MaterializationResponsibility &MR,LinkGraph &G,
427PassConfiguration &PassConfig) {
428// Not all link artifacts have associated debug objects.
429 std::lock_guard<std::mutex> Lock(PendingObjsLock);
430auto It = PendingObjs.find(&MR);
431if (It == PendingObjs.end())
432return;
433
434DebugObject &DebugObj = *It->second;
435if (DebugObj.hasFlags(ReportFinalSectionLoadAddresses)) {
436 PassConfig.PostAllocationPasses.push_back(
437 [&DebugObj](LinkGraph &Graph) ->Error {
438for (constSection &GraphSection : Graph.sections())
439 DebugObj.reportSectionTargetMemoryRange(GraphSection.getName(),
440SectionRange(GraphSection));
441returnError::success();
442 });
443 }
444}
445
446ErrorDebugObjectManagerPlugin::notifyEmitted(
447MaterializationResponsibility &MR) {
448 std::lock_guard<std::mutex> Lock(PendingObjsLock);
449auto It = PendingObjs.find(&MR);
450if (It == PendingObjs.end())
451returnError::success();
452
453// During finalization the debug object is registered with the target.
454// Materialization must wait for this process to finish. Otherwise we might
455// start running code before the debugger processed the corresponding debug
456// info.
457 std::promise<MSVCPError> FinalizePromise;
458 std::future<MSVCPError> FinalizeErr = FinalizePromise.get_future();
459
460 It->second->finalizeAsync(
461 [this, &FinalizePromise, &MR](Expected<ExecutorAddrRange> TargetMem) {
462// Any failure here will fail materialization.
463if (!TargetMem) {
464 FinalizePromise.set_value(TargetMem.takeError());
465return;
466 }
467if (Error Err =
468Target->registerDebugObject(*TargetMem, AutoRegisterCode)) {
469 FinalizePromise.set_value(std::move(Err));
470 return;
471 }
472
473// Once our tracking info is updated, notifyEmitted() can return and
474// finish materialization.
475 FinalizePromise.set_value(MR.withResourceKeyDo([&](ResourceKey K) {
476 assert(PendingObjs.count(&MR) &&"We still hold PendingObjsLock");
477 std::lock_guard<std::mutex> Lock(RegisteredObjsLock);
478 RegisteredObjs[K].push_back(std::move(PendingObjs[&MR]));
479 PendingObjs.erase(&MR);
480 }));
481 });
482
483return FinalizeErr.get();
484}
485
486ErrorDebugObjectManagerPlugin::notifyFailed(
487MaterializationResponsibility &MR) {
488 std::lock_guard<std::mutex> Lock(PendingObjsLock);
489 PendingObjs.erase(&MR);
490returnError::success();
491}
492
493voidDebugObjectManagerPlugin::notifyTransferringResources(JITDylib &JD,
494ResourceKey DstKey,
495ResourceKey SrcKey) {
496// Debug objects are stored by ResourceKey only after registration.
497// Thus, pending objects don't need to be updated here.
498 std::lock_guard<std::mutex> Lock(RegisteredObjsLock);
499auto SrcIt = RegisteredObjs.find(SrcKey);
500if (SrcIt != RegisteredObjs.end()) {
501// Resources from distinct MaterializationResponsibilitys can get merged
502// after emission, so we can have multiple debug objects per resource key.
503for (std::unique_ptr<DebugObject> &DebugObj : SrcIt->second)
504 RegisteredObjs[DstKey].push_back(std::move(DebugObj));
505 RegisteredObjs.erase(SrcIt);
506 }
507}
508
509ErrorDebugObjectManagerPlugin::notifyRemovingResources(JITDylib &JD,
510ResourceKey Key) {
511// Removing the resource for a pending object fails materialization, so they
512// get cleaned up in the notifyFailed() handler.
513 std::lock_guard<std::mutex> Lock(RegisteredObjsLock);
514 RegisteredObjs.erase(Key);
515
516// TODO: Implement unregister notifications.
517returnError::success();
518}
519
520}// namespace orc
521}// namespace llvm
StringMap.h
This file defines the StringMap class.
ArrayRef.h
true
basic Basic Alias true
Definition:BasicAliasAnalysis.cpp:1981
ELF.h
DebugObjectManagerPlugin.h
LLVM_DEBUG
#define LLVM_DEBUG(...)
Definition:Debug.h:106
Shdr
Elf_Shdr Shdr
Definition:ELFObjHandler.cpp:78
Addr
uint64_t Addr
Definition:ELFObjHandler.cpp:79
Name
std::string Name
Definition:ELFObjHandler.cpp:77
Size
uint64_t Size
Definition:ELFObjHandler.cpp:81
ELFObjectFile.h
End
bool End
Definition:ELF_riscv.cpp:480
Errc.h
_
#define _
Definition:HexagonMCCodeEmitter.cpp:46
PageSize
static cl::opt< int > PageSize("imp-null-check-page-size", cl::desc("The page size of the target in bytes"), cl::init(4096), cl::Hidden)
JITLinkDylib.h
JITLinkMemoryManager.h
F
#define F(x, y, z)
Definition:MD5.cpp:55
G
#define G(x, y, z)
Definition:MD5.cpp:56
MSVCErrorWorkarounds.h
MemoryBuffer.h
Range
ConstantRange Range(APInt(BitWidth, Low), APInt(BitWidth, High))
Process.h
Provides a library for accessing information about this process and other processes on the operating ...
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Endian
endianness Endian
Definition:SampleProfWriter.cpp:52
OS
raw_pwrite_stream & OS
Definition:SampleProfWriter.cpp:51
StringRef.h
llvm::ErrorAsOutParameter
Helper for Errors used as out-parameters.
Definition:Error.h:1130
llvm::Error
Lightweight error class with error context and mandatory checking.
Definition:Error.h:160
llvm::Error::success
static ErrorSuccess success()
Create a success value.
Definition:Error.h:337
llvm::Expected
Tagged union holding either a T or a Error.
Definition:Error.h:481
llvm::Expected::takeError
Error takeError()
Take ownership of the stored error.
Definition:Error.h:608
llvm::MemoryBufferRef
Definition:MemoryBufferRef.h:22
llvm::MemoryBufferRef::getBufferSize
size_t getBufferSize() const
Definition:MemoryBufferRef.h:37
llvm::MemoryBufferRef::getBufferIdentifier
StringRef getBufferIdentifier() const
Definition:MemoryBufferRef.h:33
llvm::MemoryBufferRef::getBufferStart
const char * getBufferStart() const
Definition:MemoryBufferRef.h:35
llvm::MemoryBufferRef::getBuffer
StringRef getBuffer() const
Definition:MemoryBufferRef.h:32
llvm::StringMap
StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...
Definition:StringMap.h:128
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition:StringRef.h:51
llvm::StringRef::bytes_end
const unsigned char * bytes_end() const
Definition:StringRef.h:131
llvm::StringRef::size
constexpr size_t size() const
size - Get the string size.
Definition:StringRef.h:150
llvm::StringRef::bytes_begin
const unsigned char * bytes_begin() const
Definition:StringRef.h:128
llvm::Target
Target - Wrapper for Target specific information.
Definition:TargetRegistry.h:144
llvm::Triple::ELF
@ ELF
Definition:Triple.h:312
llvm::WritableMemoryBuffer::getNewUninitMemBuffer
static std::unique_ptr< WritableMemoryBuffer > getNewUninitMemBuffer(size_t Size, const Twine &BufferName="", std::optional< Align > Alignment=std::nullopt)
Allocate a new MemoryBuffer of the specified size that is not initialized.
Definition:MemoryBuffer.cpp:308
llvm::jitlink::JITLinkContext
Holds context for a single jitLink invocation.
Definition:JITLink.h:1929
llvm::jitlink::JITLinkContext::getJITLinkDylib
const JITLinkDylib * getJITLinkDylib() const
Return the JITLinkDylib that this link is targeting, if any.
Definition:JITLink.h:1940
llvm::jitlink::JITLinkContext::getMemoryManager
virtual JITLinkMemoryManager & getMemoryManager()=0
Return the MemoryManager to be used for this link.
llvm::jitlink::JITLinkDylib
Definition:JITLinkDylib.h:21
llvm::jitlink::JITLinkMemoryManager::FinalizedAlloc
Represents a finalized allocation.
Definition:JITLinkMemoryManager.h:58
llvm::jitlink::JITLinkMemoryManager::InFlightAlloc
Represents an allocation which has not been finalized yet.
Definition:JITLinkMemoryManager.h:121
llvm::jitlink::JITLinkMemoryManager
Manages allocations of JIT memory.
Definition:JITLinkMemoryManager.h:46
llvm::jitlink::JITLinkMemoryManager::deallocate
virtual void deallocate(std::vector< FinalizedAlloc > Allocs, OnDeallocatedFunction OnDeallocated)=0
Deallocate a list of allocation objects.
llvm::jitlink::LinkGraph
Definition:JITLink.h:875
llvm::jitlink::LinkGraph::sections
iterator_range< section_iterator > sections()
Definition:JITLink.h:1362
llvm::jitlink::SectionRange
Represents a section address range via a pair of Block pointers to the first and last Blocks in the s...
Definition:JITLink.h:832
llvm::jitlink::Section
Represents an object file section.
Definition:JITLink.h:714
llvm::jitlink::SimpleSegmentAlloc::Create
static void Create(JITLinkMemoryManager &MemMgr, std::shared_ptr< orc::SymbolStringPool > SSP, Triple TT, const JITLinkDylib *JD, SegmentMap Segments, OnCreatedFunction OnCreated)
Definition:JITLinkMemoryManager.cpp:146
llvm::object::ELFFile::create
static Expected< ELFFile > create(StringRef Object)
Definition:ELF.h:888
llvm::orc::DebugObjectManagerPlugin
Creates and manages DebugObjects for JITLink artifacts.
Definition:DebugObjectManagerPlugin.h:48
llvm::orc::DebugObjectManagerPlugin::notifyRemovingResources
Error notifyRemovingResources(JITDylib &JD, ResourceKey K) override
Definition:DebugObjectManagerPlugin.cpp:509
llvm::orc::DebugObjectManagerPlugin::notifyTransferringResources
void notifyTransferringResources(JITDylib &JD, ResourceKey DstKey, ResourceKey SrcKey) override
Definition:DebugObjectManagerPlugin.cpp:493
llvm::orc::DebugObjectManagerPlugin::notifyFailed
Error notifyFailed(MaterializationResponsibility &MR) override
Definition:DebugObjectManagerPlugin.cpp:486
llvm::orc::DebugObjectManagerPlugin::notifyEmitted
Error notifyEmitted(MaterializationResponsibility &MR) override
Definition:DebugObjectManagerPlugin.cpp:446
llvm::orc::DebugObjectManagerPlugin::~DebugObjectManagerPlugin
~DebugObjectManagerPlugin()
llvm::orc::DebugObjectManagerPlugin::notifyMaterializing
void notifyMaterializing(MaterializationResponsibility &MR, jitlink::LinkGraph &G, jitlink::JITLinkContext &Ctx, MemoryBufferRef InputObject) override
Definition:DebugObjectManagerPlugin.cpp:402
llvm::orc::DebugObjectManagerPlugin::modifyPassConfig
void modifyPassConfig(MaterializationResponsibility &MR, jitlink::LinkGraph &LG, jitlink::PassConfiguration &PassConfig) override
Definition:DebugObjectManagerPlugin.cpp:425
llvm::orc::DebugObjectManagerPlugin::DebugObjectManagerPlugin
DebugObjectManagerPlugin(ExecutionSession &ES, std::unique_ptr< DebugObjectRegistrar > Target)
Definition:DebugObjectManagerPlugin.cpp:396
llvm::orc::DebugObjectSection
Definition:DebugObjectManagerPlugin.cpp:39
llvm::orc::DebugObjectSection::setTargetMemoryRange
virtual void setTargetMemoryRange(SectionRange Range)=0
llvm::orc::DebugObjectSection::dump
virtual void dump(raw_ostream &OS, StringRef Name)
Definition:DebugObjectManagerPlugin.cpp:42
llvm::orc::DebugObjectSection::~DebugObjectSection
virtual ~DebugObjectSection()=default
llvm::orc::DebugObject
The plugin creates a debug object from when JITLink starts processing the corresponding LinkGraph.
Definition:DebugObjectManagerPlugin.cpp:114
llvm::orc::DebugObject::~DebugObject
virtual ~DebugObject()
Definition:DebugObjectManagerPlugin.cpp:132
llvm::orc::DebugObject::MemMgr
JITLinkMemoryManager & MemMgr
Definition:DebugObjectManagerPlugin.cpp:150
llvm::orc::DebugObject::ES
ExecutionSession & ES
Definition:DebugObjectManagerPlugin.cpp:152
llvm::orc::DebugObject::hasFlags
bool hasFlags(DebugObjectFlags F) const
Definition:DebugObjectManagerPlugin.cpp:120
llvm::orc::DebugObject::finalizeAsync
void finalizeAsync(FinalizeContinuation OnFinalize)
Definition:DebugObjectManagerPlugin.cpp:162
llvm::orc::DebugObject::finalizeWorkingMemory
virtual Expected< SimpleSegmentAlloc > finalizeWorkingMemory()=0
llvm::orc::DebugObject::FinalizeContinuation
std::function< void(Expected< ExecutorAddrRange >)> FinalizeContinuation
Definition:DebugObjectManagerPlugin.cpp:128
llvm::orc::DebugObject::clearFlags
void clearFlags(DebugObjectFlags F)
Definition:DebugObjectManagerPlugin.cpp:124
llvm::orc::DebugObject::reportSectionTargetMemoryRange
virtual void reportSectionTargetMemoryRange(StringRef Name, SectionRange TargetMem)
Definition:DebugObjectManagerPlugin.cpp:141
llvm::orc::DebugObject::JD
const JITLinkDylib * JD
Definition:DebugObjectManagerPlugin.cpp:151
llvm::orc::DebugObject::setFlags
void setFlags(DebugObjectFlags F)
Definition:DebugObjectManagerPlugin.cpp:121
llvm::orc::DebugObject::DebugObject
DebugObject(JITLinkMemoryManager &MemMgr, const JITLinkDylib *JD, ExecutionSession &ES)
Definition:DebugObjectManagerPlugin.cpp:116
llvm::orc::ELFDebugObjectSection
Definition:DebugObjectManagerPlugin.cpp:47
llvm::orc::ELFDebugObjectSection::validateInBounds
Error validateInBounds(StringRef Buffer, const char *Name) const
Definition:DebugObjectManagerPlugin.cpp:71
llvm::orc::ELFDebugObjectSection::setTargetMemoryRange
void setTargetMemoryRange(SectionRange Range) override
Definition:DebugObjectManagerPlugin.cpp:64
llvm::orc::ELFDebugObjectSection::dump
void dump(raw_ostream &OS, StringRef Name) override
Definition:DebugObjectManagerPlugin.cpp:93
llvm::orc::ELFDebugObjectSection::ELFDebugObjectSection
ELFDebugObjectSection(const typename ELFT::Shdr *Header)
Definition:DebugObjectManagerPlugin.cpp:51
llvm::orc::ELFDebugObject
The current implementation of ELFDebugObject replicates the approach used in RuntimeDyld: It patches ...
Definition:DebugObjectManagerPlugin.cpp:186
llvm::orc::ELFDebugObject::recordSection
Error recordSection(StringRef Name, std::unique_ptr< ELFDebugObjectSection< ELFT > > Section)
Definition:DebugObjectManagerPlugin.cpp:355
llvm::orc::ELFDebugObject::getSection
DebugObjectSection * getSection(StringRef Name)
Definition:DebugObjectManagerPlugin.cpp:367
llvm::orc::ELFDebugObject::finalizeWorkingMemory
Expected< SimpleSegmentAlloc > finalizeWorkingMemory() override
Definition:DebugObjectManagerPlugin.cpp:321
llvm::orc::ELFDebugObject::reportSectionTargetMemoryRange
void reportSectionTargetMemoryRange(StringRef Name, SectionRange TargetMem) override
Definition:DebugObjectManagerPlugin.cpp:348
llvm::orc::ELFDebugObject::getBuffer
StringRef getBuffer() const
Definition:DebugObjectManagerPlugin.cpp:194
llvm::orc::ELFDebugObject::Create
static Expected< std::unique_ptr< DebugObject > > Create(MemoryBufferRef Buffer, JITLinkContext &Ctx, ExecutionSession &ES)
Definition:DebugObjectManagerPlugin.cpp:295
llvm::orc::ExecutionSession
An ExecutionSession represents a running JIT program.
Definition:Core.h:1340
llvm::orc::ExecutionSession::reportError
void reportError(Error Err)
Report a error for this execution session.
Definition:Core.h:1475
llvm::orc::ExecutionSession::getTargetTriple
const Triple & getTargetTriple() const
Return the triple for the executor.
Definition:Core.h:1383
llvm::orc::ExecutionSession::getSymbolStringPool
std::shared_ptr< SymbolStringPool > getSymbolStringPool()
Get the SymbolStringPool for this instance.
Definition:Core.h:1389
llvm::orc::JITDylib
Represents a JIT'd dynamic library.
Definition:Core.h:897
llvm::orc::MaterializationResponsibility
Tracks responsibility for materialization, and mediates interactions between MaterializationUnits and...
Definition:Core.h:571
llvm::orc::MaterializationResponsibility::withResourceKeyDo
Error withResourceKeyDo(Func &&F) const
Runs the given callback under the session lock, passing in the associated ResourceKey.
Definition:Core.h:590
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition:raw_ostream.h:52
llvm::sys::Process::getPageSizeEstimate
static unsigned getPageSizeEstimate()
Get the process's estimated page size.
Definition:Process.h:61
uint64_t
uint8_t
llvm::ELF::ELFCLASS64
@ ELFCLASS64
Definition:ELF.h:332
llvm::ELF::ELFCLASS32
@ ELFCLASS32
Definition:ELF.h:331
llvm::ELF::SHT_PROGBITS
@ SHT_PROGBITS
Definition:ELF.h:1098
llvm::ELF::SHT_X86_64_UNWIND
@ SHT_X86_64_UNWIND
Definition:ELF.h:1172
llvm::ELF::SHF_ALLOC
@ SHF_ALLOC
Definition:ELF.h:1198
llvm::ELF::ELFDATA2MSB
@ ELFDATA2MSB
Definition:ELF.h:339
llvm::ELF::ELFDATA2LSB
@ ELFDATA2LSB
Definition:ELF.h:338
llvm::jitlink
Definition:aarch32.h:23
llvm::object
Definition:DWARFDebugLoc.h:24
llvm::object::getSection
Expected< const typename ELFT::Shdr * > getSection(typename ELFT::ShdrRange Sections, uint32_t Index)
Definition:ELF.h:534
llvm::object::getElfArchType
std::pair< unsigned char, unsigned char > getElfArchType(StringRef Object)
Definition:ELF.h:80
llvm::orc::DwarfSectionNames
static const std::set< StringRef > DwarfSectionNames
Definition:DebugObjectManagerPlugin.cpp:224
llvm::orc::MemProt::Read
@ Read
llvm::orc::createDebugObjectFromBuffer
static Expected< std::unique_ptr< DebugObject > > createDebugObjectFromBuffer(ExecutionSession &ES, LinkGraph &G, JITLinkContext &Ctx, MemoryBufferRef ObjBuffer)
Creates a debug object based on the input object file from ObjectLinkingLayerJITLinkContext.
Definition:DebugObjectManagerPlugin.cpp:376
llvm::orc::isDwarfSection
static bool isDwarfSection(StringRef SectionName)
Definition:DebugObjectManagerPlugin.cpp:231
llvm::orc::DebugObjectFlags
DebugObjectFlags
Definition:DebugObjectManagerPlugin.cpp:101
llvm::orc::ReportFinalSectionLoadAddresses
@ ReportFinalSectionLoadAddresses
Definition:DebugObjectManagerPlugin.cpp:103
llvm::orc::HasDebugSections
@ HasDebugSections
Definition:DebugObjectManagerPlugin.cpp:106
llvm::orc::ResourceKey
uintptr_t ResourceKey
Definition:Core.h:74
llvm::pdb::PDB_ColorItem::SectionHeader
@ SectionHeader
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition:AddressRanges.h:18
llvm::make_error_code
std::error_code make_error_code(BitcodeError E)
Definition:BitcodeReader.h:310
llvm::AllocFnKind::Alloc
@ Alloc
llvm::inconvertibleErrorCode
std::error_code inconvertibleErrorCode()
The value returned by this function can be returned from convertToErrorCode for Error values where no...
Definition:Error.cpp:98
llvm::errc::not_enough_memory
@ not_enough_memory
llvm::formatv
auto formatv(bool Validate, const char *Fmt, Ts &&...Vals)
Definition:FormatVariadic.h:252
llvm::dbgs
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Definition:Debug.cpp:163
llvm::move
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
Definition:STLExtras.h:1873
llvm::errorCodeToError
Error errorCodeToError(std::error_code EC)
Helper for converting an std::error_code to a Error.
Definition:Error.cpp:111
std
Implement std::hash so that hash_code can be used in STL containers.
Definition:BitVector.h:858
raw_ostream.h
llvm::SectionName
Definition:DWARFSection.h:21
llvm::jitlink::PassConfiguration
An LinkGraph pass configuration, consisting of a list of pre-prune, post-prune, and post-fixup passes...
Definition:JITLink.h:1834
llvm::jitlink::PassConfiguration::PostAllocationPasses
LinkGraphPassList PostAllocationPasses
Post-allocation passes.
Definition:JITLink.h:1865
llvm::orc::ExecutorAddrRange
Represents an address range in the exceutor process.
Definition:ExecutorAddress.h:222

Generated on Fri Jul 18 2025 11:27:02 for LLVM by doxygen 1.9.6
[8]ページ先頭

©2009-2025 Movatter.jp