LLVM 20.0.0git
|
#include "llvm/DebugInfo/DWARF/DWARFFormValue.h"
Classes | |
struct | ValueType |
Public Types | |
enum | FormClass { FC_Unknown , FC_Address , FC_Block , FC_Constant , FC_String , FC_Flag , FC_Reference , FC_Indirect , FC_SectionOffset , FC_Exprloc } |
Static Public Member Functions | |
static DWARFFormValue | createFromSValue (dwarf::Form F, int64_t V) |
static DWARFFormValue | createFromUValue (dwarf::Form F, uint64_t V) |
static DWARFFormValue | createFromPValue (dwarf::Form F, const char *V) |
static DWARFFormValue | createFromBlockValue (dwarf::Form F, ArrayRef< uint8_t > D) |
static DWARFFormValue | createFromUnit (dwarf::Form F, const DWARFUnit *Unit, uint64_t *OffsetPtr) |
static std::optional< object::SectionedAddress > | getAsSectionedAddress (const ValueType &Val, const dwarf::Form Form, const DWARFUnit *U) |
static void | dumpAddress (raw_ostream &OS, uint8_t AddressSize, uint64_t Address) |
static void | dumpAddressSection (const DWARFObject &Obj, raw_ostream &OS, DIDumpOptions DumpOpts, uint64_t SectionIndex) |
static bool | skipValue (dwarf::Form Form, DataExtractor DebugInfoData, uint64_t *OffsetPtr, const dwarf::FormParams FormParams) |
Skip a form's value in DebugInfoData at the offset specified by OffsetPtr . | |
Definition at line 26 of file DWARFFormValue.h.
Enumerator | |
---|---|
FC_Unknown | |
FC_Address | |
FC_Block | |
FC_Constant | |
FC_String | |
FC_Flag | |
FC_Reference | |
FC_Indirect | |
FC_SectionOffset | |
FC_Exprloc |
Definition at line 28 of file DWARFFormValue.h.
|
inline |
Definition at line 67 of file DWARFFormValue.h.
|
static |
Definition at line 94 of file DWARFFormValue.cpp.
|
static |
Definition at line 90 of file DWARFFormValue.cpp.
References F.
Referenced by llvm::DWARFDebugLine::LineTable::parse(), and parseV2DirFileTables().
|
static |
Definition at line 82 of file DWARFFormValue.cpp.
References F.
Referenced by llvm::DWARFAbbreviationDeclaration::getAttributeValueFromOffset(), and llvm::DWARFAbbreviationDeclaration::AttributeSpec::getFormValue().
|
static |
Definition at line 102 of file DWARFFormValue.cpp.
References extractValue(), and F.
|
static |
void DWARFFormValue::dump | ( | raw_ostream & | OS, |
DIDumpOptions | DumpOpts = DIDumpOptions() |
||
) | const |
Definition at line 382 of file DWARFFormValue.cpp.
References A, llvm::Address, dumpSectionedAddress(), llvm::format(), llvm::WithColor::get(), getAsSectionedAddress(), llvm::dwarf::getDwarfOffsetByteSize(), llvm::DWARFUnit::getOffset(), llvm::nulls(), llvm::Offset, OS, llvm::DIDumpOptions::ShowAddresses, llvm::DIDumpOptions::Verbose, and llvm::raw_ostream::write_escaped().
Referenced by llvm::DWARFDebugLine::Prologue::dump(), dumpAttribute(), and dumpLocationList().
void llvm::DWARFFormValue::dumpAddress | ( | raw_ostream & | OS, |
uint64_t | Address | ||
) | const |
|
static |
Definition at line 353 of file DWARFFormValue.cpp.
References llvm::Address, llvm::format(), and OS.
|
static |
Definition at line 367 of file DWARFFormValue.cpp.
References llvm::format(), llvm::DWARFObject::getSectionNames(), OS, llvm::dwarf_linker::SectionNames, and llvm::DIDumpOptions::Verbose.
Referenced by llvm::DWARFAddressRange::dump(), llvm::DWARFDebugLoc::dumpRawEntry(), llvm::DWARFDebugLoclists::dumpRawEntry(), and dumpSectionedAddress().
void DWARFFormValue::dumpSectionedAddress | ( | raw_ostream & | OS, |
DIDumpOptions | DumpOpts, | ||
object::SectionedAddress | SA | ||
) | const |
Definition at line 359 of file DWARFFormValue.cpp.
References llvm::object::SectionedAddress::Address, dumpAddress(), dumpAddressSection(), llvm::DWARFUnit::getAddressByteSize(), llvm::DWARFUnit::getContext(), llvm::DWARFContext::getDWARFObj(), OS, and llvm::object::SectionedAddress::SectionIndex.
Referenced by dump().
bool DWARFFormValue::extractValue | ( | const DWARFDataExtractor & | Data, |
uint64_t * | OffsetPtr, | ||
dwarf::FormParams | FormParams, | ||
const DWARFContext * | Context = nullptr , |
||
const DWARFUnit * | Unit = nullptr |
||
) |
Extracts a value in Data
at offset *OffsetPtr
.
The information in FormParams
is needed to interpret some forms. The optional Context
and Unit
allows extracting information if the form refers to other sections (e.g., .debug_str).
Definition at line 220 of file DWARFFormValue.cpp.
References llvm::Data, llvm::errorToBool(), FP, llvm_unreachable, Size, and llvm::Error::success().
Referenced by llvm::dwarf_linker::parallel::DIEAttributeCloner::clone(), createFromUnit(), extractValue(), llvm::DWARFAbbreviationDeclaration::getAttributeValueFromOffset(), llvm::dwarf_linker::parallel::DependencyTracker::maybeAddReferencedRoots(), and llvm::AppleAcceleratorTable::readAtoms().
|
inline |
Definition at line 103 of file DWARFFormValue.h.
References llvm::Data, and extractValue().
std::optional< uint64_t > DWARFFormValue::getAsAddress | ( | ) | const |
Definition at line 634 of file DWARFFormValue.cpp.
References getAsSectionedAddress().
Referenced by dumpAttribute().
Definition at line 738 of file DWARFFormValue.cpp.
References FC_Block, FC_Exprloc, and isFormClass().
Referenced by llvm::dwarf_linker::parallel::DIEAttributeCloner::cloneBlockAttr(), and dumpLocationExpr().
Definition at line 591 of file DWARFFormValue.cpp.
References FC_String, llvm::dwarf::FormEncodingString(), llvm::DataExtractor::getCStr(), llvm::DWARFContext::getLineStringExtractor(), llvm::DWARFContext::getStringExtractor(), llvm::DWARFUnit::getStringExtractor(), llvm::DWARFUnit::getStringOffsetSectionItem(), llvm::inconvertibleErrorCode(), isFormClass(), llvm::Offset, llvm::StringRef::str(), and llvm::Expected< T >::takeError().
Referenced by llvm::DWARFDebugLine::Prologue::dump().
std::optional< uint64_t > DWARFFormValue::getAsCStringOffset | ( | ) | const |
Definition at line 745 of file DWARFFormValue.cpp.
References FC_String, and isFormClass().
std::optional< uint64_t > DWARFFormValue::getAsDebugInfoReference | ( | ) | const |
Definition at line 683 of file DWARFFormValue.cpp.
Referenced by llvm::dwarf_linker::parallel::CompileUnit::resolveDIEReference().
std::optional< std::string > DWARFFormValue::getAsFile | ( | DILineInfoSpecifier::FileLineInfoKind | Kind | ) | const |
Correctly extract any file paths from a form value.
These attributes can be in the from DW_AT_decl_file or DW_AT_call_file attributes. We need to use the file index in the correct DWARFUnit's line table prologue, and each DWARFFormValue has the DWARFUnit the form value was extracted from.
Kind | The kind of path to extract. |
Definition at line 758 of file DWARFFormValue.cpp.
References FC_Constant, llvm::DWARFUnit::getCompilationDir(), llvm::DWARFUnit::getContext(), llvm::DWARFContext::getLineTableForUnit(), and isFormClass().
std::optional< uint64_t > DWARFFormValue::getAsReferenceUVal | ( | ) | const |
Definition at line 751 of file DWARFFormValue.cpp.
References FC_Reference, and isFormClass().
std::optional< uint64_t > DWARFFormValue::getAsRelativeReference | ( | ) | const |
getAsFoo functions below return the extracted value as Foo if only DWARFFormValue has form class is suitable for representing Foo.
Definition at line 668 of file DWARFFormValue.cpp.
Referenced by llvm::dwarf_linker::parallel::CompileUnit::resolveDIEReference().
std::optional< object::SectionedAddress > DWARFFormValue::getAsSectionedAddress | ( | ) | const |
Definition at line 664 of file DWARFFormValue.cpp.
References getAsSectionedAddress().
Referenced by dump(), getAsAddress(), and getAsSectionedAddress().
|
static |
Definition at line 640 of file DWARFFormValue.cpp.
References llvm::dwarf::doesFormBelongToClass(), FC_Address, and if().
std::optional< uint64_t > DWARFFormValue::getAsSectionOffset | ( | ) | const |
Definition at line 706 of file DWARFFormValue.cpp.
References FC_SectionOffset, and isFormClass().
Referenced by llvm::dwarf_linker::parallel::DIEAttributeCloner::cloneScalarAttr(), dumpAttribute(), dumpLocationList(), and llvm::dwarf_linker::parallel::CompileUnit::getDirAndFilenameFromLineTable().
std::optional< uint64_t > DWARFFormValue::getAsSignatureReference | ( | ) | const |
Definition at line 689 of file DWARFFormValue.cpp.
std::optional< int64_t > DWARFFormValue::getAsSignedConstant | ( | ) | const |
Definition at line 719 of file DWARFFormValue.cpp.
References FC_Constant, FC_Flag, and isFormClass().
Referenced by llvm::dwarf_linker::parallel::DIEAttributeCloner::cloneScalarAttr(), and llvm::dwarf_linker::parallel::CompileUnit::getDirAndFilenameFromLineTable().
std::optional< uint64_t > DWARFFormValue::getAsSupplementaryReference | ( | ) | const |
Definition at line 695 of file DWARFFormValue.cpp.
std::optional< uint64_t > DWARFFormValue::getAsUnsignedConstant | ( | ) | const |
Definition at line 712 of file DWARFFormValue.cpp.
References FC_Constant, FC_Flag, and isFormClass().
Referenced by llvm::dwarf_linker::parallel::DIEAttributeCloner::cloneScalarAttr(), dumpAttribute(), llvm::dwarf_linker::parallel::CompileUnit::getDirAndFilenameFromLineTable(), and llvm::AppleAcceleratorTable::readAtoms().
|
inline |
Definition at line 80 of file DWARFFormValue.h.
Referenced by dumpAttribute(), dumpLocationList(), and llvm::AppleAcceleratorTable::validateForms().
|
inline |
Definition at line 81 of file DWARFFormValue.h.
Referenced by llvm::dwarf_linker::parallel::DIEAttributeCloner::cloneAddressAttr(), and llvm::DWARFDebugNames::Entry::dumpParentIdx().
Definition at line 84 of file DWARFFormValue.h.
Referenced by llvm::dwarf_linker::parallel::CompileUnit::resolveDIEReference().
bool DWARFFormValue::isFormClass | ( | DWARFFormValue::FormClass | FC | ) | const |
Definition at line 216 of file DWARFFormValue.cpp.
References llvm::dwarf::doesFormBelongToClass(), and llvm::DWARFUnit::getVersion().
Referenced by llvm::dwarf_linker::parallel::DIEAttributeCloner::cloneBlockAttr(), dumpAttribute(), dumpLocationExpr(), dumpLocationList(), getAsBlock(), getAsCString(), getAsCStringOffset(), getAsFile(), getAsReferenceUVal(), getAsSectionOffset(), getAsSignedConstant(), getAsUnsignedConstant(), llvm::dwarf_linker::parallel::DependencyTracker::maybeAddReferencedRoots(), and llvm::AppleAcceleratorTable::validateForms().
|
inline |
Skip a form's value in DebugInfoData
at the offset specified by OffsetPtr
.
Skips the bytes for the current form and updates the offset.
DebugInfoData | The data where we want to skip the value. |
OffsetPtr | A reference to the offset that will be updated. |
Params | DWARF parameters to help interpret forms. |
Definition at line 146 of file DWARFFormValue.h.
References skipValue().
Referenced by llvm::dwarf_linker::parallel::DIEAttributeCloner::clone(), llvm::DWARFDebugInfoEntry::extractFast(), llvm::DWARFAbbreviationDeclaration::getAttributeOffsetFromIndex(), getCUIdentifiers(), llvm::dwarf_linker::parallel::DependencyTracker::maybeAddReferencedRoots(), and skipValue().
|
static |
Skip a form's value in DebugInfoData
at the offset specified by OffsetPtr
.
Skips the bytes for the specified form and updates the offset.
Form | The DW_FORM enumeration that indicates the form to skip. |
DebugInfoData | The data where we want to skip the value. |
OffsetPtr | A reference to the offset that will be updated. |
FormParams | DWARF parameters to help interpret forms. |
Definition at line 110 of file DWARFFormValue.cpp.
References llvm::DataExtractor::getCStr(), llvm::dwarf::getFixedFormByteSize(), llvm::DataExtractor::getSLEB128(), llvm::DataExtractor::getU16(), llvm::DataExtractor::getU32(), llvm::DataExtractor::getU8(), llvm::DataExtractor::getULEB128(), and llvm::size().