LLVM  12.0.0git
Classes | Public Types | Public Member Functions | Static Public Member Functions | List of all members
llvm::DWARFFormValue Class Reference

#include "llvm/DebugInfo/DWARF/DWARFFormValue.h"

Classes

struct  UnitOffset
 

Public Types

enum  FormClass {
  FC_Unknown, FC_Address, FC_Block, FC_Constant,
  FC_String, FC_Flag, FC_Reference, FC_Indirect,
  FC_SectionOffset, FC_Exprloc
}
 

Public Member Functions

 DWARFFormValue (dwarf::Form F=dwarf::Form(0))
 
dwarf::Form getForm () const
 
uint64_t getRawUValue () const
 
bool isFormClass (FormClass FC) const
 
const DWARFUnitgetUnit () const
 
void dump (raw_ostream &OS, DIDumpOptions DumpOpts=DIDumpOptions()) const
 
void dumpSectionedAddress (raw_ostream &OS, DIDumpOptions DumpOpts, object::SectionedAddress SA) const
 
bool 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. More...
 
bool extractValue (const DWARFDataExtractor &Data, uint64_t *OffsetPtr, dwarf::FormParams FormParams, const DWARFUnit *U)
 
bool isInlinedCStr () const
 
Optional< uint64_t > getAsReference () const
 getAsFoo functions below return the extracted value as Foo if only DWARFFormValue has form class is suitable for representing Foo. More...
 
Optional< UnitOffsetgetAsRelativeReference () const
 
Optional< uint64_t > getAsUnsignedConstant () const
 
Optional< int64_t > getAsSignedConstant () const
 
Optional< const char * > getAsCString () const
 
Optional< uint64_t > getAsAddress () const
 
Optional< object::SectionedAddressgetAsSectionedAddress () const
 
Optional< uint64_t > getAsSectionOffset () const
 
Optional< ArrayRef< uint8_t > > getAsBlock () const
 
Optional< uint64_t > getAsCStringOffset () const
 
Optional< uint64_t > getAsReferenceUVal () const
 
bool skipValue (DataExtractor DebugInfoData, uint64_t *OffsetPtr, const dwarf::FormParams Params) const
 Skip a form's value in DebugInfoData at the offset specified by OffsetPtr. More...
 

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 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. More...
 

Detailed Description

Definition at line 26 of file DWARFFormValue.h.

Member Enumeration Documentation

◆ FormClass

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.

Constructor & Destructor Documentation

◆ DWARFFormValue()

llvm::DWARFFormValue::DWARFFormValue ( dwarf::Form  F = dwarf::Form(0))
inline

Member Function Documentation

◆ createFromBlockValue()

DWARFFormValue DWARFFormValue::createFromBlockValue ( dwarf::Form  F,
ArrayRef< uint8_t >  D 
)
static

Definition at line 92 of file DWARFFormValue.cpp.

References llvm::ArrayRef< T >::data(), and llvm::ArrayRef< T >::size().

Referenced by DWARFFormValue().

◆ createFromPValue()

DWARFFormValue DWARFFormValue::createFromPValue ( dwarf::Form  F,
const char V 
)
static

Definition at line 88 of file DWARFFormValue.cpp.

Referenced by DWARFFormValue(), and llvm::DWARFDebugLine::LineTable::parse().

◆ createFromSValue()

DWARFFormValue DWARFFormValue::createFromSValue ( dwarf::Form  F,
int64_t  V 
)
static

◆ createFromUnit()

DWARFFormValue DWARFFormValue::createFromUnit ( dwarf::Form  F,
const DWARFUnit Unit,
uint64_t *  OffsetPtr 
)
static

◆ createFromUValue()

DWARFFormValue DWARFFormValue::createFromUValue ( dwarf::Form  F,
uint64_t  V 
)
static

Definition at line 84 of file DWARFFormValue.cpp.

Referenced by dumpAttribute(), and DWARFFormValue().

◆ dump()

void DWARFFormValue::dump ( raw_ostream OS,
DIDumpOptions  DumpOpts = DIDumpOptions() 
) const

◆ dumpAddressSection()

void DWARFFormValue::dumpAddressSection ( const DWARFObject Obj,
raw_ostream OS,
DIDumpOptions  DumpOpts,
uint64_t  SectionIndex 
)
static

◆ dumpSectionedAddress()

void DWARFFormValue::dumpSectionedAddress ( raw_ostream OS,
DIDumpOptions  DumpOpts,
object::SectionedAddress  SA 
) const

◆ extractValue() [1/2]

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 236 of file DWARFFormValue.cpp.

References C, llvm::dwarf::FormParams::Format, and llvm::DWARFUnit::getContext().

Referenced by createFromUnit(), extractValue(), llvm::DWARFAbbreviationDeclaration::getAttributeValue(), getUnit(), parseV5DirFileTables(), llvm::AppleAcceleratorTable::readAtoms(), llvm::shouldSkipAttribute(), and llvm::updateRefIncompleteness().

