LLVM  6.0.0svn
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
llvm::DWARFContext Class Reference

DWARFContext This data structure is the top level entity that deals with dwarf debug information parsing. More...

#include "llvm/DebugInfo/DWARF/DWARFContext.h"

Inheritance diagram for llvm::DWARFContext:
Inheritance graph
[legend]
Collaboration diagram for llvm::DWARFContext:
Collaboration graph
[legend]

Public Types

using cu_iterator_range = DWARFUnitSection< DWARFCompileUnit >::iterator_range
 
using tu_iterator_range = DWARFUnitSection< DWARFTypeUnit >::iterator_range
 
using tu_section_iterator_range = iterator_range< decltype(TUs)::iterator >
 
- Public Types inherited from llvm::DIContext
enum  DIContextKind { CK_DWARF, CK_PDB }
 

Public Member Functions

 DWARFContext (std::unique_ptr< const DWARFObject > DObj, std::string DWPName="")
 
 ~DWARFContext ()
 
 DWARFContext (DWARFContext &)=delete
 
DWARFContextoperator= (DWARFContext &)=delete
 
const DWARFObjectgetDWARFObj () const
 
void dump (raw_ostream &OS, DIDumpOptions DumpOpts, std::array< Optional< uint64_t >, DIDT_ID_Count > DumpOffsets)
 Dump a textual representation to OS. More...
 
void dump (raw_ostream &OS, DIDumpOptions DumpOpts) override
 
bool verify (raw_ostream &OS, DIDumpOptions DumpOpts={}) override
 
cu_iterator_range compile_units ()
 Get compile units in this context. More...
 
tu_section_iterator_range type_unit_sections ()
 Get type units in this context. More...
 
cu_iterator_range dwo_compile_units ()
 Get compile units in the DWO context. More...
 
tu_section_iterator_range dwo_type_unit_sections ()
 Get type units in the DWO context. More...
 
unsigned getNumCompileUnits ()
 Get the number of compile units in this context. More...
 
unsigned getNumTypeUnits ()
 Get the number of compile units in this context. More...
 
unsigned getNumDWOCompileUnits ()
 Get the number of compile units in the DWO context. More...
 
unsigned getNumDWOTypeUnits ()
 Get the number of compile units in the DWO context. More...
 
DWARFCompileUnitgetCompileUnitAtIndex (unsigned index)
 Get the compile unit at the specified index for this compile unit. More...
 
DWARFCompileUnitgetDWOCompileUnitAtIndex (unsigned index)
 Get the compile unit at the specified index for the DWO compile units. More...
 
DWARFCompileUnitgetDWOCompileUnitForHash (uint64_t Hash)
 
DWARFDie getDIEForOffset (uint32_t Offset)
 Get a DIE given an exact offset. More...
 
unsigned getMaxVersion () const
 
void setMaxVersionIfGreater (unsigned Version)
 
const DWARFUnitIndexgetCUIndex ()
 
DWARFGdbIndexgetGdbIndex ()
 
const DWARFUnitIndexgetTUIndex ()
 
const DWARFDebugAbbrevgetDebugAbbrev ()
 Get a pointer to the parsed DebugAbbrev object. More...
 
const DWARFDebugLocgetDebugLoc ()
 Get a pointer to the parsed DebugLoc object. More...
 
const DWARFDebugAbbrevgetDebugAbbrevDWO ()
 Get a pointer to the parsed dwo abbreviations object. More...
 
const DWARFDebugLocDWOgetDebugLocDWO ()
 Get a pointer to the parsed DebugLoc object. More...
 
const DWARFDebugArangesgetDebugAranges ()
 Get a pointer to the parsed DebugAranges object. More...
 
const DWARFDebugFramegetDebugFrame ()
 Get a pointer to the parsed frame information object. More...
 
const DWARFDebugFramegetEHFrame ()
 Get a pointer to the parsed eh frame information object. More...
 
const DWARFDebugMacrogetDebugMacro ()
 Get a pointer to the parsed DebugMacro object. More...
 
