LLDB mainline
lldb_private::RegisterTypeFlags::Field Class Reference

#include <RegisterTypeFlags.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 RegisterTypeEnum *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 RegisterTypeEnumGetEnum () 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 ToXMLElement (Stream &strm) const
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 RegisterTypeEnumm_enum_type

Detailed Description

Definition at line 64 of file RegisterTypeFlags.h.

Constructor & Destructor Documentation

◆ Field() [1/3]

RegisterTypeFlags::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 24 of file RegisterTypeFlags.cpp.

References m_end, m_enum_type, m_name, and m_start.

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

◆ Field() [2/3]

RegisterTypeFlags::Field::Field ( std::string name,
unsigned start,
unsigned end,
const RegisterTypeEnum * enum_type )

Construct a field that also has some known enum values.

Definition at line 34 of file RegisterTypeFlags.cpp.

References GetMaxValue(), m_end, m_enum_type, m_name, m_start, and UNUSED_IF_ASSERT_DISABLED.

◆ Field() [3/3]

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

Construct a field that occupies a single bit.

Definition at line 30 of file RegisterTypeFlags.cpp.

References m_end, m_enum_type, m_name, and m_start.

Member Function Documentation

◆ DumpToLog()

void RegisterTypeFlags::Field::DumpToLog ( Log * log) const

Definition at line 53 of file RegisterTypeFlags.cpp.

References LLDB_LOG, m_end, m_name, and m_start.

◆ GetEnd()

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

Definition at line 99 of file RegisterTypeFlags.h.

References m_end.

Referenced by Overlaps(), and ToXMLElement().

◆ GetEnum()

const RegisterTypeEnum * lldb_private::RegisterTypeFlags::Field::GetEnum ( ) const
inline

Definition at line 100 of file RegisterTypeFlags.h.

References m_enum_type.

Referenced by ToXMLElement().

◆ GetMask()

uint64_t RegisterTypeFlags::Field::GetMask ( ) const

A mask that covers all bits of the field.

Definition at line 109 of file RegisterTypeFlags.cpp.

Referenced by GetValue().

◆ GetMaxValue() [1/2]

uint64_t RegisterTypeFlags::Field::GetMaxValue ( ) const

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

Definition at line 105 of file RegisterTypeFlags.cpp.

Referenced by Field().

◆ GetMaxValue() [2/2]

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

Identical to GetMaxValue but for the GDB client to use.

Definition at line 92 of file RegisterTypeFlags.cpp.

References lldb_private::bits(), and GetSizeInBits().

◆ GetName()

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

Definition at line 97 of file RegisterTypeFlags.h.

References m_name.

◆ GetSizeInBits() [1/2]

unsigned RegisterTypeFlags::Field::GetSizeInBits ( ) const

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

Definition at line 88 of file RegisterTypeFlags.cpp.

References GetSizeInBits(), m_end, and m_start.

Referenced by GetMaxValue(), GetSizeInBits(), and PaddingDistance().

◆ GetSizeInBits() [2/2]

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

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

Definition at line 84 of file RegisterTypeFlags.cpp.

◆ GetStart()

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

Definition at line 98 of file RegisterTypeFlags.h.

References m_start.

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

◆ GetValue()

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

Extract value of the field from a whole register value.

Definition at line 93 of file RegisterTypeFlags.h.

References GetMask(), and m_start.

◆ operator<()

bool lldb_private::RegisterTypeFlags::Field::operator< ( const Field & rhs) const
inline

Definition at line 110 of file RegisterTypeFlags.h.

References Field(), and GetStart().

◆ operator==()

bool lldb_private::RegisterTypeFlags::Field::operator== ( const Field & rhs) const
inline

Definition at line 114 of file RegisterTypeFlags.h.

References Field(), m_end, m_name, and m_start.

◆ Overlaps()

bool RegisterTypeFlags::Field::Overlaps ( const Field & other) const

Definition at line 58 of file RegisterTypeFlags.cpp.

References Field(), GetEnd(), and GetStart().

◆ PaddingDistance()

unsigned RegisterTypeFlags::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 64 of file RegisterTypeFlags.cpp.

References Field(), GetSizeInBits(), GetStart(), and Overlaps().

◆ ToXMLElement()

void RegisterTypeFlags::Field::ToXMLElement ( Stream & strm) const

Member Data Documentation

◆ m_end

unsigned lldb_private::RegisterTypeFlags::Field::m_end
private

Definition at line 127 of file RegisterTypeFlags.h.

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

◆ m_enum_type

const RegisterTypeEnum* lldb_private::RegisterTypeFlags::Field::m_enum_type
private

Definition at line 129 of file RegisterTypeFlags.h.

Referenced by Field(), Field(), Field(), and GetEnum().

◆ m_name

std::string lldb_private::RegisterTypeFlags::Field::m_name
private

Definition at line 120 of file RegisterTypeFlags.h.

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

◆ m_start

unsigned lldb_private::RegisterTypeFlags::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 RegisterTypeFlags.h.

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


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