#include "llvm/ExecutionEngine/Orc/DebugObjectManagerPlugin.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/BinaryFormat/ELF.h"
#include "llvm/ExecutionEngine/JITLink/JITLinkDylib.h"
#include "llvm/ExecutionEngine/JITLink/JITLinkMemoryManager.h"
#include "llvm/ExecutionEngine/JITSymbol.h"
#include "llvm/Object/ELFObjectFile.h"
#include "llvm/Object/ObjectFile.h"
#include "llvm/Support/Errc.h"
#include "llvm/Support/MSVCErrorWorkarounds.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/Process.h"
#include "llvm/Support/raw_ostream.h"
#include <set>
#define DEBUG_TYPE …
usingnamespacellvm::jitlink;
usingnamespacellvm::object;
namespace llvm {
namespace orc {
class DebugObjectSection { … };
template <typename ELFT>
class ELFDebugObjectSection : public DebugObjectSection { … };
template <typename ELFT>
void ELFDebugObjectSection<ELFT>::setTargetMemoryRange(SectionRange Range) { … }
template <typename ELFT>
Error ELFDebugObjectSection<ELFT>::validateInBounds(StringRef Buffer,
const char *Name) const { … }
template <typename ELFT>
void ELFDebugObjectSection<ELFT>::dump(raw_ostream &OS, StringRef Name) { … }
enum DebugObjectFlags : int { … };
class DebugObject { … };
void DebugObject::finalizeAsync(FinalizeContinuation OnFinalize) { … }
class ELFDebugObject : public DebugObject { … };
static const std::set<StringRef> DwarfSectionNames = …;
static bool isDwarfSection(StringRef SectionName) { … }
std::unique_ptr<WritableMemoryBuffer>
ELFDebugObject::CopyBuffer(MemoryBufferRef Buffer, Error &Err) { … }
template <typename ELFT>
Expected<std::unique_ptr<ELFDebugObject>>
ELFDebugObject::CreateArchType(MemoryBufferRef Buffer,
JITLinkMemoryManager &MemMgr,
const JITLinkDylib *JD, ExecutionSession &ES) { … }
Expected<std::unique_ptr<DebugObject>>
ELFDebugObject::Create(MemoryBufferRef Buffer, JITLinkContext &Ctx,
ExecutionSession &ES) { … }
Expected<SimpleSegmentAlloc> ELFDebugObject::finalizeWorkingMemory() { … }
void ELFDebugObject::reportSectionTargetMemoryRange(StringRef Name,
SectionRange TargetMem) { … }
template <typename ELFT>
Error ELFDebugObject::recordSection(
StringRef Name, std::unique_ptr<ELFDebugObjectSection<ELFT>> Section) { … }
DebugObjectSection *ELFDebugObject::getSection(StringRef Name) { … }
static Expected<std::unique_ptr<DebugObject>>
createDebugObjectFromBuffer(ExecutionSession &ES, LinkGraph &G,
JITLinkContext &Ctx, MemoryBufferRef ObjBuffer) { … }
DebugObjectManagerPlugin::DebugObjectManagerPlugin(
ExecutionSession &ES, std::unique_ptr<DebugObjectRegistrar> Target,
bool RequireDebugSections, bool AutoRegisterCode)
: … { … }
DebugObjectManagerPlugin::DebugObjectManagerPlugin(
ExecutionSession &ES, std::unique_ptr<DebugObjectRegistrar> Target)
: … { … }
DebugObjectManagerPlugin::~DebugObjectManagerPlugin() = default;
void DebugObjectManagerPlugin::notifyMaterializing(
MaterializationResponsibility &MR, LinkGraph &G, JITLinkContext &Ctx,
MemoryBufferRef ObjBuffer) { … }
void DebugObjectManagerPlugin::modifyPassConfig(
MaterializationResponsibility &MR, LinkGraph &G,
PassConfiguration &PassConfig) { … }
Error DebugObjectManagerPlugin::notifyEmitted(
MaterializationResponsibility &MR) { … }
Error DebugObjectManagerPlugin::notifyFailed(
MaterializationResponsibility &MR) { … }
void DebugObjectManagerPlugin::notifyTransferringResources(JITDylib &JD,
ResourceKey DstKey,
ResourceKey SrcKey) { … }
Error DebugObjectManagerPlugin::notifyRemovingResources(JITDylib &JD,
ResourceKey Key) { … }
}
}