10 #ifndef LLVM_DEBUGINFO_DWARF_DWARFCONTEXT_H
11 #define LLVM_DEBUGINFO_DWARF_DWARFCONTEXT_H
54 std::deque<DWARFUnitSection<DWARFTypeUnit>> TUs;
55 std::unique_ptr<DWARFUnitIndex> CUIndex;
56 std::unique_ptr<DWARFGdbIndex> GdbIndex;
57 std::unique_ptr<DWARFUnitIndex> TUIndex;
58 std::unique_ptr<DWARFDebugAbbrev> Abbrev;
59 std::unique_ptr<DWARFDebugLoc> Loc;
60 std::unique_ptr<DWARFDebugAranges> Aranges;
61 std::unique_ptr<DWARFDebugLine> Line;
62 std::unique_ptr<DWARFDebugFrame> DebugFrame;
63 std::unique_ptr<DWARFDebugFrame> EHFrame;
64 std::unique_ptr<DWARFDebugMacro> Macro;
67 std::deque<DWARFUnitSection<DWARFTypeUnit>> DWOTUs;
68 std::unique_ptr<DWARFDebugAbbrev> AbbrevDWO;
69 std::unique_ptr<DWARFDebugLocDWO> LocDWO;
72 unsigned MaxVersion = 0;
76 std::unique_ptr<DWARFContext>
Context;
79 std::weak_ptr<DWOFile> DWP;
80 bool CheckedForDWP =
false;
84 void parseCompileUnits();
88 void parseTypeUnits();
92 void parseDWOCompileUnits();
96 void parseDWOTypeUnits();
129 parseDWOCompileUnits();
153 parseDWOCompileUnits();
154 return DWOCUs.size();
160 return DWOTUs.size();
166 return CUs[index].get();
171 parseDWOCompileUnits();
172 return DWOCUs[index].get();
183 if (Version > MaxVersion)
269 return version == 2 || version == 3 || version == 4 || version == 5;
292 virtual void anchor();
295 std::map<object::SectionRef, unsigned>>;
301 TypeSectionMap TypesSections;
323 TypeSectionMap TypesDWOSections;
367 for (
auto &
P : TypesSections)
390 return StringOffsetSection;
397 for (
auto &
P : TypesDWOSections)
407 return StringOffsetDWOSection;
421 #endif // LLVM_DEBUGINFO_DWARF_DWARFCONTEXT_H
const DWARFUnitIndex & getTUIndex()
virtual StringRef getAbbrevSection()=0
StringRef getPubTypesSection() override
DWARFCompileUnit * getDWOCompileUnitAtIndex(unsigned index)
Get the compile unit at the specified index for the DWO compile units.
const DWARFDebugFrame * getEHFrame()
Get a pointer to the parsed eh frame information object.
StringRef getGdbIndexSection() override
const DWARFDebugFrame * getDebugFrame()
Get a pointer to the parsed frame information object.
StringRef getEHFrameSection() override
StringRef getTUIndexSection() override
A parsed .debug_frame or .eh_frame section.
const DWARFDebugLocDWO * getDebugLocDWO()
Get a pointer to the parsed DebugLoc object.
StringRef getDebugFrameSection() override
const DWARFDebugLoc * getDebugLoc()
Get a pointer to the parsed DebugLoc object.
const DWARFSection & getRangeSection() override
ErrorPolicy
Used as a return value for a error callback passed to DWARF context.
DWARFDie getDIEForOffset(uint32_t Offset)
Get a DIE given an exact offset.
virtual const DWARFSection & getLineSection()=0
virtual const DWARFSection & getAppleTypesSection()=0
This provides a very simple, boring adaptor for a begin and end iterator into a range type...
DWARFGdbIndex & getGdbIndex()
std::shared_ptr< DWARFContext > getDWOContext(StringRef AbsolutePath)
unsigned getNumDWOCompileUnits()
Get the number of compile units in the DWO context.
virtual StringRef getFileName() const =0
An efficient, type-erasing, non-owning reference to a callable.
StringRef getFileName() const override
This class is the base class for all object file types.
This class implements a map that also provides access to all stored values in a deterministic order...
unsigned getNumTypeUnits()
Get the number of compile units in this context.
const DWARFDebugAbbrev * getDebugAbbrevDWO()
Get a pointer to the parsed dwo abbreviations object.
virtual StringRef getStringDWOSection()=0
virtual uint8_t getAddressSize() const =0
virtual const DWARFSection & getAppleNamesSection()=0
bool isLittleEndian() const override
virtual const DWARFSection & getInfoDWOSection()=0
virtual const DWARFSection & getRangeDWOSection()=0
const DWARFSection & getLocSection() override
virtual const DWARFSection & getAppleObjCSection()=0
StringRef getGnuPubTypesSection() override
virtual StringRef getGnuPubTypesSection()=0
DILineInfo - a format-neutral container for source line information.
DIContextKind getKind() const
const DWARFSection & getInfoDWOSection() override
StringRef getARangeSection() override
StringRef getMacinfoSection() override
virtual const DWARFSection & getLocSection()=0
unsigned getNumCompileUnits()
Get the number of compile units in this context.
unsigned getMaxVersion() const
virtual StringRef getPubTypesSection()=0
unsigned getNumDWOTypeUnits()
Get the number of compile units in the DWO context.
StringRef getGnuPubNamesSection() override
const DWARFSection & getLocDWOSection() override
static const bool IsLittleEndianHost
const DWARFDebugAranges * getDebugAranges()
Get a pointer to the parsed DebugAranges object.
const DWARFDebugAbbrev * getDebugAbbrev()
Get a pointer to the parsed DebugAbbrev object.
DWARFCompileUnit * getCompileUnitAtIndex(unsigned index)
Get the compile unit at the specified index for this compile unit.
DWARFContextInMemory is the simplest possible implementation of a DWARFContext.
StringRef getAbbrevDWOSection() override
StringRef getAbbrevSection() override
virtual const DWARFSection & getStringOffsetDWOSection()=0
virtual StringRef getCUIndexSection()=0
Container for dump options that control which debug information will be dumped.
Utility class that carries the DWARF compile/type unit and the debug info entry in an object...
virtual StringRef getPubNamesSection()=0
DWARFUnitSection< DWARFCompileUnit >::iterator_range cu_iterator_range
DILineInfoSpecifier - controls which fields of DILineInfo container should be filled with data...
const DWARFDebugMacro * getDebugMacro()
Get a pointer to the parsed DebugMacro object.
DIInliningInfo - a format-neutral container for inlined code description.
DIDumpType
Selects which debug sections get dumped.
DILineInfo getLineInfoForAddress(uint64_t Address, DILineInfoSpecifier Specifier=DILineInfoSpecifier()) override
StringRef getCUIndexSection() override
const DWARFSection & getAppleNamespacesSection() override
virtual const DWARFSection & getAddrSection()=0
const DWARFSection & getStringOffsetSection() override
DWARF v5.
StringRef getStringSection() override
virtual void forEachTypesDWOSections(function_ref< void(DWARFSection &)> F)=0
const DWARFSection & getRangeDWOSection() override
DWARFContextInMemory(const object::ObjectFile &Obj, const LoadedObjectInfo *L=nullptr, function_ref< ErrorPolicy(Error)> HandleError=defaultErrorHandler)
const DWARFSection & getAppleTypesSection() override
bool verify(raw_ostream &OS, DIDumpType DumpType=DIDT_All) override
DWARFCompileUnit * getDWOCompileUnitForHash(uint64_t Hash)
iterator_range< decltype(TUs)::iterator > tu_section_iterator_range
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
Concrete instance of DWARFUnitSection, specialized for one Unit type.
DIInliningInfo getInliningInfoForAddress(uint64_t Address, DILineInfoSpecifier Specifier=DILineInfoSpecifier()) override
DWARFContext This data structure is the top level entity that deals with dwarf debug information pars...
const DWARFSection & getLineDWOSection() override
tu_section_iterator_range dwo_type_unit_sections()
Get type units in the DWO context.
StringRef getPubNamesSection() override
A range adaptor for a pair of iterators.
StringMap - This is an unconventional map that is specialized for handling keys that are "strings"...
virtual void forEachTypesSections(function_ref< void(DWARFSection &)> F)=0
An inferface for inquiring the load address of a loaded object file to be used by the DIContext imple...
constexpr char Size[]
Key for Kernel::Arg::Metadata::mSize.
void forEachTypesSections(function_ref< void(DWARFSection &)> F) override
DILineInfoTable getLineInfoForAddressRange(uint64_t Address, uint64_t Size, DILineInfoSpecifier Specifier=DILineInfoSpecifier()) override
virtual const DWARFSection & getInfoSection()=0
virtual StringRef getAbbrevDWOSection()=0
static bool isSupportedVersion(unsigned version)
const DWARFSection & getStringOffsetDWOSection() override
StringRef getStringDWOSection() override
cu_iterator_range compile_units()
Get compile units in this context.
virtual StringRef getGdbIndexSection()=0
void forEachTypesDWOSections(function_ref< void(DWARFSection &)> F) override
const DWARFSection & getInfoSection() override
virtual const DWARFSection & getStringOffsetSection()=0
DWARF v5.
virtual StringRef getARangeSection()=0
static bool classof(const DIContext *DICtx)
const DWARFUnitIndex & getCUIndex()
const DWARFSection & getAddrSection() override
cu_iterator_range dwo_compile_units()
Get compile units in the DWO context.
virtual const DWARFSection & getLineDWOSection()=0
virtual const DWARFSection & getAppleNamespacesSection()=0
const DWARFDebugLine::LineTable * getLineTableForUnit(DWARFUnit *cu)
Get a pointer to a parsed line table corresponding to a compile unit.
Lightweight error class with error context and mandatory checking.
virtual const DWARFSection & getLocDWOSection()=0
This class implements an extremely fast bulk output stream that can only output to a stream...
std::string Hash(const Unit &U)
StringRef - Represent a constant reference to a string, i.e.
virtual StringRef getStringSection()=0
const DWARFSection & getLineSection() override
tu_section_iterator_range type_unit_sections()
Get type units in this context.
virtual StringRef getMacinfoSection()=0
virtual StringRef getDebugFrameSection()=0
virtual StringRef getGnuPubNamesSection()=0
void dump(raw_ostream &OS, DIDumpOptions DumpOpts) override
virtual StringRef getEHFrameSection()=0
DWARFContext & operator=(DWARFContext &)=delete
virtual StringRef getTUIndexSection()=0
virtual const DWARFSection & getRangeSection()=0
void setMaxVersionIfGreater(unsigned Version)
virtual bool isLittleEndian() const =0
const DWARFSection & getAppleNamesSection() override
const DWARFSection & getAppleObjCSection() override
This is a value type class that represents a single section in the list of sections in the object fil...
uint8_t getAddressSize() const override