LLDB mainline
Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
lldb_private::RegisterFlags::Field Class Reference

#include <RegisterFlags.h>

Public Member Functions

 Field (std::string name, unsigned start, unsigned end)
 Where start is the least significant bit and end is the most significant bit.
 
 Field (std::string name, unsigned start, unsigned end, const FieldEnum *enum_type)
 Construct a field that also has some known enum values.
 
 Field (std::string name, unsigned bit_position)
 Construct a field that occupies a single bit.
 
unsigned GetSizeInBits () const
 Get size of the field in bits. Will always be at least 1.
 
uint64_t GetMask () const
 A mask that covers all bits of the field.
 
uint64_t GetMaxValue () const
 The maximum unsigned value that could be contained in this field.
 
uint64_t GetValue (uint64_t register_value) const
 Extract value of the field from a whole register value.
 
const std::string & GetName () const
 
unsigned GetStart () const
 
unsigned GetEnd () const
 
const FieldEnumGetEnum () const
 
bool Overlaps (const Field &other) const
 
void DumpToLog (Log *log) const
 
unsigned PaddingDistance (const Field &other) const
 Return the number of bits between this field and the other, that are not covered by either field.
 
void ToXML (Stream &strm) const
 Output XML that describes this field, to be inserted into a target XML file.
 
bool operator< (const Field &rhs) const
 
bool operator== (const Field &rhs) const
 

Static Public Member Functions

static unsigned GetSizeInBits (unsigned start, unsigned end)
 Identical to GetSizeInBits, but for the GDB client to use.
 
static uint64_t GetMaxValue (unsigned start, unsigned end)
 Identical to GetMaxValue but for the GDB client to use.
 

Private Attributes

std::string m_name
 
unsigned m_start
 Start/end bit positions.
 
unsigned m_end
 
const FieldEnumm_enum_type
 

Detailed Description

Definition at line 61 of file RegisterFlags.h.

Constructor & Destructor Documentation

◆ Field() [1/3]

RegisterFlags::Field::Field ( std::string  name,
unsigned  start,
unsigned  end 
)

Where start is the least significant bit and end is the most significant bit.

The start bit must be <= the end bit.

Definition at line 21 of file RegisterFlags.cpp.

References m_end, and m_start.

◆ Field() [2/3]

RegisterFlags::Field::Field ( std::string  name,
unsigned  start,
unsigned  end,
const FieldEnum enum_type 
)

Construct a field that also has some known enum values.

Definition at line 31 of file RegisterFlags.cpp.

References lldb_private::FieldEnum::GetEnumerators(), GetMaxValue(), m_enum_type, and UNUSED_IF_ASSERT_DISABLED.

◆ Field() [3/3]

RegisterFlags::Field::Field ( std::string  name,
unsigned  bit_position 
)

Construct a field that occupies a single bit.

Definition at line 27 of file RegisterFlags.cpp.

Member Function Documentation

◆ DumpToLog()

void RegisterFlags::Field::DumpToLog ( Log log) const

Definition at line 50 of file RegisterFlags.cpp.

References LLDB_LOG.

◆ GetEnd()

unsigned lldb_private::RegisterFlags::Field::GetEnd ( ) const
inline

Definition at line 96 of file RegisterFlags.h.

References m_end.

Referenced by Overlaps().

◆ GetEnum()

const FieldEnum * lldb_private::RegisterFlags::Field::GetEnum ( ) const
inline

Definition at line 97 of file RegisterFlags.h.

References m_enum_type.

◆ GetMask()

uint64_t RegisterFlags::Field::GetMask ( ) const

A mask that covers all bits of the field.

Definition at line 106 of file RegisterFlags.cpp.

Referenced by GetValue().

◆ GetMaxValue() [1/2]

uint64_t RegisterFlags::Field::GetMaxValue ( ) const

The maximum unsigned value that could be contained in this field.

Definition at line 102 of file RegisterFlags.cpp.

Referenced by Field().

◆ GetMaxValue() [2/2]

uint64_t RegisterFlags::Field::GetMaxValue ( unsigned  start,
unsigned  end 
)
static

Identical to GetMaxValue but for the GDB client to use.

Definition at line 89 of file RegisterFlags.cpp.

References lldb_private::bits().

◆ GetName()

const std::string & lldb_private::RegisterFlags::Field::GetName ( ) const
inline

Definition at line 94 of file RegisterFlags.h.

References m_name.

◆ GetSizeInBits() [1/2]

unsigned RegisterFlags::Field::GetSizeInBits ( ) const

Get size of the field in bits. Will always be at least 1.

Definition at line 85 of file RegisterFlags.cpp.

Referenced by PaddingDistance().

◆ GetSizeInBits() [2/2]

unsigned RegisterFlags::Field::GetSizeInBits ( unsigned  start,
unsigned  end 
)
static

Identical to GetSizeInBits, but for the GDB client to use.

Definition at line 81 of file RegisterFlags.cpp.

◆ GetStart()

unsigned lldb_private::RegisterFlags::Field::GetStart ( ) const
inline

Definition at line 95 of file RegisterFlags.h.

References m_start.

Referenced by operator<(), Overlaps(), and PaddingDistance().

◆ GetValue()

uint64_t lldb_private::RegisterFlags::Field::GetValue ( uint64_t  register_value) const
inline

Extract value of the field from a whole register value.

Definition at line 90 of file RegisterFlags.h.

References GetMask(), and m_start.

◆ operator<()

bool lldb_private::RegisterFlags::Field::operator< ( const Field rhs) const
inline

Definition at line 110 of file RegisterFlags.h.

References GetStart().

◆ operator==()

bool lldb_private::RegisterFlags::Field::operator== ( const Field rhs) const
inline

Definition at line 114 of file RegisterFlags.h.

References m_end, m_name, and m_start.

◆ Overlaps()

bool RegisterFlags::Field::Overlaps ( const Field other) const

Definition at line 55 of file RegisterFlags.cpp.

References GetEnd(), and GetStart().

◆ PaddingDistance()

unsigned RegisterFlags::Field::PaddingDistance ( const Field other) const

Return the number of bits between this field and the other, that are not covered by either field.

Definition at line 61 of file RegisterFlags.cpp.

References GetSizeInBits(), and GetStart().

◆ ToXML()

void RegisterFlags::Field::ToXML ( Stream strm) const

Output XML that describes this field, to be inserted into a target XML file.

Reserved characters in field names like "<" are replaced with their XML safe equivalents like "&gt;".

Definition at line 402 of file RegisterFlags.cpp.

References GetName(), lldb_private::Stream::Indent(), and lldb_private::Stream::Printf().

Member Data Documentation

◆ m_end

unsigned lldb_private::RegisterFlags::Field::m_end
private

Definition at line 127 of file RegisterFlags.h.

Referenced by Field(), GetEnd(), and operator==().

◆ m_enum_type

const FieldEnum* lldb_private::RegisterFlags::Field::m_enum_type
private

Definition at line 129 of file RegisterFlags.h.

Referenced by Field(), and GetEnum().

◆ m_name

std::string lldb_private::RegisterFlags::Field::m_name
private

Definition at line 120 of file RegisterFlags.h.

Referenced by GetName(), and operator==().

◆ m_start

unsigned lldb_private::RegisterFlags::Field::m_start
private

Start/end bit positions.

Where start N, end N means a single bit field at position N. We expect that start <= end. Bit positions begin at 0. Start is the LSB, end is the MSB.

Definition at line 126 of file RegisterFlags.h.

Referenced by Field(), GetStart(), GetValue(), and operator==().


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