const DWARFAcceleratorTablegetAppleNames ()
 Get a reference to the parsed accelerator table object. More...
 
const DWARFAcceleratorTablegetAppleTypes ()
 Get a reference to the parsed accelerator table object. More...
 
const DWARFAcceleratorTablegetAppleNamespaces ()
 Get a reference to the parsed accelerator table object. More...
 
const DWARFAcceleratorTablegetAppleObjC ()
 Get a reference to the parsed accelerator table object. More...
 
const DWARFDebugLine::LineTablegetLineTableForUnit (DWARFUnit *cu)
 Get a pointer to a parsed line table corresponding to a compile unit. More...
 
DILineInfo getLineInfoForAddress (uint64_t Address, DILineInfoSpecifier Specifier=DILineInfoSpecifier()) override
 
DILineInfoTable getLineInfoForAddressRange (uint64_t Address, uint64_t Size, DILineInfoSpecifier Specifier=DILineInfoSpecifier()) override
 
DIInliningInfo getInliningInfoForAddress (uint64_t Address, DILineInfoSpecifier Specifier=DILineInfoSpecifier()) override
 
bool isLittleEndian () const
 
std::shared_ptr< DWARFContextgetDWOContext (StringRef AbsolutePath)
 
const MCRegisterInfogetRegisterInfo () const
 
Error loadRegisterInfo (const object::ObjectFile &Obj)
 Loads register info for the architecture of the provided object file. More...
 
- Public Member Functions inherited from llvm::DIContext
 DIContext (DIContextKind K)
 
virtual ~DIContext ()=default
 
DIContextKind getKind () const
 

Static Public Member Functions

static bool classof (const DIContext *DICtx)
 
static bool isSupportedVersion (unsigned version)
 
static ErrorPolicy defaultErrorHandler (Error E)
 Function used to handle default error reporting policy. More...
 
static std::unique_ptr< DWARFContextcreate (const object::ObjectFile &Obj, const LoadedObjectInfo *L=nullptr, function_ref< ErrorPolicy(Error)> HandleError=defaultErrorHandler, std::string DWPName="")
 
static std::unique_ptr< DWARFContextcreate (const StringMap< std::unique_ptr< MemoryBuffer >> &Sections, uint8_t AddrSize, bool isLittleEndian=sys::IsLittleEndianHost)
 

Protected Attributes

std::unique_ptr< const DWARFObjectDObj
 

Detailed Description

DWARFContext This data structure is the top level entity that deals with dwarf debug information parsing.

The actual data is supplied through DWARFObj.

Definition at line 59 of file DWARFContext.h.

Member Typedef Documentation

◆ cu_iterator_range

Definition at line 141 of file DWARFContext.h.

◆ tu_iterator_range

Definition at line 142 of file DWARFContext.h.

◆ tu_section_iterator_range

Definition at line 143 of file DWARFContext.h.

Constructor & Destructor Documentation

◆ DWARFContext() [1/2]

DWARFContext::DWARFContext ( std::unique_ptr< const DWARFObject DObj,
std::string  DWPName = "" 
)

Definition at line 65 of file DWARFContext.cpp.

References ~DWARFContext().

◆ ~DWARFContext()

DWARFContext::~DWARFContext ( )
default

Referenced by DWARFContext().

◆ DWARFContext() [2/2]

llvm::DWARFContext::DWARFContext ( DWARFContext )
delete

Member Function Documentation

◆ classof()

static bool llvm::DWARFContext::classof ( const DIContext DICtx)
inlinestatic

Definition at line 125 of file DWARFContext.h.

References llvm::DIDT_ID_Count, llvm::dump(), and llvm::DIContext::getKind().

◆ compile_units()

cu_iterator_range llvm::DWARFContext::compile_units ( )
inline

Get compile units in this context.

Definition at line 146 of file DWARFContext.h.

References llvm::SmallVectorTemplateCommon< T >::begin(), and llvm::SmallVectorTemplateCommon< T >::end().

Referenced by dump(), and llvm::DWARFDebugAranges::generate().

◆ create() [1/2]

