LLVM 19.0.0git
|
#include "llvm/DebugInfo/DWARF/DWARFUnit.h"
Static Public Member Functions | |
static bool | isMatchingUnitTypeAndTag (uint8_t UnitType, dwarf::Tag Tag) |
Definition at line 211 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 190 of file DWARFUnit.cpp.
|
virtualdefault |
void DWARFUnit::clear | ( | ) |
Definition at line 364 of file DWARFUnit.cpp.
Referenced by llvm::dwarf_linker::parallel::CompileUnit::cleanupDataAfterClonning(), and DWARFUnit().
Expected< DWARFAddressRangesVector > DWARFUnit::collectAddressRanges | ( | ) |
Definition at line 671 of file DWARFUnit.cpp.
References llvm::createStringError(), llvm::DWARFDie::getAddressRanges(), getUnitDIE(), llvm::invalid_argument, and llvm::dwarf::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 1136 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 1149 of file DWARFUnit.cpp.
References assert(), llvm::CallingConv::C, llvm::DWARFSection::Data, llvm::dwarf::DWARF32, llvm::StringRef::empty(), getVersion(), llvm::Offset, parseDWARFStringOffsetsTableHeader(), and llvm::StringRef::size().
Referenced by tryExtractDIEsIfNeeded().
|
inline |
Definition at line 560 of file DWARFUnit.h.
|
pure virtual |
Implemented in llvm::DWARFCompileUnit, and llvm::DWARFTypeUnit.
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 354 of file DWARFUnit.cpp.
References assert(), Context, llvm::DWARFDebugRangeList::extract(), and getAddressByteSize().
Referenced by findRnglistFromOffset().
Expected< DWARFLocationExpressionsVector > DWARFUnit::findLoclistFromOffset | ( | uint64_t | Offset | ) |
Definition at line 686 of file DWARFUnit.cpp.
References getAddrOffsetSectionItem(), getBaseAddress(), getLocationTable(), llvm::joinErrors(), llvm::Offset, llvm::Error::success(), and llvm::DWARFLocationTable::visitAbsoluteLocationList().
Referenced by llvm::DWARFDie::getLocations().
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 661 of file DWARFUnit.cpp.
References llvm::createStringError(), findRnglistFromOffset(), getRnglistOffset(), llvm::invalid_argument, and llvm::Offset.
Referenced by llvm::DWARFDie::getAddressRanges().
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 644 of file DWARFUnit.cpp.
References Context, extractRangeList(), llvm::DWARFListTableBase< DWARFListType >::findList(), llvm::DWARFDebugRangeList::getAbsoluteRanges(), getBaseAddress(), getVersion(), and llvm::Offset.
Referenced by findRnglistFromIndex(), and llvm::DWARFDie::getAddressRanges().
const DWARFAbbreviationDeclarationSet * DWARFUnit::getAbbreviations | ( | ) | const |
Definition at line 1031 of file DWARFUnit.cpp.
References llvm::consumeError(), llvm::DWARFDebugAbbrev::getAbbreviationDeclarationSet(), getAbbreviationsOffset(), and llvm::Expected< T >::takeError().
Referenced by llvm::DWARFCompileUnit::dump(), and llvm::DWARFTypeUnit::dump().
|
inline |
Definition at line 420 of file DWARFUnit.h.
Referenced by getAbbreviations().
|
inline |
Definition at line 337 of file DWARFUnit.h.
Referenced by llvm::DWARFCompileUnit::dump(), and llvm::DWARFTypeUnit::dump().
|
inline |
Definition at line 326 of file DWARFUnit.h.
Referenced by llvm::dwarf_linker::parallel::DIEAttributeCloner::cloneBlockAttr(), llvm::dwarf_linker::parallel::CompileUnit::cloneDieAttrExpression(), llvm::DWARFCompileUnit::dump(), llvm::DWARFTypeUnit::dump(), llvm::DWARFFormValue::dumpSectionedAddress(), extractRangeList(), getAddrOffsetSectionItem(), getDebugInfoExtractor(), llvm::DWARFDie::getHighPC(), getIndexedAddressOffset(), getRnglistOffset(), tryExtractDIEsIfNeeded(), and updateVariableDieMap().
|
inline |
Definition at line 356 of file DWARFUnit.h.
Referenced by getIndexedAddressOffset().
std::optional< object::SectionedAddress > DWARFUnit::getAddrOffsetSectionItem | ( | uint32_t | Index | ) | const |
Definition at line 211 of file DWARFUnit.cpp.
References llvm::Address, Context, llvm::DWARFSection::Data, getAddressByteSize(), llvm::hasSingleElement(), llvm::Offset, and llvm::StringRef::size().
Referenced by llvm::dwarf_linker::parallel::CompileUnit::cloneDieAttrExpression(), findLoclistFromOffset(), and updateVariableDieMap().
std::optional< object::SectionedAddress > DWARFUnit::getBaseAddress | ( | ) |
Definition at line 1045 of file DWARFUnit.cpp.
References llvm::DWARFDie::find(), getUnitDIE(), and llvm::dwarf::toSectionedAddress().
Referenced by findLoclistFromOffset(), and findRnglistFromOffset().
Definition at line 378 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 319 of file DWARFUnit.h.
References Context.
Referenced by dumpAttribute(), llvm::DWARFFormValue::dumpSectionedAddress(), llvm::DWARFFormValue::getAsFile(), and llvm::DWARFDie::resolveTypeUnitReference().
|
inlineprotected |
Return DWARFDebugInfoEntry for the specified index Index
.
Definition at line 276 of file DWARFUnit.h.
References assert().
Referenced by llvm::dwarf_linker::parallel::CompileUnit::find(), llvm::dwarf_linker::parallel::CompileUnit::getDebugInfoEntry(), getDIEAtIndex(), getParentEntry(), and llvm::dwarf_linker::parallel::CompileUnit::resolveDIEReference().
DWARFDataExtractor DWARFUnit::getDebugInfoExtractor | ( | ) | const |
Definition at line 205 of file DWARFUnit.cpp.
References Context, and getAddressByteSize().
Referenced by llvm::dwarf_linker::parallel::DIEAttributeCloner::clone(), and llvm::DWARFDie::dump().
Return the DIE object at the given index Index
.
Definition at line 521 of file DWARFUnit.h.
References getDebugInfoEntry().
Referenced by llvm::DWARFDie::dump(), llvm::dwarf_linker::parallel::CompileUnit::getDIEAtIndex(), and llvm::dwarf_linker::classic::CompileUnit::markEverythingAsKept().
Return the DIE object for a given offset Offset
inside the unit's DIE vector.
Definition at line 533 of file DWARFUnit.h.
References getDIEIndexForOffset(), and llvm::Offset.
Referenced by llvm::DWARFContext::dump(), and llvm::DWARFTypeUnit::dump().
|
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 269 of file DWARFUnit.h.
References assert(), and llvm::First.
Referenced by llvm::dwarf_linker::parallel::CompileUnit::getDIEIndex(), getDIEIndex(), 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 516 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 542 of file DWARFUnit.h.
References llvm::DIE::getOffset(), llvm::Offset, and llvm::partition_point().
Referenced by llvm::dwarf_linker::parallel::CompileUnit::cloneDieAttrExpression(), getDIEForOffset(), and llvm::dwarf_linker::parallel::CompileUnit::getDIEIndexForOffset().
|
inline |
Definition at line 328 of file DWARFUnit.h.
|
inline |
Definition at line 410 of file DWARFUnit.h.
References assert().
Referenced by getStringOffsetSectionItem().
|
inline |
Definition at line 458 of file DWARFUnit.h.
References llvm::DWARFUnitHeader::getDWOId(), and getHeader().
Referenced by llvm::DWARFCompileUnit::dump().
DWARFDie DWARFUnit::getFirstChild | ( | const DWARFDebugInfoEntry * | Die | ) |
Definition at line 961 of file DWARFUnit.cpp.
References getFirstChildEntry().
Referenced by llvm::DWARFDie::getFirstChild().
|
protected |
Definition at line 969 of file DWARFUnit.cpp.
References assert(), getDIEIndex(), llvm::DWARFDebugInfoEntry::hasChildren(), and I.
Referenced by getFirstChild(), and llvm::dwarf_linker::parallel::CompileUnit::getFirstChildEntry().
|
inline |
Definition at line 334 of file DWARFUnit.h.
Referenced by llvm::DWARFCompileUnit::dump(), llvm::DWARFTypeUnit::dump(), getLoclistOffset(), and getRnglistOffset().
|
inline |
Definition at line 322 of file DWARFUnit.h.
|
inlineprotected |
Definition at line 292 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 332 of file DWARFUnit.h.
Returns offset to the indexed address value inside .debug_addr section.
Definition at line 361 of file DWARFUnit.h.
References getAddressByteSize(), and getAddrOffsetSectionBase().
|
inline |
Definition at line 320 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 849 of file DWARFUnit.cpp.
References llvm::Address, assert(), llvm::SmallVectorBase< Size_T >::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 986 of file DWARFUnit.cpp.
References getLastChildEntry().
Referenced by llvm::DWARFDie::getLastChild().
|
protected |
Definition at line 994 of file DWARFUnit.cpp.
References assert(), getDIEIndex(), llvm::DWARFDebugInfoEntry::getSiblingIdx(), llvm::dwarf::getTag(), getUnitDIE(), and llvm::DWARFDebugInfoEntry::hasChildren().
Referenced by getLastChild().
|
inline |
Definition at line 333 of file DWARFUnit.h.
Referenced by llvm::DWARFCompileUnit::dump(), and llvm::DWARFTypeUnit::dump().
|
inline |
Definition at line 339 of file DWARFUnit.h.
|
inline |
Definition at line 553 of file DWARFUnit.h.
|
inline |
Definition at line 349 of file DWARFUnit.h.
|
inline |
Definition at line 394 of file DWARFUnit.h.
Referenced by findLoclistFromOffset().
Definition at line 1196 of file DWARFUnit.cpp.
References getFormat(), and llvm::DWARFListTableHeader::getOffsetEntry().
Referenced by llvm::dwarf_linker::parallel::DIEAttributeCloner::cloneScalarAttr(), and llvm::DWARFDie::getLocations().
|
inline |
Definition at line 380 of file DWARFUnit.h.
|
inline |
Definition at line 338 of file DWARFUnit.h.
Referenced by llvm::dwarf_linker::parallel::DIEAttributeCloner::clone(), llvm::DWARFCompileUnit::dump(), and llvm::DWARFTypeUnit::dump().
|
inline |
Definition at line 450 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 505 of file DWARFUnit.h.
Referenced by llvm::dwarf_linker::parallel::DIEAttributeCloner::clone(), and llvm::dwarf_linker::classic::CompileUnit::CompileUnit().
|
inline |
DWARFDie DWARFUnit::getParent | ( | const DWARFDebugInfoEntry * | Die | ) |
Definition at line 878 of file DWARFUnit.cpp.
References getParentEntry().
Referenced by llvm::DWARFDie::getParent(), and llvm::dwarf_linker::parallel::CompileUnit::getParent().
|
protected |
Definition at line 886 of file DWARFUnit.cpp.
References assert(), getDebugInfoEntry(), and llvm::DWARFDebugInfoEntry::getParentIdx().
Referenced by getParent().
DWARFDie DWARFUnit::getPreviousSibling | ( | const DWARFDebugInfoEntry * | Die | ) |
Definition at line 922 of file DWARFUnit.cpp.
References getPreviousSiblingEntry().
Referenced by llvm::DWARFDie::getPreviousSibling().
|
protected |
Definition at line 930 of file DWARFUnit.cpp.
References assert(), getDIEIndex(), and llvm::DWARFDebugInfoEntry::getParentIdx().
Referenced by getPreviousSibling().
|
inline |
Definition at line 327 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 1185 of file DWARFUnit.cpp.
References Context, llvm::DWARFSection::Data, getAddressByteSize(), getFormat(), and llvm::DWARFListTableHeader::getOffsetEntry().
Referenced by llvm::dwarf_linker::parallel::DIEAttributeCloner::cloneScalarAttr(), and findRnglistFromIndex().
DWARFDie DWARFUnit::getSibling | ( | const DWARFDebugInfoEntry * | Die | ) |
Definition at line 900 of file DWARFUnit.cpp.
References getSiblingEntry().
Referenced by llvm::DWARFDie::getSibling().
|
protected |
Definition at line 908 of file DWARFUnit.cpp.
References assert(), and llvm::DWARFDebugInfoEntry::getSiblingIdx().
Referenced by getSibling(), and llvm::dwarf_linker::parallel::CompileUnit::getSiblingEntry().
|
inline |
Definition at line 390 of file DWARFUnit.h.
Referenced by llvm::DWARFFormValue::getAsCString().
|
inline |
Definition at line 415 of file DWARFUnit.h.
References assert().
Referenced by getStringOffsetSectionItem().
|
inline |
Definition at line 341 of file DWARFUnit.h.
Definition at line 234 of file DWARFUnit.cpp.
References Context, llvm::DWARFSection::Data, getDwarfStringOffsetsByteSize(), getStringOffsetsBase(), llvm::inconvertibleErrorCode(), llvm::Offset, and llvm::StringRef::size().
Referenced by llvm::DWARFFormValue::getAsCString().
|
inline |
Definition at line 405 of file DWARFUnit.h.
|
inline |
Definition at line 340 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 740 of file DWARFUnit.cpp.
References llvm::Address, getUnitDIE(), and updateAddressDieMap().
Referenced by llvm::DWARFContext::getDIEsForAddress(), and getInlinedChainForAddress().
Definition at line 443 of file DWARFUnit.h.
Referenced by llvm::dwarf_linker::parallel::CompileUnit::cloneAndEmit(), llvm::dwarf_linker::parallel::CompileUnit::cloneAndEmitDebugMacro(), collectAddressRanges(), llvm::dwarf_linker::classic::CompileUnit::CompileUnit(), llvm::dwarf_linker::parallel::CompileUnit::CompileUnit(), llvm::gsym::DwarfTransformer::convert(), llvm::dwarf_linker::classic::CompileUnit::createOutputDIE(), determineStringOffsetsTableContribution(), llvm::DWARFCompileUnit::dump(), llvm::DWARFTypeUnit::dump(), getBaseAddress(), getCompilationDir(), llvm::dwarf_linker::classic::CompileUnit::getLanguage(), getLastChildEntry(), getSubroutineForAddress(), llvm::dwarf_linker::classic::CompileUnit::getSysRoot(), llvm::dwarf_linker::parallel::CompileUnit::getUnitDIE(), and getVariableForAddress().
|
inline |
Definition at line 335 of file DWARFUnit.h.
Referenced by llvm::DWARFCompileUnit::dump(), and llvm::DWARFTypeUnit::dump().
|
inline |
Return the DWARFUnitVector containing this unit.
Definition at line 501 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 828 of file DWARFUnit.cpp.
References llvm::Address, getUnitDIE(), llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::insert(), and updateVariableDieMap().
|
inline |
Definition at line 325 of file DWARFUnit.h.
Referenced by llvm::dwarf_linker::parallel::DIEAttributeCloner::cloneScalarAttr(), determineStringOffsetsTableContributionDWO(), llvm::DWARFCompileUnit::dump(), llvm::DWARFTypeUnit::dump(), findRnglistFromOffset(), llvm::DWARFFormValue::isFormClass(), llvm::DWARFDie::resolveTypeUnitReference(), and tryExtractDIEsIfNeeded().
|
inline |
Definition at line 318 of file DWARFUnit.h.
Referenced by llvm::gsym::DwarfTransformer::convert(), llvm::logicalview::LVDWARFReader::createScopes(), and llvm::DWARFDie::resolveTypeUnitReference().
|
inline |
Definition at line 317 of file DWARFUnit.h.
Referenced by llvm::dwarf_linker::parallel::DIEAttributeCloner::cloneBlockAttr(), and updateVariableDieMap().
|
inlinestatic |
Definition at line 424 of file DWARFUnit.h.
References llvm::dwarf::isUnitType().
|
inline |
Definition at line 336 of file DWARFUnit.h.
|
inline |
Definition at line 351 of file DWARFUnit.h.
References llvm::sampleprof::Base.
|
inline |
Definition at line 462 of file DWARFUnit.h.
|
inline |
Definition at line 375 of file DWARFUnit.h.
References llvm::sampleprof::Base.
Referenced by tryExtractDIEsIfNeeded().
|
inline |
Definition at line 345 of file DWARFUnit.h.
Definition at line 475 of file DWARFUnit.cpp.
References assert(), llvm::CallingConv::C, Context, 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::dwarf::toString(), and llvm::dwarf::toUnsigned().
void DWARFUnit::updateAddressDieMap | ( | DWARFDie | Die | ) |
Recursively update address to Die map.
Definition at line 709 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 754 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().