LLVM 17.0.0git
|
#include "llvm/DebugInfo/DWARF/DWARFUnit.h"
Static Public Member Functions | |
static bool | isMatchingUnitTypeAndTag (uint8_t UnitType, dwarf::Tag Tag) |
Definition at line 206 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 187 of file DWARFUnit.cpp.
|
virtualdefault |
void DWARFUnit::clear | ( | ) |
Definition at line 375 of file DWARFUnit.cpp.
Referenced by DWARFUnit().
Expected< DWARFAddressRangesVector > DWARFUnit::collectAddressRanges | ( | ) |
Definition at line 682 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 1139 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 1152 of file DWARFUnit.cpp.
References assert(), llvm::CallingConv::C, llvm::DWARFSection::Data, llvm::dwarf::DWARF32, llvm::StringRef::empty(), getVersion(), llvm::Offset, parseDWARFStringOffsetsTableHeader(), llvm::StringRef::size(), and llvm::StrOffsetsContributionDescriptor::validateContributionSize().
Referenced by tryExtractDIEsIfNeeded().
|
inline |
Definition at line 543 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 365 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 697 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 672 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 655 of file DWARFUnit.cpp.
References Context, E, 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 1042 of file DWARFUnit.cpp.
References llvm::DWARFDebugAbbrev::getAbbreviationDeclarationSet(), and getAbbreviationsOffset().
Referenced by llvm::DWARFCompileUnit::dump(), and llvm::DWARFTypeUnit::dump().
|
inline |
Definition at line 403 of file DWARFUnit.h.
Referenced by getAbbreviations().
|
inline |
Definition at line 330 of file DWARFUnit.h.
Referenced by llvm::DWARFCompileUnit::dump(), and llvm::DWARFTypeUnit::dump().
|
inline |
Definition at line 319 of file DWARFUnit.h.
Referenced by llvm::DWARFCompileUnit::dump(), llvm::DWARFTypeUnit::dump(), llvm::DWARFFormValue::dumpSectionedAddress(), extractRangeList(), getAddrOffsetSectionItem(), getDebugInfoExtractor(), llvm::DWARFDie::getHighPC(), getRnglistOffset(), tryExtractDIEsIfNeeded(), and updateVariableDieMap().
|
inline |
Definition at line 349 of file DWARFUnit.h.
std::optional< object::SectionedAddress > DWARFUnit::getAddrOffsetSectionItem | ( | uint32_t | Index | ) | const |
Definition at line 208 of file DWARFUnit.cpp.
References llvm::Address, Context, llvm::DWARFSection::Data, getAddressByteSize(), llvm::hasSingleElement(), llvm::Offset, and llvm::StringRef::size().
Referenced by findLoclistFromOffset(), llvm::DWARFFormValue::getAsSectionedAddress(), and updateVariableDieMap().
std::optional< object::SectionedAddress > DWARFUnit::getBaseAddress | ( | ) |
Definition at line 1048 of file DWARFUnit.cpp.
References llvm::DWARFDie::find(), getUnitDIE(), and llvm::dwarf::toSectionedAddress().
Referenced by findLoclistFromOffset(), and findRnglistFromOffset().
Definition at line 389 of file DWARFUnit.cpp.
References llvm::find(), getUnitDIE(), and llvm::dwarf::toString().
Referenced by llvm::DWARFFormValue::getAsFile().
|
inline |
Definition at line 312 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 269 of file DWARFUnit.h.
References assert().
Referenced by getDIEAtIndex(), and getParentEntry().
DWARFDataExtractor DWARFUnit::getDebugInfoExtractor | ( | ) | const |
Definition at line 202 of file DWARFUnit.cpp.
References Context, and getAddressByteSize().
Referenced by llvm::DWARFDie::dump().
Return the DIE object at the given index Index
.
Definition at line 504 of file DWARFUnit.h.
References getDebugInfoEntry().
Referenced by llvm::DWARFDie::dump(), and llvm::CompileUnit::markEverythingAsKept().
Return the DIE object for a given offset Offset
inside the unit's DIE vector.
Definition at line 516 of file DWARFUnit.h.
References getDIEIndexForOffset(), and llvm::Offset.
Referenced by 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 262 of file DWARFUnit.h.
References assert().
Referenced by getDIEIndex(), getFirstChildEntry(), llvm::CompileUnit::getInfo(), getLastChildEntry(), getPreviousSiblingEntry(), and llvm::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 499 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 525 of file DWARFUnit.h.
References llvm::DIE::getOffset(), llvm::Offset, and llvm::partition_point().
Referenced by getDIEForOffset().
|
inline |
Definition at line 321 of file DWARFUnit.h.
|
inline |
Definition at line 393 of file DWARFUnit.h.
References assert().
Referenced by getStringOffsetSectionItem().
|
inline |
Definition at line 441 of file DWARFUnit.h.
References llvm::DWARFUnitHeader::getDWOId(), and getHeader().
Referenced by llvm::DWARFCompileUnit::dump().
DWARFDie DWARFUnit::getFirstChild | ( | const DWARFDebugInfoEntry * | Die | ) |
Definition at line 972 of file DWARFUnit.cpp.
References getFirstChildEntry().
Referenced by llvm::DWARFDie::getFirstChild().
|
protected |
Definition at line 980 of file DWARFUnit.cpp.
References assert(), getDIEIndex(), llvm::DWARFDebugInfoEntry::hasChildren(), and I.
Referenced by getFirstChild().
|
inline |
Definition at line 327 of file DWARFUnit.h.
Referenced by llvm::DWARFCompileUnit::dump(), llvm::DWARFTypeUnit::dump(), getLoclistOffset(), and getRnglistOffset().
|
inline |
Definition at line 315 of file DWARFUnit.h.
|
inlineprotected |
Definition at line 285 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 325 of file DWARFUnit.h.
|
inline |
Definition at line 313 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 860 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 997 of file DWARFUnit.cpp.
References getLastChildEntry().
Referenced by llvm::DWARFDie::getLastChild().
|
protected |
Definition at line 1005 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 326 of file DWARFUnit.h.
Referenced by llvm::DWARFCompileUnit::dump(), and llvm::DWARFTypeUnit::dump().
|
inline |
Definition at line 332 of file DWARFUnit.h.
|
inline |
Definition at line 536 of file DWARFUnit.h.
|
inline |
Definition at line 342 of file DWARFUnit.h.
|
inline |
Definition at line 378 of file DWARFUnit.h.
Referenced by findLoclistFromOffset().
Definition at line 1199 of file DWARFUnit.cpp.
References getFormat(), and llvm::DWARFListTableHeader::getOffsetEntry().
Referenced by llvm::DWARFDie::getLocations().
|
inline |
Definition at line 364 of file DWARFUnit.h.
|
inline |
Definition at line 331 of file DWARFUnit.h.
Referenced by llvm::DWARFCompileUnit::dump(), and llvm::DWARFTypeUnit::dump().
|
inline |
Definition at line 433 of file DWARFUnit.h.
|
inline |
Returns the number of DIEs in the unit.
Parses the unit if necessary.
Definition at line 488 of file DWARFUnit.h.
Referenced by llvm::CompileUnit::CompileUnit().
|
inline |
Definition at line 314 of file DWARFUnit.h.
Referenced by llvm::DWARFCompileUnit::dump(), llvm::DWARFFormValue::dump(), and llvm::DWARFTypeUnit::dump().
DWARFDie DWARFUnit::getParent | ( | const DWARFDebugInfoEntry * | Die | ) |
Definition at line 889 of file DWARFUnit.cpp.
References getParentEntry().
Referenced by llvm::DWARFDie::getParent().
|
protected |
Definition at line 897 of file DWARFUnit.cpp.
References assert(), getDebugInfoEntry(), and llvm::DWARFDebugInfoEntry::getParentIdx().
Referenced by getParent().
DWARFDie DWARFUnit::getPreviousSibling | ( | const DWARFDebugInfoEntry * | Die | ) |
Definition at line 933 of file DWARFUnit.cpp.
References getPreviousSiblingEntry().
Referenced by llvm::DWARFDie::getPreviousSibling().
|
protected |
Definition at line 941 of file DWARFUnit.cpp.
References assert(), getDIEIndex(), and llvm::DWARFDebugInfoEntry::getParentIdx().
Referenced by getPreviousSibling().
|
inline |
Definition at line 320 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 1188 of file DWARFUnit.cpp.
References Context, llvm::DWARFSection::Data, getAddressByteSize(), getFormat(), and llvm::DWARFListTableHeader::getOffsetEntry().
Referenced by findRnglistFromIndex().
DWARFDie DWARFUnit::getSibling | ( | const DWARFDebugInfoEntry * | Die | ) |
Definition at line 911 of file DWARFUnit.cpp.
References getSiblingEntry().
Referenced by llvm::DWARFDie::getSibling().
|
protected |
Definition at line 919 of file DWARFUnit.cpp.
References assert(), and llvm::DWARFDebugInfoEntry::getSiblingIdx().
Referenced by getSibling().
|
inline |
Definition at line 374 of file DWARFUnit.h.
Referenced by llvm::DWARFFormValue::getAsCString().
|
inline |
Definition at line 398 of file DWARFUnit.h.
References assert().
Referenced by getStringOffsetSectionItem().
|
inline |
Definition at line 334 of file DWARFUnit.h.
Definition at line 231 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 389 of file DWARFUnit.h.
|
inline |
Definition at line 333 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 751 of file DWARFUnit.cpp.
References llvm::Address, getUnitDIE(), and updateAddressDieMap().
Referenced by getInlinedChainForAddress().
Definition at line 426 of file DWARFUnit.h.
Referenced by collectAddressRanges(), llvm::CompileUnit::CompileUnit(), llvm::gsym::DwarfTransformer::convert(), llvm::CompileUnit::createOutputDIE(), determineStringOffsetsTableContribution(), llvm::DWARFCompileUnit::dump(), llvm::DWARFTypeUnit::dump(), getBaseAddress(), getCompilationDir(), llvm::CompileUnit::getLanguage(), getLastChildEntry(), getSubroutineForAddress(), llvm::CompileUnit::getSysRoot(), and getVariableForAddress().
|
inline |
Definition at line 328 of file DWARFUnit.h.
Referenced by llvm::DWARFCompileUnit::dump(), and llvm::DWARFTypeUnit::dump().
|
inline |
Return the DWARFUnitVector containing this unit.
Definition at line 484 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 839 of file DWARFUnit.cpp.
References llvm::Address, getUnitDIE(), llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::insert(), and updateVariableDieMap().
|
inline |
Definition at line 318 of file DWARFUnit.h.
Referenced by determineStringOffsetsTableContributionDWO(), llvm::DWARFCompileUnit::dump(), llvm::DWARFTypeUnit::dump(), findRnglistFromOffset(), llvm::DWARFFormValue::isFormClass(), llvm::DWARFDie::resolveTypeUnitReference(), and tryExtractDIEsIfNeeded().
|
inline |
Definition at line 311 of file DWARFUnit.h.
Referenced by llvm::gsym::DwarfTransformer::convert(), llvm::logicalview::LVELFReader::createScopes(), and llvm::DWARFDie::resolveTypeUnitReference().
|
inline |
Definition at line 310 of file DWARFUnit.h.
|
inlinestatic |
Definition at line 407 of file DWARFUnit.h.
References llvm::dwarf::isUnitType().
|
inline |
Definition at line 329 of file DWARFUnit.h.
|
inline |
Definition at line 344 of file DWARFUnit.h.
References llvm::sampleprof::Base.
|
inline |
Definition at line 445 of file DWARFUnit.h.
|
inline |
Definition at line 359 of file DWARFUnit.h.
References llvm::sampleprof::Base.
Referenced by tryExtractDIEsIfNeeded().
|
inline |
Definition at line 338 of file DWARFUnit.h.
Definition at line 486 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 720 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 765 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(), llvm::dwarf::isType(), Size, UINT64_MAX, and updateVariableDieMap().
Referenced by getVariableForAddress(), and updateVariableDieMap().