|
LLVM 22.0.0git
|
#include "llvm/DebugInfo/DWARF/DWARFUnit.h"
Static Public Member Functions | |
| static bool | isMatchingUnitTypeAndTag (uint8_t UnitType, dwarf::Tag Tag) |
Definition at line 219 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 202 of file DWARFUnit.cpp.
References clear().
Referenced by llvm::DWARFCompileUnit::classof(), llvm::DWARFTypeUnit::classof(), llvm::DWARFCompileUnit::DWARFCompileUnit(), llvm::DWARFTypeUnit::DWARFTypeUnit(), getLastChildEntry(), getLinkedUnit(), and setSkeletonUnit().
|
virtualdefault |
| void DWARFUnit::clear | ( | ) |
Definition at line 395 of file DWARFUnit.cpp.
Referenced by llvm::dwarf_linker::parallel::CompileUnit::cleanupDataAfterClonning(), and DWARFUnit().
| Expected< DWARFAddressRangesVector > DWARFUnit::collectAddressRanges | ( | ) |
Definition at line 701 of file DWARFUnit.cpp.
References 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 1166 of file DWARFUnit.cpp.
References assert(), llvm::find(), getUnitDIE(), 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 1179 of file DWARFUnit.cpp.
References assert(), llvm::CallingConv::C, llvm::dwarf::DWARF32, getVersion(), llvm::Offset, and parseDWARFStringOffsetsTableHeader().
Referenced by tryExtractDIEsIfNeeded().
|
inline |
Definition at line 568 of file DWARFUnit.h.
|
pure virtual |
Implemented in llvm::DWARFCompileUnit, and llvm::DWARFTypeUnit.
References tryExtractDIEsIfNeeded().
| 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 385 of file DWARFUnit.cpp.
References assert(), llvm::DWARFDebugRangeList::extract(), and getAddressByteSize().
Referenced by findRnglistFromOffset().
| Expected< DWARFLocationExpressionsVector > DWARFUnit::findLoclistFromOffset | ( | uint64_t | Offset | ) |
Definition at line 716 of file DWARFUnit.cpp.
References getAddrOffsetSectionItem(), getBaseAddress(), getLocationTable(), llvm::joinErrors(), llvm::Offset, 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 691 of file DWARFUnit.cpp.
References llvm::createStringError(), findRnglistFromOffset(), getRnglistOffset(), llvm::invalid_argument, and llvm::Offset.
| 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 674 of file DWARFUnit.cpp.
References extractRangeList(), llvm::DWARFListTableBase< DWARFListType >::findList(), llvm::DWARFDebugRangeList::getAbsoluteRanges(), getBaseAddress(), getVersion(), and llvm::Offset.
Referenced by findRnglistFromIndex().
| const DWARFAbbreviationDeclarationSet * DWARFUnit::getAbbreviations | ( | ) | const |
Definition at line 1061 of file DWARFUnit.cpp.
References llvm::consumeError(), getAbbreviationsOffset(), and llvm::Expected< T >::takeError().
Referenced by llvm::DWARFCompileUnit::dump(), and llvm::DWARFTypeUnit::dump().
|
inline |
Definition at line 428 of file DWARFUnit.h.
Referenced by getAbbreviations().
|
inline |
Definition at line 345 of file DWARFUnit.h.
Referenced by llvm::DWARFCompileUnit::dump(), and llvm::DWARFTypeUnit::dump().
|
inline |
Definition at line 334 of file DWARFUnit.h.
Referenced by llvm::DWARFCompileUnit::dump(), llvm::DWARFTypeUnit::dump(), extractRangeList(), getAddrOffsetSectionItem(), getDebugInfoExtractor(), getIndexedAddressOffset(), getRnglistOffset(), tryExtractDIEsIfNeeded(), and updateVariableDieMap().
|
inline |
Definition at line 364 of file DWARFUnit.h.
Referenced by getIndexedAddressOffset().
| std::optional< object::SectionedAddress > DWARFUnit::getAddrOffsetSectionItem | ( | uint32_t | Index | ) | const |
Definition at line 223 of file DWARFUnit.cpp.
References llvm::Address, getAddressByteSize(), llvm::hasSingleElement(), and llvm::Offset.
Referenced by findLoclistFromOffset(), and updateVariableDieMap().
| std::optional< object::SectionedAddress > DWARFUnit::getBaseAddress | ( | ) |
Definition at line 1075 of file DWARFUnit.cpp.
References llvm::DWARFDie::find(), getUnitDIE(), and llvm::dwarf::toSectionedAddress().
Referenced by findLoclistFromOffset(), and findRnglistFromOffset().
Definition at line 409 of file DWARFUnit.cpp.
References llvm::find(), getUnitDIE(), and llvm::dwarf::toString().
Referenced by llvm::DWARFFormValue::getAsFile(), and llvm::dwarf_linker::parallel::CompileUnit::getDirAndFilenameFromLineTable().
|
inline |
Definition at line 327 of file DWARFUnit.h.
Referenced by dumpAttribute(), llvm::DWARFFormValue::getAsFile(), llvm::DWARFDie::getAttributeValueAsReferencedDie(), and llvm::DWARFDie::resolveTypeUnitReference().
|
inlineprotected |
Return DWARFDebugInfoEntry for the specified index Index.
Definition at line 284 of file DWARFUnit.h.
References assert().
Referenced by getDIEAtIndex(), and getParentEntry().
| DWARFDataExtractor DWARFUnit::getDebugInfoExtractor | ( | ) | const |
Definition at line 217 of file DWARFUnit.cpp.
References getAddressByteSize().
Return the DIE object at the given index Index.
Definition at line 529 of file DWARFUnit.h.
References getDebugInfoEntry().
Return the DIE object for a given offset Offset inside the unit's DIE vector.
Definition at line 541 of file DWARFUnit.h.
References getDIEIndexForOffset(), and llvm::Offset.
Referenced by llvm::DWARFContext::dump(), llvm::DWARFTypeUnit::dump(), and llvm::DWARFDie::getAttributeValueAsReferencedDie().
|
inlineprotected |
Return the index of a Die entry 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 277 of file DWARFUnit.h.
References assert(), and llvm::First.
Referenced by getDIEIndex(), llvm::dwarf_linker::parallel::CompileUnit::getDIEInfo(), llvm::dwarf_linker::parallel::CompileUnit::getDIEInfo(), llvm::dwarf_linker::parallel::CompileUnit::getDIEInfo(), llvm::dwarf_linker::parallel::CompileUnit::getDIEInfo(), llvm::dwarf_linker::parallel::CompileUnit::getDieOutOffset(), llvm::dwarf_linker::parallel::CompileUnit::getDieTypeEntry(), getFirstChildEntry(), llvm::dwarf_linker::classic::CompileUnit::getInfo(), getLastChildEntry(), getPreviousSiblingEntry(), llvm::dwarf_linker::parallel::CompileUnit::setDieTypeEntry(), and llvm::dwarf_linker::classic::DeclContext::setLastSeenDIE().
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 524 of file DWARFUnit.h.
References D(), and getDIEIndex().
Return the DIE index for a given offset Offset inside the unit's DIE vector.
Definition at line 550 of file DWARFUnit.h.
References llvm::DIE::getOffset(), llvm::Offset, and llvm::partition_point().
Referenced by getDIEForOffset().
|
inline |
Definition at line 336 of file DWARFUnit.h.
|
inline |
Definition at line 418 of file DWARFUnit.h.
References assert().
Referenced by getStringOffsetSectionItem().
|
inline |
Definition at line 466 of file DWARFUnit.h.
References getHeader().
Referenced by llvm::DWARFCompileUnit::dump().
| DWARFDie DWARFUnit::getFirstChild | ( | const DWARFDebugInfoEntry * | Die | ) |
Definition at line 991 of file DWARFUnit.cpp.
References getFirstChildEntry().
|
protected |
Definition at line 999 of file DWARFUnit.cpp.
References assert(), getDIEIndex(), llvm::DWARFDebugInfoEntry::hasChildren(), and I.
Referenced by getFirstChild().
|
inline |
Definition at line 342 of file DWARFUnit.h.
Referenced by llvm::DWARFCompileUnit::dump(), llvm::DWARFTypeUnit::dump(), getLoclistOffset(), and getRnglistOffset().
|
inline |
Definition at line 330 of file DWARFUnit.h.
Referenced by convertFunctionLineTable().
|
inlineprotected |
Definition at line 300 of file DWARFUnit.h.
Referenced by getDWOId(), llvm::DWARFTypeUnit::getTypeHash(), and llvm::DWARFTypeUnit::getTypeOffset().
|
inline |
Size in bytes of the parsed unit header.
Definition at line 340 of file DWARFUnit.h.
Returns offset to the indexed address value inside .debug_addr section.
Definition at line 369 of file DWARFUnit.h.
References getAddressByteSize(), and getAddrOffsetSectionBase().
|
inline |
Definition at line 328 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 879 of file DWARFUnit.cpp.
References llvm::Address, assert(), llvm::SmallVectorTemplateCommon< T, typename >::empty(), llvm::DWARFDie::getParent(), getSubroutineForAddress(), llvm::DWARFDie::getTag(), llvm::DWARFDie::isSubprogramDIE(), and llvm::SmallVectorTemplateBase< T, bool >::push_back().
| DWARFDie DWARFUnit::getLastChild | ( | const DWARFDebugInfoEntry * | Die | ) |
Definition at line 1016 of file DWARFUnit.cpp.
References getLastChildEntry().
|
protected |
Definition at line 1024 of file DWARFUnit.cpp.
References assert(), DWARFUnit(), getDIEIndex(), llvm::DWARFDebugInfoEntry::getSiblingIdx(), llvm::dwarf::getTag(), getUnitDIE(), and llvm::DWARFDebugInfoEntry::hasChildren().
Referenced by getLastChild().
|
inline |
Definition at line 341 of file DWARFUnit.h.
Referenced by llvm::DWARFCompileUnit::dump(), and llvm::DWARFTypeUnit::dump().
|
inline |
Definition at line 347 of file DWARFUnit.h.
|
inline |
Definition at line 561 of file DWARFUnit.h.
|
inline |
Definition at line 357 of file DWARFUnit.h.
References DWARFUnit().
|
inline |
Definition at line 402 of file DWARFUnit.h.
Referenced by findLoclistFromOffset().
Definition at line 1226 of file DWARFUnit.cpp.
References getFormat(), and llvm::DWARFListTableHeader::getOffsetEntry().
|
inline |
Definition at line 388 of file DWARFUnit.h.
|
inline |
Definition at line 346 of file DWARFUnit.h.
Referenced by llvm::DWARFCompileUnit::dump(), and llvm::DWARFTypeUnit::dump().
|
inline |
Definition at line 458 of file DWARFUnit.h.
Referenced by llvm::DWARFCompileUnit::dump().
|
inline |
Returns the number of DIEs in the unit.
Parses the unit if necessary.
Definition at line 513 of file DWARFUnit.h.
|
inline |
Definition at line 329 of file DWARFUnit.h.
Referenced by llvm::DWARFCompileUnit::dump(), llvm::DWARFTypeUnit::dump(), and llvm::dwarf_linker::parallel::CompileUnit::resolveDIEReference().
| DWARFDie DWARFUnit::getParent | ( | const DWARFDebugInfoEntry * | Die | ) |
Definition at line 908 of file DWARFUnit.cpp.
References getParentEntry().
|
protected |
Definition at line 916 of file DWARFUnit.cpp.
References assert(), getDebugInfoEntry(), and llvm::DWARFDebugInfoEntry::getParentIdx().
Referenced by getParent().
| DWARFDie DWARFUnit::getPreviousSibling | ( | const DWARFDebugInfoEntry * | Die | ) |
Definition at line 952 of file DWARFUnit.cpp.
References getPreviousSiblingEntry().
|
protected |
Definition at line 960 of file DWARFUnit.cpp.
References assert(), getDIEIndex(), and llvm::DWARFDebugInfoEntry::getParentIdx().
Referenced by getPreviousSibling().
|
inline |
Definition at line 335 of file DWARFUnit.h.
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 1215 of file DWARFUnit.cpp.
References getAddressByteSize(), getFormat(), and llvm::DWARFListTableHeader::getOffsetEntry().
Referenced by findRnglistFromIndex().
| DWARFDie DWARFUnit::getSibling | ( | const DWARFDebugInfoEntry * | Die | ) |
Definition at line 930 of file DWARFUnit.cpp.
References getSiblingEntry().
|
protected |
Definition at line 938 of file DWARFUnit.cpp.
References assert(), and llvm::DWARFDebugInfoEntry::getSiblingIdx().
Referenced by getSibling().
|
inline |
Definition at line 398 of file DWARFUnit.h.
|
inline |
Definition at line 423 of file DWARFUnit.h.
References assert().
Referenced by getStringOffsetSectionItem().
|
inline |
Definition at line 349 of file DWARFUnit.h.
Definition at line 246 of file DWARFUnit.cpp.
References getDwarfStringOffsetsByteSize(), getStringOffsetsBase(), llvm::inconvertibleErrorCode(), llvm::make_error(), and llvm::Offset.
|
inline |
Definition at line 413 of file DWARFUnit.h.
|
inline |
Definition at line 348 of file DWARFUnit.h.
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 770 of file DWARFUnit.cpp.
References llvm::Address, getUnitDIE(), and updateAddressDieMap().
Referenced by llvm::DWARFContext::getDIEsForAddress(), and getInlinedChainForAddress().
Definition at line 451 of file DWARFUnit.h.
Referenced by llvm::dwarf_linker::parallel::CompileUnit::cloneAndEmit(), collectAddressRanges(), llvm::gsym::DwarfTransformer::convert(), determineStringOffsetsTableContribution(), llvm::DWARFCompileUnit::dump(), llvm::DWARFTypeUnit::dump(), getBaseAddress(), getCompilationDir(), llvm::dwarf_linker::classic::CompileUnit::getLanguage(), getLastChildEntry(), getSubroutineForAddress(), llvm::dwarf_linker::classic::CompileUnit::getSysRoot(), and getVariableForAddress().
|
inline |
Definition at line 343 of file DWARFUnit.h.
Referenced by llvm::DWARFCompileUnit::dump(), and llvm::DWARFTypeUnit::dump().
|
inline |
Return the DWARFUnitVector containing this unit.
Definition at line 509 of file DWARFUnit.h.
Referenced by llvm::DWARFDie::getAttributeValueAsReferencedDie().
Returns variable DIE for the address provided.
The pointer is alive as long as parsed compile unit DIEs are not cleared.
Definition at line 858 of file DWARFUnit.cpp.
References llvm::Address, getUnitDIE(), and updateVariableDieMap().
|
inline |
Definition at line 333 of file DWARFUnit.h.
Referenced by determineStringOffsetsTableContributionDWO(), llvm::DWARFCompileUnit::dump(), llvm::DWARFTypeUnit::dump(), findRnglistFromOffset(), and tryExtractDIEsIfNeeded().
|
inline |
Definition at line 326 of file DWARFUnit.h.
Referenced by llvm::gsym::DwarfTransformer::convert(), and llvm::logicalview::LVDWARFReader::createScopes().
|
inline |
Definition at line 325 of file DWARFUnit.h.
Referenced by updateVariableDieMap().
|
inlinestatic |
Definition at line 432 of file DWARFUnit.h.
References llvm::dwarf::isUnitType(), and llvm::Tag.
|
inline |
Definition at line 344 of file DWARFUnit.h.
|
inline |
Definition at line 359 of file DWARFUnit.h.
References llvm::sampleprof::Base.
|
inline |
Definition at line 470 of file DWARFUnit.h.
|
inline |
Definition at line 383 of file DWARFUnit.h.
References llvm::sampleprof::Base.
Referenced by tryExtractDIEsIfNeeded().
|
inline |
Definition at line 353 of file DWARFUnit.h.
References DWARFUnit().
Definition at line 506 of file DWARFUnit.cpp.
References assert(), llvm::CallingConv::C, llvm::createStringError(), llvm::Data, determineStringOffsetsTableContribution(), determineStringOffsetsTableContributionDWO(), llvm::DW_SECT_EXT_LOC, llvm::DWARFDie::find(), getAddressByteSize(), llvm::DWARFListTableHeader::getHeaderSize(), getVersion(), llvm::invalid_argument, setRangesSection(), llvm::Error::success(), llvm::dwarf::toSectionOffset(), llvm::toString(), and llvm::dwarf::toUnsigned().
Referenced by dump().
| void DWARFUnit::updateAddressDieMap | ( | DWARFDie | Die | ) |
Recursively update address to Die map.
Definition at line 739 of file DWARFUnit.cpp.
References B(), llvm::consumeError(), llvm::DWARFDie::getAddressRanges(), llvm::DWARFDie::getFirstChild(), llvm::DWARFDie::getSibling(), llvm::DWARFDie::isSubroutineDIE(), and updateAddressDieMap().
Referenced by getSubroutineForAddress(), and updateAddressDieMap().
| void DWARFUnit::updateVariableDieMap | ( | DWARFDie | Die | ) |
Recursively update address to variable Die map.
Definition at line 784 of file DWARFUnit.cpp.
References llvm::Address, llvm::DWARFExpression::begin(), llvm::consumeError(), llvm::Data, llvm::DWARFExpression::end(), getAddressByteSize(), getAddrOffsetSectionItem(), llvm::DWARFDie::getAttributeValueAsReferencedDie(), llvm::DWARFDie::getLocations(), llvm::DWARFDie::getTag(), llvm::DWARFDie::getTypeSize(), isLittleEndian(), llvm::dwarf::isType(), Size, UINT64_MAX, and updateVariableDieMap().
Referenced by getVariableForAddress(), and updateVariableDieMap().