LLVM 20.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 194 of file DWARFUnit.cpp.
References clear().
|
virtualdefault |
void DWARFUnit::clear | ( | ) |
Definition at line 387 of file DWARFUnit.cpp.
Referenced by llvm::dwarf_linker::parallel::CompileUnit::cleanupDataAfterClonning(), and DWARFUnit().
Expected< DWARFAddressRangesVector > DWARFUnit::collectAddressRanges | ( | ) |
Definition at line 694 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 1159 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 1172 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 377 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 709 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 684 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 667 of file DWARFUnit.cpp.
References extractRangeList(), llvm::DWARFListTableBase< DWARFListType >::findList(), llvm::DWARFDebugRangeList::getAbsoluteRanges(), getBaseAddress(), llvm::DWARFContext::getDWARFObj(), getVersion(), and llvm::Offset.
Referenced by findRnglistFromIndex(), and llvm::DWARFDie::getAddressRanges().
const DWARFAbbreviationDeclarationSet * DWARFUnit::getAbbreviations | ( | ) | const |
Definition at line 1054 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 215 of file DWARFUnit.cpp.
References llvm::Address, llvm::DWARFSection::Data, getAddressByteSize(), llvm::DWARFContext::getDWARFObj(), llvm::hasSingleElement(), llvm::DWARFContext::info_section_units(), 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 1068 of file DWARFUnit.cpp.
References llvm::DWARFDie::find(), getUnitDIE(), and llvm::dwarf::toSectionedAddress().
Referenced by findLoclistFromOffset(), and findRnglistFromOffset().
Definition at line 401 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.
Referenced by dumpAttribute(), llvm::DWARFFormValue::dumpSectionedAddress(), llvm::DWARFFormValue::getAsFile(), llvm::DWARFDie::getAttributeValueAsReferencedDie(), and llvm::DWARFDie::resolveTypeUnitReference().
|
inlineprotected |
Return DWARFDebugInfoEntry for the specified index Index
.
Definition at line 276 of file DWARFUnit.h.
References assert(), and Index.
Referenced by llvm::dwarf_linker::parallel::CompileUnit::find(), llvm::dwarf_linker::parallel::CompileUnit::getDebugInfoEntry(), getDIEAtIndex(), and getParentEntry().
DWARFDataExtractor DWARFUnit::getDebugInfoExtractor | ( | ) | const |
Definition at line 209 of file DWARFUnit.cpp.
References getAddressByteSize(), and llvm::DWARFContext::getDWARFObj().
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(), and Index.
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 984 of file DWARFUnit.cpp.
References getFirstChildEntry().
Referenced by llvm::DWARFDie::getFirstChild().
|
protected |
Definition at line 992 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(), getAddrOffsetSectionBase(), and Index.
|
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 872 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 1009 of file DWARFUnit.cpp.
References getLastChildEntry().
Referenced by llvm::DWARFDie::getLastChild().
|
protected |
Definition at line 1017 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 1219 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 901 of file DWARFUnit.cpp.
References getParentEntry().
Referenced by llvm::DWARFDie::getParent(), and llvm::dwarf_linker::parallel::CompileUnit::getParent().
|
protected |
Definition at line 909 of file DWARFUnit.cpp.
References assert(), getDebugInfoEntry(), and llvm::DWARFDebugInfoEntry::getParentIdx().
Referenced by getParent().
DWARFDie DWARFUnit::getPreviousSibling | ( | const DWARFDebugInfoEntry * | Die | ) |
Definition at line 945 of file DWARFUnit.cpp.
References getPreviousSiblingEntry().
Referenced by llvm::DWARFDie::getPreviousSibling().
|
protected |
Definition at line 953 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 1208 of file DWARFUnit.cpp.
References llvm::DWARFSection::Data, getAddressByteSize(), llvm::DWARFContext::getDWARFObj(), getFormat(), and llvm::DWARFListTableHeader::getOffsetEntry().
Referenced by llvm::dwarf_linker::parallel::DIEAttributeCloner::cloneScalarAttr(), and findRnglistFromIndex().
DWARFDie DWARFUnit::getSibling | ( | const DWARFDebugInfoEntry * | Die | ) |
Definition at line 923 of file DWARFUnit.cpp.
References getSiblingEntry().
Referenced by llvm::DWARFDie::getSibling().
|
protected |
Definition at line 931 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 238 of file DWARFUnit.cpp.
References llvm::DWARFSection::Data, llvm::DWARFContext::getDWARFObj(), 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 763 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(), llvm::DWARFDie::getLanguage(), getLastChildEntry(), getSubroutineForAddress(), llvm::dwarf_linker::classic::CompileUnit::getSysRoot(), llvm::dwarf_linker::classic::CompileUnit::getTag(), 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 851 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(), and tryExtractDIEsIfNeeded().
|
inline |
Definition at line 318 of file DWARFUnit.h.
Referenced by llvm::gsym::DwarfTransformer::convert(), llvm::logicalview::LVDWARFReader::createScopes(), llvm::DWARFDie::getAttributeValueAsReferencedDie(), 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(), and llvm::Tag.
|
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 498 of file DWARFUnit.cpp.
References assert(), llvm::CallingConv::C, llvm::createStringError(), llvm::DWARFSection::Data, llvm::Data, determineStringOffsetsTableContribution(), determineStringOffsetsTableContributionDWO(), llvm::DW_SECT_EXT_LOC, llvm::DWARFDie::find(), getAddressByteSize(), llvm::DWARFContext::getDWARFObj(), llvm::DWARFListTableHeader::getHeaderSize(), llvm::DWARFObject::getLocDWOSection(), llvm::DWARFObject::getLoclistsDWOSection(), llvm::DWARFObject::getLoclistsSection(), llvm::DWARFObject::getLocSection(), llvm::DWARFObject::getRnglistsDWOSection(), llvm::DWARFObject::getRnglistsSection(), getVersion(), llvm::invalid_argument, setRangesSection(), llvm::Error::success(), llvm::dwarf::toSectionOffset(), llvm::toString(), and llvm::dwarf::toUnsigned().
void DWARFUnit::updateAddressDieMap | ( | DWARFDie | Die | ) |
Recursively update address to Die map.
Definition at line 732 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 777 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().