|
LLVM
10.0.0
|
#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... | |
| Expected< Optional< StrOffsetsContributionDescriptor > > | determineStringOffsetsTableContribution (DWARFDataExtractor &DA) |
| Find the unit's contribution to the string offsets table and determine its length and form. More... | |
| Expected< 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 194 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 171 of file DWARFUnit.cpp.
References C, clear(), llvm::DWARFSection::Data, llvm::Data, llvm::DW_SECT_LOC, getAddressByteSize(), llvm::DWARFContext::getDWARFObj(), llvm::DWARFUnitHeader::getIndexEntry(), llvm::DWARFObject::getLoclistsDWOSection(), llvm::DWARFObject::getLoclistsSection(), llvm::DWARFUnitHeader::getVersion(), llvm::StringRef::substr(), and ~DWARFUnit().
|
virtualdefault |
Referenced by DWARFUnit().
| void DWARFUnit::clear | ( | ) |
| Expected< DWARFAddressRangesVector > DWARFUnit::collectAddressRanges | ( | ) |
Definition at line 653 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 946 of file DWARFUnit.cpp.
References llvm::StringRef::data(), llvm::find(), llvm::DataExtractor::getData(), llvm::DWARFUnitHeader::getFormat(), getUnitDIE(), llvm::None, parseDWARFStringOffsetsTableHeader(), and llvm::dwarf::toSectionOffset().
Referenced by tryExtractDIEsIfNeeded().
|
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 965 of file DWARFUnit.cpp.
References C, llvm::DWARFSection::Data, llvm::StringRef::data(), llvm::DW_SECT_STR_OFFSETS, llvm::dwarf::DWARF32, llvm::DataExtractor::getData(), llvm::DWARFUnitHeader::getFormat(), llvm::DWARFUnitHeader::getIndexEntry(), getVersion(), llvm::None, parseDWARFStringOffsetsTableHeader(), and llvm::StringRef::size().
Referenced by tryExtractDIEsIfNeeded().
|
inline |
Definition at line 515 of file DWARFUnit.h.
References llvm::dump(), llvm::DWARFUnitHeader::getLength(), and llvm::DWARFUnitHeader::getUnitLengthFieldByteSize().
|
pure virtual |
Implemented in llvm::DWARFTypeUnit, and llvm::DWARFCompileUnit.
| Error DWARFUnit::extractRangeList | ( | uint64_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 356 of file DWARFUnit.cpp.
References assert(), llvm::DWARFDebugRangeList::extract(), getAddressByteSize(), and llvm::DWARFContext::getDWARFObj().
Referenced by findRnglistFromOffset().
| Expected< DWARFLocationExpressionsVector > DWARFUnit::findLoclistFromOffset | ( | uint64_t | Offset | ) |
Definition at line 668 of file DWARFUnit.cpp.
References getAddrOffsetSectionItem(), getBaseAddress(), getLocationTable(), llvm::joinErrors(), llvm::Error::success(), and llvm::DWARFLocationTable::visitAbsoluteLocationList().
| 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 641 of file DWARFUnit.cpp.
References llvm::createStringError(), findRnglistFromOffset(), getRnglistOffset(), and llvm::invalid_argument.
| Expected< DWARFAddressRangesVector > DWARFUnit::findRnglistFromOffset | ( | uint64_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 620 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 850 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 284 of file DWARFUnit.h.
References llvm::DWARFUnitHeader::getAddressByteSize().
Referenced by llvm::DWARFCompileUnit::dump(), llvm::DWARFTypeUnit::dump(), dumpAttribute(), dumpLocation(), DWARFUnit(), extractRangeList(), getAddrOffsetSectionItem(), llvm::DWARFAbbreviationDeclaration::getAttributeValue(), llvm::DWARFContext::getCUAddrSize(), getDebugInfoExtractor(), llvm::DWARFContext::getDebugLoc(), llvm::DWARFContext::getLineTableForUnit(), llvm::DWARFVerifier::handleDebugInfo(), isVariableIndexable(), llvm::CompileUnit::markEverythingAsKept(), and tryExtractDIEsIfNeeded().
| Optional< object::SectionedAddress > DWARFUnit::getAddrOffsetSectionItem | ( | uint32_t | Index | ) | const |
Definition at line 220 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::DWARFLocationTable::dumpLocationList(), findLoclistFromOffset(), and llvm::DWARFDebugRnglist::getAbsoluteRanges().
| llvm::Optional< object::SectionedAddress > DWARFUnit::getBaseAddress | ( | ) |
Definition at line 856 of file DWARFUnit.cpp.
References llvm::DWARFDie::find(), getUnitDIE(), and llvm::dwarf::toSectionedAddress().
Referenced by dumpLocation(), findLoclistFromOffset(), and findRnglistFromOffset().
Definition at line 376 of file DWARFUnit.cpp.
References llvm::Depth, llvm::numbers::e, llvm::WithColor::error(), llvm::DWARFDebugInfoEntry::extractFast(), llvm::find(), llvm::format(), llvm::DWARFDebugInfoEntry::getAbbreviationDeclarationPtr(), getDebugInfoExtractor(), getHeaderSize(), getNextUnitOffset(), getOffset(), getUnitDIE(), llvm::dwarf::toString(), llvm::toString(), tryExtractDIEsIfNeeded(), and llvm::WithColor::warning().
Referenced by dumpAttribute(), llvm::DeclContextTree::getChildDeclContext(), getExpressionFrameOffset(), llvm::DWARFContext::getInliningInfoForAddress(), llvm::DWARFContext::getLineInfoForAddress(), and llvm::DWARFContext::getLineInfoForAddressRange().
|
inline |
Definition at line 277 of file DWARFUnit.h.
References Context.
Referenced by dumpAttribute(), dumpLocation(), llvm::DWARFFormValue::extractValue(), llvm::DeclContextTree::getChildDeclContext(), and getExpressionFrameOffset().
| DWARFDataExtractor DWARFUnit::getDebugInfoExtractor | ( | ) | const |
Definition at line 214 of file DWARFUnit.cpp.
References getAddressByteSize(), and llvm::DWARFContext::getDWARFObj().
Referenced by llvm::DWARFFormValue::createFromUnit(), llvm::DWARFDebugInfoEntry::extractFast(), llvm::DWARFAbbreviationDeclaration::getAttributeValue(), and getCompilationDir().
Return the DIE object at the given index.
Definition at line 481 of file DWARFUnit.h.
References assert(), and getParent().
Referenced by llvm::inFunctionScope(), llvm::DWARFVerifier::DieRangeInfo::intersects(), and llvm::CompileUnit::markEverythingAsKept().
|
inline |
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 496 of file DWARFUnit.h.
References assert(), llvm::DWARFDebugInfoEntry::getOffset(), and llvm::partition_point().
Referenced by llvm::DWARFTypeUnit::dump(), llvm::DWARFExpression::Operation::print(), and llvm::DWARFExpression::Operation::verify().
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 476 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 379 of file DWARFUnit.h.
References llvm_unreachable.
|
inline |
Definition at line 286 of file DWARFUnit.h.
References llvm::DWARFUnitHeader::getDwarfOffsetByteSize().
Referenced by llvm::DWARFAbbreviationDeclaration::getAttributeValue(), and llvm::StrOffsetsContributionDescriptor::validateContributionSize().
|
inline |
Definition at line 345 of file DWARFUnit.h.
References assert().
Referenced by getStringOffsetSectionItem().
|
inline |
Definition at line 411 of file DWARFUnit.h.
Referenced by llvm::DWARFCompileUnit::dump(), and tryExtractDIEsIfNeeded().
| DWARFDie DWARFUnit::getFirstChild | ( | const DWARFDebugInfoEntry * | Die | ) |
Definition at line 824 of file DWARFUnit.cpp.
References llvm::DWARFDebugInfoEntry::hasChildren(), and I.
|
inline |
Definition at line 280 of file DWARFUnit.h.
References llvm::DWARFUnitHeader::getFormParams().
Referenced by llvm::DWARFFormValue::createFromUnit(), llvm::DWARFDebugInfoEntry::extractFast(), llvm::DWARFAbbreviationDeclaration::getAttributeValue(), and llvm::DWARFAbbreviationDeclaration::AttributeSpec::getByteSize().
|
inlineprotected |
Definition at line 248 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 251 of file DWARFUnit.h.
References llvm::DWARFUnitHeader::getSize(), llvm::AArch64CC::LE, llvm::AArch64CC::LS, llvm::ARMBuildAttrs::Section, and llvm::X86AS::SS.
Referenced by getCompilationDir().
|
inline |
Definition at line 278 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 737 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 835 of file DWARFUnit.cpp.
References assert(), llvm::Depth, llvm::DWARFDebugInfoEntry::getDepth(), getDepth(), llvm::DWARFDebugInfoEntry::hasChildren(), and I.
|
inline |
Definition at line 289 of file DWARFUnit.h.
References llvm::DWARFUnitHeader::getLength().
Referenced by llvm::DWARFCompileUnit::dump(), and llvm::DWARFTypeUnit::dump().
|
inline |
Definition at line 293 of file DWARFUnit.h.
Referenced by llvm::DWARFContext::getLineTableForUnit().
|
inline |
Definition at line 508 of file DWARFUnit.h.
References llvm::DW_SECT_LINE, and llvm::DWARFUnitHeader::getIndexEntry().
Referenced by llvm::DWARFContext::getLineTableForUnit().
|
inline |
Definition at line 330 of file DWARFUnit.h.
References clear().
Referenced by dumpLocation(), and findLoclistFromOffset().
Definition at line 437 of file DWARFUnit.h.
References llvm::Address, and llvm::None.
Referenced by dumpLocation().
|
inline |
Definition at line 316 of file DWARFUnit.h.
Referenced by tryExtractDIEsIfNeeded().
|
inline |
Definition at line 292 of file DWARFUnit.h.
References llvm::DWARFUnitHeader::getNextUnitOffset().
Referenced by llvm::DWARFCompileUnit::dump(), llvm::DWARFTypeUnit::dump(), llvm::DWARFDebugInfoEntry::extractFast(), and getCompilationDir().
Definition at line 403 of file DWARFUnit.h.
|
inline |
Returns the number of DIEs in the unit.
Parses the unit if necessary.
Definition at line 465 of file DWARFUnit.h.
Referenced by llvm::CompileUnit::CompileUnit(), and llvm::DWARFVerifier::DieRangeInfo::intersects().
|
inline |
Definition at line 279 of file DWARFUnit.h.
References llvm::DWARFUnitHeader::getOffset().
Referenced by llvm::DWARFCompileUnit::dump(), llvm::DWARFTypeUnit::dump(), getCompilationDir(), getNames(), isVariableIndexable(), llvm::DWARFExpression::Operation::print(), and llvm::DWARFExpression::Operation::verify().
| DWARFDie DWARFUnit::getParent | ( | const DWARFDebugInfoEntry * | Die | ) |
Definition at line 766 of file DWARFUnit.cpp.
References llvm::Depth, llvm::DWARFDebugInfoEntry::getDepth(), getDepth(), getUnitDIE(), and I.
| DWARFDie DWARFUnit::getPreviousSibling | ( | const DWARFDebugInfoEntry * | Die | ) |
Definition at line 805 of file DWARFUnit.cpp.
References llvm::Depth, llvm::DWARFDebugInfoEntry::getDepth(), getDepth(), and I.
|
inline |
Definition at line 285 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 429 of file DWARFUnit.h.
References llvm::None.
Referenced by dumpAttribute(), and findRnglistFromIndex().
| DWARFDie DWARFUnit::getSibling | ( | const DWARFDebugInfoEntry * | Die | ) |
Definition at line 785 of file DWARFUnit.cpp.
References llvm::Depth, llvm::DWARFDebugInfoEntry::getAbbreviationDeclarationPtr(), llvm::DWARFDebugInfoEntry::getDepth(), getDepth(), and I.
|
inline |
Definition at line 326 of file DWARFUnit.h.
|
inline |
Definition at line 350 of file DWARFUnit.h.
References assert().
Referenced by getStringOffsetSectionItem().
|
inline |
Definition at line 295 of file DWARFUnit.h.
Definition at line 243 of file DWARFUnit.cpp.
References llvm::DWARFSection::Data, llvm::DWARFContext::getDWARFObj(), getDwarfStringOffsetsByteSize(), getStringOffsetsBase(), llvm::None, and llvm::StringRef::size().
|
inline |
Definition at line 341 of file DWARFUnit.h.
|
inline |
Definition at line 294 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 722 of file DWARFUnit.cpp.
References getUnitDIE(), and updateAddressDieMap().
Referenced by llvm::DWARFContext::getDIEsForAddress(), getInlinedChainForAddress(), and llvm::DWARFContext::getLocalsForAddress().
Definition at line 396 of file DWARFUnit.h.
Referenced by collectAddressRanges(), llvm::CompileUnit::CompileUnit(), determineStringOffsetsTableContribution(), llvm::DWARFCompileUnit::dump(), llvm::DWARFTypeUnit::dump(), dumpArrayType(), getBaseAddress(), getCompilationDir(), llvm::CompileUnit::getLanguage(), llvm::DWARFContext::getLineTableForUnit(), getParent(), getSubroutineForAddress(), llvm::DWARFVerifier::DieRangeInfo::intersects(), and tryExtractDIEsIfNeeded().
|
inline |
Definition at line 290 of file DWARFUnit.h.
References llvm::DWARFUnitHeader::getUnitType().
Referenced by llvm::DWARFCompileUnit::dump(), llvm::DWARFTypeUnit::dump(), and llvm::DWARFVerifier::DieRangeInfo::intersects().
|
inline |
Return the DWARFUnitVector containing this unit.
Definition at line 461 of file DWARFUnit.h.
|
inline |
Definition at line 283 of file DWARFUnit.h.
References llvm::DWARFUnitHeader::getVersion().
Referenced by determineStringOffsetsTableContributionDWO(), llvm::DWARFCompileUnit::dump(), llvm::DWARFTypeUnit::dump(), dumpLocation(), findRnglistFromOffset(), llvm::DWARFVerifier::handleDebugInfo(), isVariableIndexable(), and tryExtractDIEsIfNeeded().
|
inline |
Definition at line 276 of file DWARFUnit.h.
|
inlinestatic |
Definition at line 357 of file DWARFUnit.h.
References llvm::dwarf::isUnitType().
Referenced by llvm::DWARFVerifier::DieRangeInfo::intersects().
|
inline |
Definition at line 291 of file DWARFUnit.h.
References llvm::DWARFUnitHeader::isTypeUnit().
Referenced by llvm::DWARFCompileUnit::classof(), and llvm::DWARFTypeUnit::classof().
|
inline |
Definition at line 299 of file DWARFUnit.h.
|
inline |
Definition at line 415 of file DWARFUnit.h.
References llvm::DWARFUnitHeader::setDWOId().
|
inline |
Definition at line 311 of file DWARFUnit.h.
References llvm::AArch64CC::LS.
Referenced by tryExtractDIEsIfNeeded().
|
inline |
Definition at line 307 of file DWARFUnit.h.
Referenced by tryExtractDIEsIfNeeded().
Definition at line 440 of file DWARFUnit.cpp.
References llvm::sys::path::append(), assert(), llvm::createStringError(), llvm::DWARFSection::Data, llvm::Data, determineStringOffsetsTableContribution(), determineStringOffsetsTableContributionDWO(), E, llvm::WithColor::error(), llvm::DWARFDie::find(), getAddressByteSize(), llvm::DWARFContext::getDWARFObj(), llvm::DWARFContext::getDWOContext(), getDWOId(), llvm::DWARFUnitHeader::getFormat(), llvm::DWARFListTableHeader::getHeaderSize(), llvm::DWARFObject::getLoclistsDWOSection(), llvm::DWARFObject::getLoclistsSection(), getLocSectionBase(), llvm::DWARFDie::getRangesBaseAttribute(), llvm::DWARFObject::getRnglistsDWOSection(), llvm::DWARFObject::getRnglistsSection(), getUnitDIE(), getVersion(), llvm::BTF::HeaderSize, llvm::invalid_argument, llvm::sys::path::is_relative(), llvm::None, llvm::DWARFUnitHeader::setDWOId(), setLocSection(), setRangesSection(), llvm::StringRef::size(), llvm::Error::success(), llvm::dwarf::toSectionOffset(), llvm::dwarf::toString(), llvm::toString(), and llvm::dwarf::toUnsigned().
Referenced by getCompilationDir().
| void DWARFUnit::updateAddressDieMap | ( | DWARFDie | Die | ) |
Recursively update address to Die map.
Definition at line 691 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().
1.8.13