◆ extractValue() [2/2]

bool llvm::DWARFFormValue::extractValue ( const DWARFDataExtractor Data,
uint64_t *  OffsetPtr,
dwarf::FormParams  FormParams,
const DWARFUnit U 
)
inline

Definition at line 97 of file DWARFFormValue.h.

References extractValue().

◆ getAsAddress()

Optional< uint64_t > DWARFFormValue::getAsAddress ( ) const

Definition at line 623 of file DWARFFormValue.cpp.

References llvm::None.

Referenced by llvm::updateRefIncompleteness().

◆ getAsBlock()

Optional< ArrayRef< uint8_t > > DWARFFormValue::getAsBlock ( ) const

◆ getAsCString()

Optional< const char * > DWARFFormValue::getAsCString ( ) const

Definition at line 586 of file DWARFFormValue.cpp.

References C, and llvm::None.

Referenced by llvm::updateRefIncompleteness().

◆ getAsCStringOffset()

Optional< uint64_t > DWARFFormValue::getAsCStringOffset ( ) const

Definition at line 711 of file DWARFFormValue.cpp.

References llvm::None.

◆ getAsReference()

Optional< uint64_t > DWARFFormValue::getAsReference ( ) const

getAsFoo functions below return the extracted value as Foo if only DWARFFormValue has form class is suitable for representing Foo.

Definition at line 645 of file DWARFFormValue.cpp.

References llvm::None.

Referenced by llvm::getUnitForOffset(), and llvm::updateRefIncompleteness().

◆ getAsReferenceUVal()

Optional< uint64_t > DWARFFormValue::getAsReferenceUVal ( ) const

Definition at line 717 of file DWARFFormValue.cpp.

References llvm::None.

◆ getAsRelativeReference()

Optional< DWARFFormValue::UnitOffset > DWARFFormValue::getAsRelativeReference ( ) const

Definition at line 651 of file DWARFFormValue.cpp.

References llvm::None.

Referenced by llvm::DWARFDie::getAttributeValueAsReferencedDie().

◆ getAsSectionedAddress()

Optional< object::SectionedAddress > DWARFFormValue::getAsSectionedAddress ( ) const

Definition at line 630 of file DWARFFormValue.cpp.

References llvm::None.

◆ getAsSectionOffset()

Optional< uint64_t > DWARFFormValue::getAsSectionOffset ( ) const

◆ getAsSignedConstant()

Optional< int64_t > DWARFFormValue::getAsSignedConstant ( ) const

Definition at line 685 of file DWARFFormValue.cpp.

References llvm::max(), and llvm::None.

Referenced by llvm::updateRefIncompleteness().

◆ getAsUnsignedConstant()

Optional< uint64_t > DWARFFormValue::getAsUnsignedConstant ( ) const

◆ getForm()

dwarf::Form llvm::DWARFFormValue::getForm ( ) const
inline

◆ getRawUValue()

uint64_t llvm::DWARFFormValue::getRawUValue ( ) const
inline

Definition at line 78 of file DWARFFormValue.h.

References R600_InstFlag::FC, and isFormClass().

Referenced by llvm::AppleAcceleratorTable::readAtoms().

◆ getUnit()

const DWARFUnit* llvm::DWARFFormValue::getUnit ( ) const
inline

◆ isFormClass()

bool DWARFFormValue::isFormClass ( DWARFFormValue::FormClass  FC) const

◆ isInlinedCStr()

bool llvm::DWARFFormValue::isInlinedCStr ( ) const
inline

Definition at line 102 of file DWARFFormValue.h.

◆ skipValue() [1/2]

bool llvm::DWARFFormValue::skipValue ( DataExtractor  DebugInfoData,
uint64_t *  OffsetPtr,
const dwarf::FormParams  Params 
) const
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.

Parameters
DebugInfoDataThe data where we want to skip the value.
OffsetPtrA reference to the offset that will be updated.
ParamsDWARF parameters to help interpret forms.
Returns
true on success, false if the form was not skipped.

Definition at line 133 of file DWARFFormValue.h.

Referenced by llvm::DWARFDebugInfoEntry::extractFast(), llvm::getAttributeOffsets(), llvm::DWARFAbbreviationDeclaration::getAttributeValue(), parseV5DirFileTables(), llvm::shouldSkipAttribute(), and llvm::updateRefIncompleteness().

◆ skipValue() [2/2]

bool DWARFFormValue::skipValue ( dwarf::Form  Form,
DataExtractor  DebugInfoData,
uint64_t *  OffsetPtr,
const dwarf::FormParams  FormParams 
)
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.

Parameters
FormThe DW_FORM enumeration that indicates the form to skip.
DebugInfoDataThe data where we want to skip the value.
OffsetPtrA reference to the offset that will be updated.
FormParamsDWARF parameters to help interpret forms.
Returns
true on success, false if the form was not skipped.

Definition at line 108 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().


The documentation for this class was generated from the following files: