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
42 auto &PSym = Preserved[
Block];
44 PSym = &
G.addAnonymousSymbol(*
Block, 0, 0,
false,
true);
45 else if (!PSym->isLive())
54 return LHS->getAddress() < RHS->getAddress();
60 for (
auto *
Block : SecBlocks) {
71 options.DumpType &= ~DIDT_UUID;
72 options.DumpType &= ~(1 << DIDT_ID_DebugFrame);
79 if (!
G.getTargetTriple().isOSBinFormatELF()) {
80 return make_error<StringError>(
81 "preserveDebugSections only supports ELF LinkGraphs!",
84 for (
auto &Sec :
G.sections()) {
85 if (DWARFSectionNames.count(Sec.getName())) {
88 preserveDWARFSection(
G, Sec);
97 if (!
G.getTargetTriple().isOSBinFormatELF()) {
98 return make_error<StringError>(
99 "createDWARFContext only supports ELF LinkGraphs!",
103 for (
auto &Sec :
G.sections()) {
104 if (DWARFSectionNames.count(Sec.getName())) {
105 auto SecData = getSectionData(Sec);
106 auto Name = Sec.getName();
108 Name.consume_front(
".");
110 <<
" with size " << SecData.size() <<
"\n");
111 DWARFSectionData[
Name] =
112 std::make_unique<SmallVectorMemoryBuffer>(std::move(SecData));
118 dumpDWARFContext(*Ctx);
119 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)
size_type count(const_arg_type_t< KeyT > Val) const
Return 1 if the specified key is in the map, 0 otherwise.
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.
bool isLive() const
Returns true if this symbol is live (i.e.
Block & getBlock()
Return the Block for this Symbol (Symbol must be defined).
Error preserveDebugSections(jitlink::LinkGraph &G)
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.
std::error_code inconvertibleErrorCode()
The value returned by this function can be returned from convertToErrorCode for Error values where no...
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Container for dump options that control which debug information will be dumped.