std::unique_ptr< DWARFContext > DWARFContext::create ( const object::ObjectFile Obj,
const LoadedObjectInfo L = nullptr,
function_ref< ErrorPolicy(Error)>  HandleError = defaultErrorHandler,
std::string  DWPName = "" 
)
static

Definition at line 1379 of file DWARFContext.cpp.

References DObj.

Referenced by llvm::symbolize::LLVMSymbolizer::flush(), and getDWOContext().

◆ create() [2/2]

std::unique_ptr< DWARFContext > DWARFContext::create ( const StringMap< std::unique_ptr< MemoryBuffer >> &  Sections,
uint8_t  AddrSize,
bool  isLittleEndian = sys::IsLittleEndianHost 
)
static

Definition at line 1387 of file DWARFContext.cpp.

References DObj, and isLittleEndian().

◆ defaultErrorHandler()

ErrorPolicy DWARFContext::defaultErrorHandler ( Error  E)
static

◆ dump() [1/2]

void DWARFContext::dump ( raw_ostream OS,
DIDumpOptions  DumpOpts,
std::array< Optional< uint64_t >, DIDT_ID_Count DumpOffsets 
)

◆ dump() [2/2]

void llvm::DWARFContext::dump ( raw_ostream OS,
DIDumpOptions  DumpOpts 
)
inlineoverridevirtual

Implements llvm::DIContext.

Definition at line 134 of file DWARFContext.h.

References llvm::DIDT_ID_Count, llvm::dump(), and llvm::verify().

◆ dwo_compile_units()

cu_iterator_range llvm::DWARFContext::dwo_compile_units ( )
inline

Get compile units in the DWO context.

Definition at line 158 of file DWARFContext.h.

References llvm::SmallVectorTemplateCommon< T >::begin(), and llvm::SmallVectorTemplateCommon< T >::end().

Referenced by dump(), and getDWOCompileUnitForHash().

◆ dwo_type_unit_sections()

tu_section_iterator_range llvm::DWARFContext::dwo_type_unit_sections ( )
inline

Get type units in the DWO context.

Definition at line 164 of file DWARFContext.h.

Referenced by dump().

◆ getAppleNames()

const DWARFAcceleratorTable & DWARFContext::getAppleNames ( )

Get a reference to the parsed accelerator table object.

Definition at line 639 of file DWARFContext.cpp.

References DObj, getAccelTable(), and isLittleEndian().

Referenced by dump().

◆ getAppleNamespaces()

const DWARFAcceleratorTable & DWARFContext::getAppleNamespaces ( )

Get a reference to the parsed accelerator table object.

Definition at line 649 of file DWARFContext.cpp.

References DObj, getAccelTable(), and isLittleEndian().

Referenced by dump().

◆ getAppleObjC()

const DWARFAcceleratorTable & DWARFContext::getAppleObjC ( )

Get a reference to the parsed accelerator table object.

Definition at line 655 of file DWARFContext.cpp.

References DObj, getAccelTable(), and isLittleEndian().

Referenced by dump().

◆ getAppleTypes()

const DWARFAcceleratorTable & DWARFContext::getAppleTypes ( )

Get a reference to the parsed accelerator table object.

Definition at line 644 of file DWARFContext.cpp.

References DObj, getAccelTable(), and isLittleEndian().

Referenced by dump().

◆ getCompileUnitAtIndex()

DWARFCompileUnit* llvm::DWARFContext::getCompileUnitAtIndex ( unsigned  index)
inline

Get the compile unit at the specified index for this compile unit.

Definition at line 194 of file DWARFContext.h.

Referenced by getDebugLoc().

◆ getCUIndex()

const DWARFUnitIndex & DWARFContext::getCUIndex ( )

Definition at line 499 of file DWARFContext.cpp.

References DObj, llvm::DW_SECT_INFO, and isLittleEndian().

Referenced by dump(), llvm::getDWARFUnitIndex(), and getDWOCompileUnitForHash().

◆ getDebugAbbrev()

const DWARFDebugAbbrev * DWARFContext::getDebugAbbrev ( )

