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

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

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))
 Context for extract time. More...
 
dwarf::Form getForm () const
 
uint64_t getRawUValue () const
 
uint64_t getSectionIndex () const
 
void setForm (dwarf::Form F)
 
void setUValue (uint64_t V)
 
void setSValue (int64_t V)
 
void setPValue (const char *V)
 
void setBlockValue (const ArrayRef< uint8_t > &Data)
 
bool isFormClass (FormClass FC) const
 
const DWARFUnitgetUnit () const
 
void dump (raw_ostream &OS, DIDumpOptions DumpOpts=DIDumpOptions()) const
 
bool extractValue (const DWARFDataExtractor &Data, uint32_t *OffsetPtr, DWARFFormParams FormParams, const DWARFContext *Context=nullptr, const DWARFUnit *Unit=nullptr)
 Extracts a value in Data at offset *OffsetPtr. More...
 
bool extractValue (const DWARFDataExtractor &Data, uint32_t *OffsetPtr, DWARFFormParams 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< uint64_t > getAsUnsignedConstant () const
 
Optional< int64_t > getAsSignedConstant () const
 
Optional< const char * > getAsCString () const
 
Optional< uint64_t > getAsAddress () 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, uint32_t *OffsetPtr, const DWARFFormParams Params) const
 Skip a form's value in DebugInfoData at the offset specified by OffsetPtr. More...
 

Static Public Member Functions

static Optional< uint8_t > getFixedByteSize (dwarf::Form Form, const DWARFFormParams FormParams)
 Get the fixed byte size for a given form. More...
 
static bool skipValue (dwarf::Form Form, DataExtractor DebugInfoData, uint32_t *OffsetPtr, const DWARFFormParams FormParams)
 Skip a form's value in DebugInfoData at the offset specified by OffsetPtr. More...
 

Detailed Description

Definition at line 58 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 60 of file DWARFFormValue.h.

Constructor & Destructor Documentation

◆ DWARFFormValue()

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

Context for extract time.

Definition at line 91 of file DWARFFormValue.h.

Member Function Documentation

◆ dump()

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

◆ extractValue() [1/2]

bool DWARFFormValue::extractValue ( const DWARFDataExtractor Data,
uint32_t OffsetPtr,
DWARFFormParams  FormParams,
const DWARFContext Context = nullptr,
const DWARFUnit Unit = nullptr 
)

◆ extractValue() [2/2]

bool llvm::DWARFFormValue::extractValue ( const DWARFDataExtractor Data,
uint32_t OffsetPtr,
DWARFFormParams  FormParams,
const DWARFUnit U 
)
inline

Definition at line 119 of file DWARFFormValue.h.

◆ getAsAddress()

Optional< uint64_t > DWARFFormValue::getAsAddress ( ) const

Definition at line 632 of file DWARFFormValue.cpp.

References llvm::None.

◆ getAsBlock()

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

◆ getAsCString()

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

Definition at line 597 of file DWARFFormValue.cpp.

References C, and llvm::None.

Referenced by llvm::DWARFDebugLine::LineTable::getFileNameByIndex().

◆ getAsCStringOffset()

Optional< uint64_t > DWARFFormValue::getAsCStringOffset ( ) const

Definition at line 705 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::DWARFVerifier::handleDebugInfo().

◆ getAsReferenceUVal()

Optional< uint64_t > DWARFFormValue::getAsReferenceUVal ( ) const

Definition at line 711 of file DWARFFormValue.cpp.

References llvm::None.

◆ getAsSectionOffset()

Optional< uint64_t > DWARFFormValue::getAsSectionOffset ( ) const

Definition at line 666 of file DWARFFormValue.cpp.

References llvm::None.

Referenced by dumpLocation(), and llvm::DWARFVerifier::handleDebugInfo().

◆ getAsSignedConstant()

Optional< int64_t > DWARFFormValue::getAsSignedConstant ( ) const

Definition at line 679 of file DWARFFormValue.cpp.

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

◆ getAsUnsignedConstant()

Optional< uint64_t > DWARFFormValue::getAsUnsignedConstant ( ) const

◆ getFixedByteSize()

Optional< uint8_t > DWARFFormValue::getFixedByteSize ( dwarf::Form  Form,
const DWARFFormParams  FormParams 
)
static

Get the fixed byte size for a given form.

If the form has a fixed byte size, then an Optional with a value will be returned. If the form is always encoded using a variable length storage format (ULEB or SLEB numbers or blocks) then None will be returned.

Parameters
FormDWARF form to get the fixed byte size for.
FormParamsDWARF parameters to help interpret forms.
Returns
Optional<uint8_t> value with the fixed byte size or None if Form doesn't have a fixed byte size.

Definition at line 83 of file DWARFFormValue.cpp.

References llvm::DWARFFormParams::AddrSize, llvm::DWARFFormParams::getDwarfOffsetByteSize(), llvm::DWARFFormParams::getRefAddrByteSize(), llvm_unreachable, and llvm::None.

Referenced by llvm::DWARFAbbreviationDeclaration::extract(), llvm::DWARFAbbreviationDeclaration::AttributeSpec::getByteSize(), and skipValue().

◆ getForm()

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

◆ getRawUValue()

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

Definition at line 94 of file DWARFFormValue.h.

Referenced by llvm::DWARFVerifier::handleDebugInfo().

◆ getSectionIndex()

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

Definition at line 95 of file DWARFFormValue.h.

Referenced by llvm::DWARFUnit::getDWOId().

◆ getUnit()

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

Definition at line 107 of file DWARFFormValue.h.

References Context, llvm::Data, and llvm::dump().

◆ isFormClass()

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

◆ isInlinedCStr()

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

Definition at line 124 of file DWARFFormValue.h.

◆ setBlockValue()

void llvm::DWARFFormValue::setBlockValue ( const ArrayRef< uint8_t > &  Data)
inline

◆ setForm()

void llvm::DWARFFormValue::setForm ( dwarf::Form  F)
inline

◆ setPValue()

void llvm::DWARFFormValue::setPValue ( const char V)
inline

◆ setSValue()

void llvm::DWARFFormValue::setSValue ( int64_t  V)
inline

◆ setUValue()

void llvm::DWARFFormValue::setUValue ( uint64_t  V)
inline

Definition at line 97 of file DWARFFormValue.h.

◆ skipValue() [1/2]

bool llvm::DWARFFormValue::skipValue ( DataExtractor  DebugInfoData,
uint32_t OffsetPtr,
const DWARFFormParams  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 162 of file DWARFFormValue.h.

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

◆ skipValue() [2/2]

bool DWARFFormValue::skipValue ( dwarf::Form  Form,
DataExtractor  DebugInfoData,
uint32_t OffsetPtr,
const DWARFFormParams  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 170 of file DWARFFormValue.cpp.

References llvm::DataExtractor::getCStr(), getFixedByteSize(), llvm::DataExtractor::getSLEB128(), llvm::DataExtractor::getU16(), llvm::DataExtractor::getU32(), llvm::DataExtractor::getU8(), and llvm::DataExtractor::getULEB128().


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