LLDB mainline
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 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 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
 
bool Overlaps (const Field &other) const
 
void log (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 (StreamString &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
 

Private Attributes

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

Detailed Description

Definition at line 23 of file RegisterFlags.h.

Constructor & Destructor Documentation

◆ Field() [1/2]

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 20 of file RegisterFlags.cpp.

References m_end, and m_start.

◆ Field() [2/2]

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

Construct a field that occupies a single bit.

Definition at line 30 of file RegisterFlags.h.

Member Function Documentation

◆ GetEnd()

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

Definition at line 48 of file RegisterFlags.h.

References m_end.

Referenced by Overlaps(), and ToXML().

◆ GetMask()

uint64_t lldb_private::RegisterFlags::Field::GetMask ( ) const
inline

A mask that covers all bits of the field.

Definition at line 37 of file RegisterFlags.h.

References GetSizeInBits(), and m_start.

Referenced by GetValue().

◆ GetName()

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

Definition at line 46 of file RegisterFlags.h.

References m_name.

Referenced by ToXML().

◆ GetSizeInBits()

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

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

Definition at line 34 of file RegisterFlags.h.

References m_end, and m_start.

Referenced by GetMask(), and PaddingDistance().

◆ GetStart()

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

Definition at line 47 of file RegisterFlags.h.

References m_start.

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

◆ 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 42 of file RegisterFlags.h.

References GetMask(), and m_start.

◆ log()

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

Definition at line 25 of file RegisterFlags.cpp.

References LLDB_LOG, and lldb_private::RegisterFlags::log().

◆ operator<()

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

Definition at line 61 of file RegisterFlags.h.

References GetStart().

◆ operator==()

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

Definition at line 65 of file RegisterFlags.h.

References m_end, m_name, and m_start.

◆ Overlaps()

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

Definition at line 30 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 36 of file RegisterFlags.cpp.

References GetSizeInBits(), and GetStart().

◆ ToXML()

void RegisterFlags::Field::ToXML ( StreamString 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 216 of file RegisterFlags.cpp.

References GetEnd(), GetName(), GetStart(), 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 77 of file RegisterFlags.h.

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

◆ m_name

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

Definition at line 71 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 76 of file RegisterFlags.h.

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


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