Get a pointer to the parsed DebugAbbrev object.

Definition at line 531 of file DWARFContext.cpp.

References DObj, and isLittleEndian().

Referenced by dump(), and llvm::DWARFUnitSectionBase::parse().

◆ getDebugAbbrevDWO()

const DWARFDebugAbbrev * DWARFContext::getDebugAbbrevDWO ( )

Get a pointer to the parsed dwo abbreviations object.

Definition at line 542 of file DWARFContext.cpp.

References DObj, and isLittleEndian().

Referenced by dump(), and llvm::DWARFUnitSectionBase::parseDWO().

◆ getDebugAranges()

const DWARFDebugAranges * DWARFContext::getDebugAranges ( )

Get a pointer to the parsed DebugAranges object.

Definition at line 576 of file DWARFContext.cpp.

Referenced by getLineTableForUnit().

◆ getDebugFrame()

const DWARFDebugFrame * DWARFContext::getDebugFrame ( )

Get a pointer to the parsed frame information object.

Definition at line 585 of file DWARFContext.cpp.

References DObj, and isLittleEndian().

Referenced by dump().

◆ getDebugLoc()

const DWARFDebugLoc * DWARFContext::getDebugLoc ( )

Get a pointer to the parsed DebugLoc object.

Definition at line 552 of file DWARFContext.cpp.

References DObj, llvm::DWARFUnit::getAddressByteSize(), getCompileUnitAtIndex(), getNumCompileUnits(), and isLittleEndian().

Referenced by dump().

◆ getDebugLocDWO()

const DWARFDebugLocDWO * DWARFContext::getDebugLocDWO ( )

Get a pointer to the parsed DebugLoc object.

Definition at line 566 of file DWARFContext.cpp.

References DObj, and isLittleEndian().

Referenced by dump().

◆ getDebugMacro()

const DWARFDebugMacro * DWARFContext::getDebugMacro ( )

Get a pointer to the parsed DebugMacro object.

Definition at line 616 of file DWARFContext.cpp.

References DObj, and isLittleEndian().

Referenced by dump().

◆ getDIEForOffset()

DWARFDie DWARFContext::getDIEForOffset ( uint32_t  Offset)

Get a DIE given an exact offset.

Definition at line 479 of file DWARFContext.cpp.

Referenced by dump().

◆ getDWARFObj()

const DWARFObject& llvm::DWARFContext::getDWARFObj ( ) const
inline

◆ getDWOCompileUnitAtIndex()

DWARFCompileUnit* llvm::DWARFContext::getDWOCompileUnitAtIndex ( unsigned  index)
inline

Get the compile unit at the specified index for the DWO compile units.

Definition at line 200 of file DWARFContext.h.

◆ getDWOCompileUnitForHash()

DWARFCompileUnit * DWARFContext::getDWOCompileUnitForHash ( uint64_t  Hash)

Definition at line 460 of file DWARFContext.cpp.

References DObj, dwo_compile_units(), and getCUIndex().

◆ getDWOContext()

std::shared_ptr< DWARFContext > DWARFContext::getDWOContext ( StringRef  AbsolutePath)

◆ getEHFrame()

const DWARFDebugFrame * DWARFContext::getEHFrame ( )

Get a pointer to the parsed eh frame information object.

Definition at line 605 of file DWARFContext.cpp.

References DObj, and isLittleEndian().

Referenced by dump().

◆ getGdbIndex()

DWARFGdbIndex & DWARFContext::getGdbIndex ( )

Definition at line 521 of file DWARFContext.cpp.

References DObj.

Referenced by dump().

◆ getInliningInfoForAddress()

DIInliningInfo DWARFContext::getInliningInfoForAddress ( uint64_t  Address,
DILineInfoSpecifier  Specifier = DILineInfoSpecifier() 
)
overridevirtual

◆ getLineInfoForAddress()

DILineInfo DWARFContext::getLineInfoForAddress ( uint64_t  Address,
DILineInfoSpecifier  Specifier = DILineInfoSpecifier() 
)
overridevirtual

