Go to the documentation of this file.
9 #ifndef LLVM_DEBUGINFO_DWARF_DWARFCONTEXT_H
10 #define LLVM_DEBUGINFO_DWARF_DWARFCONTEXT_H
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;
65 std::unique_ptr<DWARFDebugMacro> Macinfo;
66 std::unique_ptr<DWARFDebugNames> Names;
67 std::unique_ptr<AppleAcceleratorTable> AppleNames;
68 std::unique_ptr<AppleAcceleratorTable> AppleTypes;
69 std::unique_ptr<AppleAcceleratorTable> AppleNamespaces;
70 std::unique_ptr<AppleAcceleratorTable> AppleObjC;
73 std::unique_ptr<DWARFDebugAbbrev> AbbrevDWO;
74 std::unique_ptr<DWARFDebugMacro> MacinfoDWO;
75 std::unique_ptr<DWARFDebugMacro> MacroDWO;
78 unsigned MaxVersion = 0;
82 std::unique_ptr<DWARFContext>
Context;
85 std::weak_ptr<DWOFile> DWP;
86 bool CheckedForDWP =
false;
89 std::unique_ptr<MCRegisterInfo>
RegInfo;
98 void parseNormalUnits();
104 enum { EagerParse =
false, LazyParse =
true };
105 void parseDWOUnits(
bool Lazy =
false);
107 std::unique_ptr<const DWARFObject> DObj;
120 std::string DWPName =
"",
143 dump(OS, DumpOpts, DumpOffsets);
155 NormalUnits.begin() +
163 NormalUnits.begin() + NormalUnits.
getNumInfoUnits(), NormalUnits.end());
236 return NormalUnits[
index].get();
242 return DWOUnits[
index].get();
368 return version == 2 || version == 3 || version == 4 || version == 5;
372 return AddressSize == 2 || AddressSize == 4 || AddressSize == 8;
380 return RecoverableErrorHandler;
385 static std::unique_ptr<DWARFContext>
387 std::string DWPName =
"",
393 static std::unique_ptr<DWARFContext>
422 std::unique_ptr<DWARFDebugMacro>
426 std::vector<DILocal> &Result);
431 #endif // LLVM_DEBUGINFO_DWARF_DWARFCONTEXT_H
const DWARFDebugNames & getDebugNames()
Get a reference to the parsed accelerator table object.
const DWARFDebugLine::LineTable * getLineTableForUnit(DWARFUnit *U)
Get a pointer to a parsed line table corresponding to a compile unit.
void dump(raw_ostream &OS, DIDumpOptions DumpOpts) override
This class represents lattice values for constants.
unit_iterator_range types_section_units()
Get units from .debug_types in this context.
Expected< const DWARFDebugFrame * > getEHFrame()
Get a pointer to the parsed eh frame information object.
DWARFUnitVector::iterator_range unit_iterator_range
DWARFUnitVector::compile_unit_range compile_unit_range
A format-neutral container for inlined code description.
Controls which fields of DILineInfo container should be filled with data.
const AppleAcceleratorTable & getAppleNames()
Get a reference to the parsed accelerator table object.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
unsigned getNumTypeUnits()
Get the number of type units in this context.
DWARFCompileUnit * getDWOCompileUnitForHash(uint64_t Hash)
DILineInfoTable getLineInfoForAddressRange(object::SectionedAddress Address, uint64_t Size, DILineInfoSpecifier Specifier=DILineInfoSpecifier()) override
virtual const object::ObjectFile * getFile() const
DataExtractor getStringExtractor() const
unit_iterator_range info_section_units()
Get units from .debug_info in this context.
DWARFContext This data structure is the top level entity that deals with dwarf debug information pars...
static void defaultErrorHandler(Error Err)
Implement default handling for Error.
virtual Triple::ArchType getArch() const =0
const DWARFDebugAbbrev * getDebugAbbrevDWO()
Get a pointer to the parsed dwo abbreviations object.
Tagged union holding either a T or a Error.
unit_iterator_range dwo_types_section_units()
Get units from .debug_types.dwo in the DWO context.
unsigned getNumTypesUnits() const
Returns number of units from all .debug_types[.dwo] sections.
std::vector< DILocal > getLocalsForAddress(object::SectionedAddress Address) override
const DWARFDebugMacro * getDebugMacroDWO()
Get a pointer to the parsed DebugMacroDWO information object.
static void defaultWarningHandler(Error Warning)
Implement default handling for Warning.
DIInliningInfo getInliningInfoForAddress(object::SectionedAddress Address, DILineInfoSpecifier Specifier=DILineInfoSpecifier()) override
const AppleAcceleratorTable & getAppleObjC()
Get a reference to the parsed accelerator table object.
const DWARFDebugMacro * getDebugMacinfo()
Get a pointer to the parsed DebugMacinfo information object.
const DWARFDebugAranges * getDebugAranges()
Get a pointer to the parsed DebugAranges object.
unsigned getNumInfoUnits() const
Returns number of units from all .debug_info[.dwo] sections.
unit_iterator_range dwo_info_section_units()
Get units from .debug_info..dwo in the DWO context.
const DWARFDebugMacro * getDebugMacinfoDWO()
Get a pointer to the parsed DebugMacinfoDWO information object.
unsigned getNumCompileUnits()
Get the number of compile units in this context.
Triple::ArchType getArch() const
This class implements an extremely fast bulk output stream that can only output to a stream.
DataExtractor getStringDWOExtractor() const
static std::unique_ptr< DWARFContext > create(const object::ObjectFile &Obj, const LoadedObjectInfo *L=nullptr, std::string DWPName="", std::function< void(Error)> RecoverableErrorHandler=WithColor::defaultErrorHandler, std::function< void(Error)> WarningHandler=WithColor::defaultWarningHandler)
DWARFContext & operator=(DWARFContext &)=delete
compile_unit_range compile_units()
Get compile units in this context.
StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...
unsigned getMaxDWOVersion()
const DWARFDebugMacro * getDebugMacro()
Get a pointer to the parsed DebugMacro information object.
unit_iterator_range dwo_units()
Get all units in the DWO context.
bool verify(raw_ostream &OS, DIDumpOptions DumpOpts={}) override
An efficient, type-erasing, non-owning reference to a callable.
unsigned getNumDWOTypeUnits()
Get the number of type units in the DWO context.
const DWARFDebugAbbrev * getDebugAbbrev()
Get a pointer to the parsed DebugAbbrev object.
Stores all information relating to a compile unit, be it in its original instance in the object file ...
uint8_t getCUAddrSize()
Get address size from CUs.
compile_unit_range dwo_compile_units()
Get compile units in the DWO context.
A format-neutral container for source line information.
function_ref< void(Error)> getWarningHandler()
static bool isAddressSizeSupported(unsigned AddressSize)
DWARFUnit * getUnitAtIndex(unsigned index)
Get the unit at the specified index.
print Print MemDeps of function
const DWARFUnitIndex & getTUIndex()
DIEsForAddress getDIEsForAddress(uint64_t Address)
Get the compilation unit, the function DIE and lexical block DIE for the given address where applicab...
DWARFGdbIndex & getGdbIndex()
std::shared_ptr< DWARFContext > getDWOContext(StringRef AbsolutePath)
Expected< const DWARFDebugFrame * > getDebugFrame()
Get a pointer to the parsed frame information object.
bool isLittleEndian() const
const DWARFDebugLoc * getDebugLoc()
Get a pointer to the parsed DebugLoc object.
StringRef - Represent a constant reference to a string, i.e.
This class is the base class for all object file types.
decltype(make_filter_range(std::declval< iterator_range >(), isCompileUnit)) compile_unit_range
unit_iterator_range normal_units()
Get all normal compile/type units in this context.
DataExtractor getLineStringExtractor() const
This implements the Apple accelerator table format, a precursor of the DWARF 5 accelerator table form...
unsigned getNumDWOCompileUnits()
Get the number of compile units in the DWO context.
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
iterator_range< filter_iterator< detail::IterOfRange< RangeT >, PredicateT > > make_filter_range(RangeT &&Range, PredicateT Pred)
Convenience function that takes a range of elements and a predicate, and return a new filter_iterator...
DWARFDie getDIEForOffset(uint64_t Offset)
Get a DIE given an exact offset.
const DWARFUnitIndex & getCUIndex()
DILineInfo getLineInfoForAddress(object::SectionedAddress Address, DILineInfoSpecifier Specifier=DILineInfoSpecifier()) override
void setMaxVersionIfGreater(unsigned Version)
DWARFUnit * getDWOUnitAtIndex(unsigned index)
Get the unit at the specified index for the DWO units.
const MCRegisterInfo * getRegisterInfo() const
Lightweight error class with error context and mandatory checking.
DWARFCompileUnit * getCompileUnitForOffset(uint64_t Offset)
Return the compile unit that includes an offset (relative to .debug_info).
function_ref< void(Error)> getRecoverableErrorHandler()
An inferface for inquiring the load address of a loaded object file to be used by the DIContext imple...
static bool classof(const DIContext *DICtx)
static const bool IsLittleEndianHost
const DWARFObject & getDWARFObj() const
A range adaptor for a pair of iterators.
bool isCompileUnit(const std::unique_ptr< DWARFUnit > &U)
DWARFCompileUnit * getCompileUnitForAddress(uint64_t Address)
Return the compile unit which contains instruction with provided address.
llvm::iterator_range< typename UnitVector::iterator > iterator_range
Utility class that carries the DWARF compile/type unit and the debug info entry in an object.
.debug_names section consists of one or more units.
DWARFContext(std::unique_ptr< const DWARFObject > DObj, std::string DWPName="", std::function< void(Error)> RecoverableErrorHandler=WithColor::defaultErrorHandler, std::function< void(Error)> WarningHandler=WithColor::defaultWarningHandler)
Wraps the returned DIEs for a given address.
static bool isSupportedVersion(unsigned version)
const AppleAcceleratorTable & getAppleTypes()
Get a reference to the parsed accelerator table object.
void dump(raw_ostream &OS, DIDumpOptions DumpOpts, std::array< Optional< uint64_t >, DIDT_ID_Count > DumpOffsets)
Dump a textual representation to OS.
const AppleAcceleratorTable & getAppleNamespaces()
Get a reference to the parsed accelerator table object.
Instrumentation for Order File
Error loadRegisterInfo(const object::ObjectFile &Obj)
Loads register info for the architecture of the provided object file.
SectionType
These are the section type and attributes fields.
DIContextKind getKind() const
Container for dump options that control which debug information will be dumped.
Describe a collection of units.