LLVM
8.0.1
|
#include "llvm/DebugInfo/DWARF/DWARFUnit.h"
Static Public Member Functions | |
static bool | isMatchingUnitTypeAndTag (uint8_t UnitType, dwarf::Tag Tag) |
static uint32_t | getDWARF5HeaderSize (uint8_t UnitType) |
Return the number of bytes for the header of a unit of UnitType type. More... | |
Protected Member Functions | |
const DWARFUnitHeader & | getHeader () const |
uint32_t | getHeaderSize () const |
Size in bytes of the parsed unit header. More... | |
Optional< StrOffsetsContributionDescriptor > | determineStringOffsetsTableContribution (DWARFDataExtractor &DA) |
Find the unit's contribution to the string offsets table and determine its length and form. More... | |
Optional< StrOffsetsContributionDescriptor > | determineStringOffsetsTableContributionDWO (DWARFDataExtractor &DA) |
Find the unit's contribution to the string offsets table and determine its length and form. More... | |
Definition at line 189 of file DWARFUnit.h.
DWARFUnit::DWARFUnit | ( | DWARFContext & | Context, |
const DWARFSection & | Section, | ||
const DWARFUnitHeader & | Header, | ||
const DWARFDebugAbbrev * | DA, | ||
const DWARFSection * | RS, | ||
const DWARFSection * | LocSection, | ||
StringRef | SS, | ||
const DWARFSection & | SOS, | ||
const DWARFSection * | AOS, | ||
const DWARFSection & | LS, | ||
bool | LE, | ||
bool | IsDWO, | ||
const DWARFUnitVector & | UnitVector | ||
) |
Definition at line 172 of file DWARFUnit.cpp.
References C, clear(), llvm::DWARFSection::Data, llvm::DW_SECT_LOC, llvm::DWARFUnitHeader::getIndexEntry(), LocSectionData, llvm::StringRef::substr(), and ~DWARFUnit().
|
virtualdefault |
Referenced by DWARFUnit().
void DWARFUnit::clear | ( | ) |
Definition at line 333 of file DWARFUnit.cpp.
Referenced by DWARFUnit().
Expected< DWARFAddressRangesVector > DWARFUnit::collectAddressRanges | ( | ) |
Definition at line 569 of file DWARFUnit.cpp.
References llvm::c_str(), llvm::createStringError(), llvm::DWARFDie::getAddressRanges(), getUnitDIE(), llvm::invalid_argument, and llvm::toString().
|
protected |
Find the unit's contribution to the string offsets table and determine its length and form.
The given offset is expected to be derived from the unit DIE's DW_AT_str_offsets_base attribute.
Definition at line 807 of file DWARFUnit.cpp.
References llvm::find(), getUnitDIE(), parseDWARF32StringOffsetsTableHeader(), parseDWARF64StringOffsetsTableHeader(), llvm::dwarf::toSectionOffset(), and llvm::StrOffsetsContributionDescriptor::validateContributionSize().
Referenced by getCompilationDir().
|
protected |
Find the unit's contribution to the string offsets table and determine its length and form.
The given offset is expected to be 0 in a dwo file or, in a dwp file, the start of the unit's contribution to the string offsets table section (as determined by the index table).
Definition at line 821 of file DWARFUnit.cpp.
References C, llvm::DWARFSection::Data, llvm::DW_SECT_STR_OFFSETS, llvm::dwarf::DWARF32, llvm::DWARFUnitHeader::getIndexEntry(), getVersion(), llvm::None, parseDWARF32StringOffsetsTableHeader(), parseDWARF64StringOffsetsTableHeader(), and llvm::StringRef::size().
Referenced by getCompilationDir().
|
inline |
Definition at line 482 of file DWARFUnit.h.
References llvm::dump(), and llvm::DWARFUnitHeader::getLength().
|
pure virtual |
Implemented in llvm::DWARFTypeUnit, and llvm::DWARFCompileUnit.
Error DWARFUnit::extractRangeList | ( | uint32_t | RangeListOffset, |
DWARFDebugRangeList & | RangeList | ||
) | const |
Extract the range list referenced by this compile unit from the .debug_ranges section.
If the extraction is unsuccessful, an error is returned. Successful extraction requires that the compile unit has already been extracted.
Definition at line 323 of file DWARFUnit.cpp.
References assert(), llvm::DWARFDebugRangeList::extract(), getAddressByteSize(), and llvm::DWARFContext::getDWARFObj().
Referenced by findRnglistFromOffset().
Expected< DWARFAddressRangesVector > DWARFUnit::findRnglistFromIndex | ( | uint32_t | Index | ) |
Return a vector of address ranges retrieved from an encoded range list whose offset is found via a table lookup given an index (DWARF v5 and later).
Definition at line 557 of file DWARFUnit.cpp.
References llvm::createStringError(), findRnglistFromOffset(), getRnglistOffset(), and llvm::invalid_argument.
Expected< DWARFAddressRangesVector > DWARFUnit::findRnglistFromOffset | ( | uint32_t | Offset | ) |
Return a vector of address ranges resulting from a (possibly encoded) range list starting at a given offset in the appropriate ranges section.
Definition at line 536 of file DWARFUnit.cpp.
References llvm::createStringError(), E, extractRangeList(), llvm::DWARFDebugRangeList::getAbsoluteRanges(), getBaseAddress(), llvm::DWARFContext::getDWARFObj(), getVersion(), and llvm::invalid_argument.
Referenced by findRnglistFromIndex().
const DWARFAbbreviationDeclarationSet * DWARFUnit::getAbbreviations | ( | ) | const |
Definition at line 742 of file DWARFUnit.cpp.
References llvm::DWARFDebugAbbrev::getAbbreviationDeclarationSet(), and llvm::DWARFUnitHeader::getAbbrOffset().
Referenced by llvm::DWARFCompileUnit::dump(), llvm::DWARFTypeUnit::dump(), and llvm::DWARFDebugInfoEntry::extractFast().
|
inline |
Definition at line 280 of file DWARFUnit.h.
References llvm::DWARFUnitHeader::getAddressByteSize().
Referenced by llvm::DWARFCompileUnit::dump(), llvm::DWARFTypeUnit::dump(), dumpAttribute(), dumpLocation(), llvm::DWARFUnitHeader::extract(), extractRangeList(), getAddrOffsetSectionItem(), llvm::DWARFAbbreviationDeclaration::getAttributeValue(), getDebugInfoExtractor(), llvm::DWARFContext::getDebugLoc(), llvm::DWARFContext::getLineTableForUnit(), llvm::DWARFVerifier::handleDebugInfo(), and isVariableIndexable().
Optional< SectionedAddress > DWARFUnit::getAddrOffsetSectionItem | ( | uint32_t | Index | ) | const |
Definition at line 202 of file DWARFUnit.cpp.
References llvm::Address, llvm::DWARFSection::Data, getAddressByteSize(), llvm::DWARFContext::getDWARFObj(), I, llvm::DWARFContext::info_section_units(), llvm::None, llvm::ARMBuildAttrs::Section, and llvm::StringRef::size().
Referenced by llvm::DWARFDebugRnglist::getAbsoluteRanges().
llvm::Optional< SectionedAddress > DWARFUnit::getBaseAddress | ( | ) |
Definition at line 748 of file DWARFUnit.cpp.
References llvm::DWARFDie::find(), getUnitDIE(), and llvm::dwarf::toSectionedAddress().
Referenced by dumpLocation(), and findRnglistFromOffset().
Definition at line 342 of file DWARFUnit.cpp.
References llvm::sys::path::append(), assert(), llvm::DWARFSection::Data, llvm::Depth, determineStringOffsetsTableContribution(), determineStringOffsetsTableContributionDWO(), llvm::WithColor::error(), llvm::DWARFDebugInfoEntry::extractFast(), llvm::DWARFDie::find(), llvm::find(), llvm::format(), llvm::DWARFDebugInfoEntry::getAbbreviationDeclarationPtr(), getDebugInfoExtractor(), llvm::DWARFContext::getDWARFObj(), llvm::DWARFContext::getDWOContext(), getDWOId(), getHeaderSize(), getNextUnitOffset(), getOffset(), llvm::DWARFDie::getRangesBaseAttribute(), llvm::DWARFObject::getRnglistsDWOSection(), llvm::DWARFObject::getRnglistsSection(), getUnitDIE(), getVersion(), llvm::sys::path::is_relative(), parseRngListTableHeader(), llvm::DWARFUnitHeader::setDWOId(), setRangesSection(), llvm::StringRef::size(), llvm::dwarf::toSectionOffset(), llvm::dwarf::toString(), llvm::toString(), llvm::dwarf::toUnsigned(), and llvm::WithColor::warning().
Referenced by dumpAttribute(), llvm::DWARFContext::getInliningInfoForAddress(), llvm::DWARFContext::getLineInfoForAddress(), and llvm::DWARFContext::getLineInfoForAddressRange().
|
inline |
Definition at line 271 of file DWARFUnit.h.
References Context.
Referenced by dumpAttribute(), dumpLocation(), and llvm::DWARFFormValue::extractValue().
DWARFDataExtractor DWARFUnit::getDebugInfoExtractor | ( | ) | const |
Definition at line 196 of file DWARFUnit.cpp.
References getAddressByteSize(), and llvm::DWARFContext::getDWARFObj().
Referenced by dumpAttribute(), llvm::DWARFDebugInfoEntry::extractFast(), llvm::DWARFAbbreviationDeclaration::getAttributeValue(), and getCompilationDir().
Return the DIE object at the given index.
Definition at line 447 of file DWARFUnit.h.
References assert(), and getParent().
Return the DIE object for a given offset inside the unit's DIE vector.
The unit needs to have its DIEs extracted for this method to work.
Definition at line 462 of file DWARFUnit.h.
References assert(), and llvm::lower_bound().
Referenced by llvm::DWARFTypeUnit::dump().
Return the index of a DIE inside the unit's DIE vector.
It is illegal to call this method with a DIE that hasn't be created by this unit. In other word, it's illegal to call this method on a DIE that isn't accessible by following children/sibling links starting from this unit's getUnitDIE().
Definition at line 442 of file DWARFUnit.h.
References llvm::DWARFDie::getDebugInfoEntry().
|
inlinestatic |
Return the number of bytes for the header of a unit of UnitType type.
This function must be called with a valid unit type which in DWARF5 is defined as one of the following six types.
Definition at line 364 of file DWARFUnit.h.
References llvm_unreachable.
|
inline |
Definition at line 282 of file DWARFUnit.h.
References llvm::DWARFUnitHeader::getDwarfOffsetByteSize().
Referenced by llvm::DWARFAbbreviationDeclaration::getAttributeValue(), and llvm::StrOffsetsContributionDescriptor::validateContributionSize().
|
inline |
Definition at line 330 of file DWARFUnit.h.
References assert().
Referenced by getStringOffsetSectionItem().
|
inline |
Definition at line 389 of file DWARFUnit.h.
Referenced by llvm::DWARFCompileUnit::dump(), and getCompilationDir().
DWARFDie DWARFUnit::getFirstChild | ( | const DWARFDebugInfoEntry * | Die | ) |
Definition at line 716 of file DWARFUnit.cpp.
References llvm::DWARFDebugInfoEntry::hasChildren(), and I.
|
inline |
Definition at line 276 of file DWARFUnit.h.
References llvm::DWARFUnitHeader::getFormParams().
Referenced by dumpAttribute(), llvm::DWARFDebugInfoEntry::extractFast(), llvm::DWARFAbbreviationDeclaration::getAttributeValue(), and llvm::DWARFAbbreviationDeclaration::AttributeSpec::getByteSize().
|
inlineprotected |
Definition at line 242 of file DWARFUnit.h.
Referenced by llvm::DWARFTypeUnit::getTypeHash(), and llvm::DWARFTypeUnit::getTypeOffset().
|
inlineprotected |
Size in bytes of the parsed unit header.
Definition at line 245 of file DWARFUnit.h.
References llvm::DWARFUnitHeader::getSize(), llvm::AArch64CC::LE, llvm::AArch64CC::LS, and llvm::ARMBuildAttrs::Section.
Referenced by getCompilationDir().
|
inline |
Definition at line 272 of file DWARFUnit.h.
void DWARFUnit::getInlinedChainForAddress | ( | uint64_t | Address, |
SmallVectorImpl< DWARFDie > & | InlinedChain | ||
) |
getInlinedChainForAddress - fetches inlined chain for a given address.
Returns empty chain if there is no subprogram containing address. The chain is valid as long as parsed compile unit DIEs are not cleared.
Definition at line 629 of file DWARFUnit.cpp.
References assert(), llvm::SmallVectorBase::empty(), llvm::DWARFDie::getParent(), getSubroutineForAddress(), llvm::DWARFDie::getTag(), llvm::DWARFDie::isSubprogramDIE(), and llvm::SmallVectorTemplateBase< T >::push_back().
Referenced by getFunctionNameAndStartLineForAddress(), and llvm::DWARFContext::getInliningInfoForAddress().
DWARFDie DWARFUnit::getLastChild | ( | const DWARFDebugInfoEntry * | Die | ) |
Definition at line 727 of file DWARFUnit.cpp.
References assert(), llvm::Depth, llvm::DWARFDebugInfoEntry::getDepth(), llvm::DWARFDebugInfoEntry::hasChildren(), and I.
|
inline |
Definition at line 285 of file DWARFUnit.h.
References llvm::DWARFUnitHeader::getLength().
Referenced by llvm::DWARFCompileUnit::dump(), llvm::DWARFTypeUnit::dump(), and llvm::DWARFUnitHeader::extract().
|
inline |
Definition at line 289 of file DWARFUnit.h.
Referenced by llvm::DWARFContext::getLineTableForUnit().
|
inline |
Definition at line 475 of file DWARFUnit.h.
References llvm::DW_SECT_LINE, and llvm::DWARFUnitHeader::getIndexEntry().
Referenced by llvm::DWARFContext::getLineTableForUnit().
|
inline |
Definition at line 273 of file DWARFUnit.h.
Referenced by dumpLocation().
|
inline |
Definition at line 274 of file DWARFUnit.h.
Referenced by dumpLocation().
|
inline |
Definition at line 288 of file DWARFUnit.h.
References llvm::DWARFUnitHeader::getNextUnitOffset().
Referenced by llvm::DWARFCompileUnit::dump(), llvm::DWARFTypeUnit::dump(), llvm::DWARFUnitHeader::extract(), llvm::DWARFDebugInfoEntry::extractFast(), and getCompilationDir().
|
inline |
Returns the number of DIEs in the unit.
Parses the unit if necessary.
Definition at line 431 of file DWARFUnit.h.
|
inline |
Definition at line 275 of file DWARFUnit.h.
References llvm::DWARFUnitHeader::getOffset().
Referenced by llvm::DWARFCompileUnit::dump(), llvm::DWARFTypeUnit::dump(), getCompilationDir(), getNames(), and isVariableIndexable().
DWARFDie DWARFUnit::getParent | ( | const DWARFDebugInfoEntry * | Die | ) |
Definition at line 658 of file DWARFUnit.cpp.
References llvm::Depth, llvm::DWARFDebugInfoEntry::getDepth(), getUnitDIE(), and I.
DWARFDie DWARFUnit::getPreviousSibling | ( | const DWARFDebugInfoEntry * | Die | ) |
Definition at line 697 of file DWARFUnit.cpp.
References llvm::Depth, llvm::DWARFDebugInfoEntry::getDepth(), and I.
|
inline |
Definition at line 281 of file DWARFUnit.h.
References llvm::DWARFUnitHeader::getRefAddrByteSize().
Referenced by llvm::DWARFAbbreviationDeclaration::getAttributeValue().
Return a rangelist's offset based on an index.
The index designates an entry in the rangelist table's offset array and is supplied by DW_FORM_rnglistx.
Definition at line 407 of file DWARFUnit.h.
References llvm::Address, and llvm::None.
Referenced by dumpAttribute(), and findRnglistFromIndex().
DWARFDie DWARFUnit::getSibling | ( | const DWARFDebugInfoEntry * | Die | ) |
Definition at line 677 of file DWARFUnit.cpp.
References llvm::Depth, llvm::DWARFDebugInfoEntry::getAbbreviationDeclarationPtr(), llvm::DWARFDebugInfoEntry::getDepth(), and I.
|
inline |
Definition at line 313 of file DWARFUnit.h.
References clear().
|
inline |
Definition at line 335 of file DWARFUnit.h.
References assert().
Referenced by getStringOffsetSectionItem().
|
inline |
Definition at line 291 of file DWARFUnit.h.
Definition at line 223 of file DWARFUnit.cpp.
References llvm::DWARFSection::Data, llvm::DWARFContext::getDWARFObj(), getDwarfStringOffsetsByteSize(), getStringOffsetsBase(), llvm::None, and llvm::StringRef::size().
|
inline |
Definition at line 326 of file DWARFUnit.h.
|
inline |
Definition at line 290 of file DWARFUnit.h.
DWARFDie DWARFUnit::getSubroutineForAddress | ( | uint64_t | Address | ) |
Returns subprogram DIE with address range encompassing the provided address.
The pointer is alive as long as parsed compile unit DIEs are not cleared.
Definition at line 614 of file DWARFUnit.cpp.
References getUnitDIE(), and updateAddressDieMap().
Referenced by llvm::DWARFContext::getDIEsForAddress(), and getInlinedChainForAddress().
Definition at line 381 of file DWARFUnit.h.
Referenced by collectAddressRanges(), determineStringOffsetsTableContribution(), llvm::DWARFCompileUnit::dump(), llvm::DWARFTypeUnit::dump(), dumpArrayType(), getBaseAddress(), getCompilationDir(), llvm::DWARFContext::getLineTableForUnit(), getParent(), and getSubroutineForAddress().
|
inline |
Definition at line 286 of file DWARFUnit.h.
References llvm::DWARFUnitHeader::getUnitType().
Referenced by llvm::DWARFCompileUnit::dump(), and llvm::DWARFTypeUnit::dump().
|
inline |
Return the DWARFUnitVector containing this unit.
Definition at line 427 of file DWARFUnit.h.
|
inline |
Definition at line 279 of file DWARFUnit.h.
References llvm::DWARFUnitHeader::getVersion().
Referenced by determineStringOffsetsTableContributionDWO(), llvm::DWARFCompileUnit::dump(), llvm::DWARFTypeUnit::dump(), dumpLocation(), llvm::DWARFUnitHeader::extract(), findRnglistFromOffset(), getCompilationDir(), llvm::DWARFVerifier::handleDebugInfo(), and isVariableIndexable().
|
inline |
Definition at line 270 of file DWARFUnit.h.
Referenced by dumpLocation().
|
inlinestatic |
Definition at line 342 of file DWARFUnit.h.
References llvm::dwarf::isUnitType().
|
inline |
Definition at line 287 of file DWARFUnit.h.
References llvm::DWARFUnitHeader::isTypeUnit().
Referenced by llvm::DWARFCompileUnit::classof(), llvm::DWARFTypeUnit::classof(), and llvm::DWARFUnitHeader::extract().
|
inline |
Definition at line 295 of file DWARFUnit.h.
|
inline |
Definition at line 393 of file DWARFUnit.h.
References llvm::DWARFUnitHeader::setDWOId().
|
inline |
Definition at line 303 of file DWARFUnit.h.
Referenced by getCompilationDir().
void DWARFUnit::updateAddressDieMap | ( | DWARFDie | Die | ) |
Recursively update address to Die map.
Definition at line 583 of file DWARFUnit.cpp.
References B, llvm::consumeError(), llvm::DWARFDie::getAddressRanges(), llvm::DWARFDie::getFirstChild(), llvm::DWARFDie::getSibling(), llvm::DWARFDie::isSubroutineDIE(), and second.
Referenced by getSubroutineForAddress().
const DWARFSection* llvm::DWARFUnit::LocSection |
Definition at line 201 of file DWARFUnit.h.
StringRef llvm::DWARFUnit::LocSectionData |
Definition at line 202 of file DWARFUnit.h.
Referenced by DWARFUnit().