◆ getLineInfoForAddressRange()

DILineInfoTable DWARFContext::getLineInfoForAddressRange ( uint64_t  Address,
uint64_t  Size,
DILineInfoSpecifier  Specifier = DILineInfoSpecifier() 
)
overridevirtual

◆ getLineTableForUnit()

const DWARFLineTable * DWARFContext::getLineTableForUnit ( DWARFUnit cu)

◆ getMaxVersion()

unsigned llvm::DWARFContext::getMaxVersion ( ) const
inline

Definition at line 210 of file DWARFContext.h.

Referenced by dump().

◆ getNumCompileUnits()

unsigned llvm::DWARFContext::getNumCompileUnits ( )
inline

Get the number of compile units in this context.

Definition at line 170 of file DWARFContext.h.

References llvm::SmallVectorTemplateCommon< T >::size().

Referenced by getDebugLoc().

◆ getNumDWOCompileUnits()

unsigned llvm::DWARFContext::getNumDWOCompileUnits ( )
inline

Get the number of compile units in the DWO context.

Definition at line 182 of file DWARFContext.h.

References llvm::SmallVectorTemplateCommon< T >::size().

◆ getNumDWOTypeUnits()

unsigned llvm::DWARFContext::getNumDWOTypeUnits ( )
inline

Get the number of compile units in the DWO context.

Definition at line 188 of file DWARFContext.h.

Referenced by dump().

◆ getNumTypeUnits()

unsigned llvm::DWARFContext::getNumTypeUnits ( )
inline

Get the number of compile units in this context.

Definition at line 176 of file DWARFContext.h.

Referenced by dump().

◆ getRegisterInfo()

const MCRegisterInfo* llvm::DWARFContext::getRegisterInfo ( ) const
inline

Definition at line 274 of file DWARFContext.h.

References E, llvm::MCRegisterInfo::get(), and llvm::sys::IsLittleEndianHost.

Referenced by dump(), and dumpLocation().

◆ getTUIndex()

const DWARFUnitIndex & DWARFContext::getTUIndex ( )

Definition at line 510 of file DWARFContext.cpp.

References DObj, llvm::DW_SECT_TYPES, and isLittleEndian().

Referenced by dump(), and llvm::getDWARFUnitIndex().

◆ isLittleEndian()

bool llvm::DWARFContext::isLittleEndian ( ) const
inline

◆ isSupportedVersion()

static bool llvm::DWARFContext::isSupportedVersion ( unsigned  version)
inlinestatic

◆ loadRegisterInfo()

Error DWARFContext::loadRegisterInfo ( const object::ObjectFile Obj)

Loads register info for the architecture of the provided object file.

Improves readability of dumped DWARF expressions. Requires the caller to have initialized the relevant target descriptions.

Definition at line 1394 of file DWARFContext.cpp.

References llvm::Target::createMCRegInfo(), llvm::object::ObjectFile::getArch(), llvm::inconvertibleErrorCode(), llvm::TargetRegistry::lookupTarget(), llvm::Triple::setArch(), llvm::Triple::setOS(), llvm::Triple::setVendor(), llvm::Triple::str(), llvm::Error::success(), llvm::Triple::UnknownOS, and llvm::Triple::UnknownVendor.

◆ operator=()

DWARFContext& llvm::DWARFContext::operator= ( DWARFContext )
delete

◆ setMaxVersionIfGreater()

void llvm::DWARFContext::setMaxVersionIfGreater ( unsigned  Version)
inline

◆ type_unit_sections()

tu_section_iterator_range llvm::DWARFContext::type_unit_sections ( )
inline

Get type units in this context.

Definition at line 152 of file DWARFContext.h.

Referenced by dump().

◆ verify()

bool DWARFContext::verify ( raw_ostream OS,
DIDumpOptions  DumpOpts = {} 
)
overridevirtual

Member Data Documentation

◆ DObj

std::unique_ptr<const DWARFObject> llvm::DWARFContext::DObj
protected

The documentation for this class was generated from the following files: