17#define DEBUG_TYPE "orc"
25#define HANDLE_DWARF_SECTION(ENUM_NAME, ELF_NAME, CMDLINE_NAME, OPTION) \
27#include "llvm/BinaryFormat/Dwarf.def"
28#undef HANDLE_DWARF_SECTION
35 for (
auto Sym : Sec.
symbols()) {
36 auto [It, Inserted] = Preserved.
try_emplace(&Sym->getBlock());
37 if (Inserted || Sym->isLive())
41 auto &PSym = Preserved[
Block];
43 PSym = &
G.addAnonymousSymbol(*
Block, 0, 0,
false,
true);
44 else if (!PSym->isLive())
53 return LHS->getAddress() < RHS->getAddress();
59 for (
auto *
Block : SecBlocks) {
71 options.DumpType &= ~(1 << DIDT_ID_DebugFrame);
78 if (!
G.getTargetTriple().isOSBinFormatELF()) {
80 "preserveDebugSections only supports ELF LinkGraphs!",
83 for (
auto &Sec :
G.sections()) {
84 if (DWARFSectionNames.count(Sec.getName())) {
87 preserveDWARFSection(
G, Sec);
96 if (!
G.getTargetTriple().isOSBinFormatELF()) {
98 "createDWARFContext only supports ELF LinkGraphs!",
102 for (
auto &Sec :
G.sections()) {
103 if (DWARFSectionNames.count(Sec.getName())) {
104 auto SecData = getSectionData(Sec);
105 auto Name = Sec.getName();
107 Name.consume_front(
".");
109 <<
" with size " << SecData.size() <<
"\n");
110 DWARFSectionData[Name] =
111 std::make_unique<SmallVectorMemoryBuffer>(std::move(SecData));
117 dumpDWARFContext(*Ctx);
118 return std::make_pair(std::move(Ctx), std::move(DWARFSectionData));
DWARFContext This data structure is the top level entity that deals with dwarf debug information pars...
void dump(raw_ostream &OS, DIDumpOptions DumpOpts, std::array< std::optional< uint64_t >, DIDT_ID_Count > DumpOffsets)
Dump a textual representation to OS.
static std::unique_ptr< DWARFContext > create(const object::ObjectFile &Obj, ProcessDebugRelocations RelocAction=ProcessDebugRelocations::Process, const LoadedObjectInfo *L=nullptr, std::string DWPName="", std::function< void(Error)> RecoverableErrorHandler=WithColor::defaultErrorHandler, std::function< void(Error)> WarningHandler=WithColor::defaultWarningHandler, bool ThreadSafe=false)
std::pair< iterator, bool > try_emplace(KeyT &&Key, Ts &&...Args)
Implements a dense probed hash-table based set.
Lightweight error class with error context and mandatory checking.
static ErrorSuccess success()
Create a success value.
Tagged union holding either a T or a Error.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...
An Addressable with content and edges.
ArrayRef< char > getContent() const
Get the content for this block. Block must not be a zero-fill block.
bool isZeroFill() const
Returns true if this is a zero-fill block.
size_t getSize() const
Returns the size of this defined addressable.
Represents an object file section.
iterator_range< symbol_iterator > symbols()
Returns an iterator over the symbols defined in this section.
iterator_range< block_iterator > blocks()
Returns an iterator over the blocks defined in this section.
LLVM_ABI Error preserveDebugSections(jitlink::LinkGraph &G)
LLVM_ABI Expected< std::pair< std::unique_ptr< DWARFContext >, StringMap< std::unique_ptr< MemoryBuffer > > > > createDWARFContext(jitlink::LinkGraph &G)
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI std::error_code inconvertibleErrorCode()
The value returned by this function can be returned from convertToErrorCode for Error values where no...
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Error make_error(ArgTs &&... Args)
Make a Error instance representing failure using the given error info type.
Container for dump options that control which debug information will be dumped.