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

#include <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))
 
dwarf::Form getForm () const
 
void setForm (dwarf::Form F)
 
void setUValue (uint64_t V)
 
void setSValue (int64_t V)
 
void setPValue (const char *V)
 
bool isFormClass (FormClass FC) const
 
const DWARFUnitgetUnit () const
 
void dump (raw_ostream &OS) const
 
bool extractValue (const DataExtractor &Data, uint32_t *OffsetPtr, const DWARFUnit *U)
 extracts a value in data at offset *offset_ptr. More...
 
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 debug_info_data, uint32_t *offset_ptr, const DWARFUnit *U) const
 Skip a form in debug_info_data at offset specified by offset_ptr. More...
 

Static Public Member Functions

static Optional< uint8_t > getFixedByteSize (dwarf::Form Form, const DWARFUnit *U=nullptr)
 Get the fixed byte size for a given form. More...
 
static Optional< uint8_t > getFixedByteSize (dwarf::Form Form, uint16_t Version, uint8_t AddrSize, llvm::dwarf::DwarfFormat Format)
 Get the fixed byte size for a given form. More...
 
static bool skipValue (dwarf::Form form, DataExtractor debug_info_data, uint32_t *offset_ptr, const DWARFUnit *U)
 Skip a form in debug_info_data at offset specified by offset_ptr. More...
 
static bool skipValue (dwarf::Form form, DataExtractor debug_info_data, uint32_t *offset_ptr, uint16_t Version, uint8_t AddrSize, llvm::dwarf::DwarfFormat Format)
 Skip a form in debug_info_data at offset specified by offset_ptr. More...
 

Detailed Description

Definition at line 23 of file DWARFFormValue.h.

Member Enumeration Documentation

Enumerator
FC_Unknown 
FC_Address 
FC_Block 
FC_Constant 
FC_String 
FC_Flag 
FC_Reference 
FC_Indirect 
FC_SectionOffset 
FC_Exprloc 

Definition at line 25 of file DWARFFormValue.h.

Constructor & Destructor Documentation

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

Definition at line 57 of file DWARFFormValue.h.

Member Function Documentation

void DWARFFormValue::dump ( raw_ostream OS) const
bool DWARFFormValue::extractValue ( const DataExtractor Data,
uint32_t OffsetPtr,
const DWARFUnit U 
)

extracts a value in data at offset *offset_ptr.

The passed DWARFUnit is allowed to be nullptr, in which case no relocation processing will be performed and some kind of forms that depend on Unit information are disallowed.

Returns
whether the extraction succeeded.

Definition at line 295 of file DWARFFormValue.cpp.

References llvm::StringRef::data(), llvm::StringRef::empty(), llvm::DataExtractor::getCStr(), llvm::DataExtractor::getData(), llvm::DataExtractor::getSLEB128(), llvm::DataExtractor::getU16(), llvm::DataExtractor::getU32(), llvm::DataExtractor::getU64(), llvm::DataExtractor::getU8(), llvm::DataExtractor::getULEB128(), llvm::DataExtractor::getUnsigned(), and llvm::StringRef::substr().

Referenced by llvm::DWARFAbbreviationDeclaration::getAttributeValue().

Optional< uint64_t > DWARFFormValue::getAsAddress ( ) const

Definition at line 595 of file DWARFFormValue.cpp.

References llvm::None.

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

Definition at line 660 of file DWARFFormValue.cpp.

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

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

Definition at line 574 of file DWARFFormValue.cpp.

References llvm::None, and Offset.

Optional< uint64_t > DWARFFormValue::getAsCStringOffset ( ) const

Definition at line 666 of file DWARFFormValue.cpp.

References llvm::None.

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

References llvm::None.

Optional< uint64_t > DWARFFormValue::getAsReferenceUVal ( ) const

Definition at line 672 of file DWARFFormValue.cpp.

References llvm::None.

Optional< uint64_t > DWARFFormValue::getAsSectionOffset ( ) const

Definition at line 629 of file DWARFFormValue.cpp.

References llvm::None.

Optional< int64_t > DWARFFormValue::getAsSignedConstant ( ) const

Definition at line 642 of file DWARFFormValue.cpp.

References llvm::None.

Optional< uint64_t > DWARFFormValue::getAsUnsignedConstant ( ) const

Definition at line 635 of file DWARFFormValue.cpp.

References llvm::None.

Optional< uint8_t > DWARFFormValue::getFixedByteSize ( dwarf::Form  Form,
const DWARFUnit U = nullptr 
)
static

Get the fixed byte size for a given form.

If the form always has a fixed valid byte size that doesn't depend on a DWARFUnit, then an Optional with a value will be returned. If the form can vary in size depending on the DWARFUnit (DWARF version, address byte size, or DWARF 32/64) and the DWARFUnit is valid, then an Optional with a valid value is returned. If the form is always encoded using a variable length storage format (ULEB or SLEB numbers or blocks) or the size depends on a DWARFUnit and the DWARFUnit is NULL, then None will be returned.

Parameters
FormThe DWARF form to get the fixed byte size for
UThe DWARFUnit that can be used to help determine the byte size.
Returns
Optional<uint8_t> value with the fixed byte size or None if Form doesn't have a fixed byte size or a DWARFUnit wasn't supplied and was needed to calculate the byte size.

Definition at line 255 of file DWARFFormValue.cpp.

References getFixedByteSize().

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

Optional< uint8_t > DWARFFormValue::getFixedByteSize ( dwarf::Form  Form,
uint16_t  Version,
uint8_t  AddrSize,
llvm::dwarf::DwarfFormat  Format 
)
static

Get the fixed byte size for a given form.

If the form has a fixed byte size given a valid DWARF version and address byte size, then an Optional with a valid value is 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
VersionDWARF version number.
AddrSizesize of an address in bytes.
Formatenum value from llvm::dwarf::DwarfFormat.
Returns
Optional<uint8_t> value with the fixed byte size or None if Form doesn't have a fixed byte size.

Definition at line 261 of file DWARFFormValue.cpp.

References getFixedByteSize().

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

Definition at line 58 of file DWARFFormValue.h.

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

Definition at line 64 of file DWARFFormValue.h.

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

Definition at line 268 of file DWARFFormValue.cpp.

References DWARF4FormClasses, and llvm::makeArrayRef().

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

Definition at line 75 of file DWARFFormValue.h.

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

Definition at line 59 of file DWARFFormValue.h.

References F.

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

Definition at line 62 of file DWARFFormValue.h.

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

Definition at line 60 of file DWARFFormValue.h.

bool DWARFFormValue::skipValue ( DataExtractor  debug_info_data,
uint32_t offset_ptr,
const DWARFUnit U 
) const

Skip a form in debug_info_data at offset specified by offset_ptr.

Skips the bytes for this form in the debug info and updates the offset.

Parameters
debug_info_datathe .debug_info data to use to skip the value.
offset_ptra reference to the offset that will be updated.
Uthe DWARFUnit to use when skipping the form in case the form size differs according to data in the DWARFUnit.
Returns
true on success, false if the form was not skipped.

Definition at line 419 of file DWARFFormValue.cpp.

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

bool DWARFFormValue::skipValue ( dwarf::Form  form,
DataExtractor  debug_info_data,
uint32_t offset_ptr,
const DWARFUnit U 
)
static

Skip a form in debug_info_data at offset specified by offset_ptr.

Skips the bytes for this form in the debug info and updates the offset.

Parameters
formthe DW_FORM enumeration that indicates the form to skip.
debug_info_datathe .debug_info data to use to skip the value.
offset_ptra reference to the offset that will be updated.
Uthe DWARFUnit to use when skipping the form in case the form size differs according to data in the DWARFUnit.
Returns
true on success, false if the form was not skipped.

Definition at line 424 of file DWARFFormValue.cpp.

References skipFormValue().

bool DWARFFormValue::skipValue ( dwarf::Form  form,
DataExtractor  debug_info_data,
uint32_t offset_ptr,
uint16_t  Version,
uint8_t  AddrSize,
llvm::dwarf::DwarfFormat  Format 
)
static

Skip a form in debug_info_data at offset specified by offset_ptr.

Skips the bytes for this form in the debug info and updates the offset.

Parameters
formthe DW_FORM enumeration that indicates the form to skip.
debug_info_datathe .debug_info data to use to skip the value.
offset_ptra reference to the offset that will be updated.
VersionDWARF version number.
AddrSizesize of an address in bytes.
Formatenum value from llvm::dwarf::DwarfFormat.
Returns
true on success, false if the form was not skipped.

Definition at line 429 of file DWARFFormValue.cpp.

References skipFormValue().


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