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

#include <RegisterFlags.h>

Classes

class  Field
 

Public Member Functions

 RegisterFlags (std::string id, unsigned size, const std::vector< Field > &fields)
 This assumes that:
 
void SetFields (const std::vector< Field > &fields)
 Replace all the fields with the new set of fields.
 
std::string DumpEnums (uint32_t max_width) const
 Make a string where each line contains the name of a field that has enum values, and lists what those values are.
 
template<typename T >
ReverseFieldOrder (T value) const
 
const std::vector< Field > & GetFields () const
 
const std::string & GetID () const
 
unsigned GetSize () const
 
void DumpToLog (Log *log) const
 
std::string AsTable (uint32_t max_width) const
 Produce a text table showing the layout of all the fields.
 
void ToXML (Stream &strm) const
 Output XML that describes this set of flags.
 
void EnumsToXML (Stream &strm, llvm::StringSet<> &seen) const
 Enum types must be defined before use, and GDBRemoteCommunicationServerLLGS view of the register types is based only on the registers.
 

Private Attributes

const std::string m_id
 
const unsigned m_size
 Size in bytes.
 
std::vector< Fieldm_fields
 

Detailed Description

Definition at line 59 of file RegisterFlags.h.

Constructor & Destructor Documentation

◆ RegisterFlags()

RegisterFlags::RegisterFlags ( std::string  id,
unsigned  size,
const std::vector< Field > &  fields 
)

This assumes that:

  • There is at least one field.
  • The fields are sorted in descending order. Gaps are allowed, they will be filled with anonymous padding fields.

Definition at line 149 of file RegisterFlags.cpp.

Member Function Documentation

◆ AsTable()

std::string RegisterFlags::AsTable ( uint32_t  max_width) const

Produce a text table showing the layout of all the fields.

Unnamed/padding fields will be included, with only their positions shown. max_width will be the width in characters of the terminal you are going to print the table to. If the table would exceed this width, it will be split into many tables as needed.

Definition at line 188 of file RegisterFlags.cpp.

References EmitTable(), FormatCell(), lldb_private::StreamString::GetString(), m_fields, and lldb_private::Stream::Printf().

◆ DumpEnums()

std::string RegisterFlags::DumpEnums ( uint32_t  max_width) const

Make a string where each line contains the name of a field that has enum values, and lists what those values are.

Definition at line 288 of file RegisterFlags.cpp.

References DumpEnumerators(), lldb_private::FieldEnum::GetEnumerators(), lldb_private::StreamString::GetString(), and m_fields.

◆ DumpToLog()

void RegisterFlags::DumpToLog ( Log log) const

Definition at line 155 of file RegisterFlags.cpp.

◆ EnumsToXML()

void RegisterFlags::EnumsToXML ( Stream strm,
llvm::StringSet<> &  seen 
) const

Enum types must be defined before use, and GDBRemoteCommunicationServerLLGS view of the register types is based only on the registers.

So this method emits any enum types that the upcoming set of fields may need. "seen" is a set of Enum IDs that we have already printed, that is updated with any printed by this call. This prevents us printing the same enum multiple times.

Definition at line 319 of file RegisterFlags.cpp.

References GetSize(), and m_fields.

Referenced by lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::BuildTargetXml().

◆ GetFields()

const std::vector< Field > & lldb_private::RegisterFlags::GetFields ( ) const
inline

◆ GetID()

const std::string & lldb_private::RegisterFlags::GetID ( ) const
inline

◆ GetSize()

unsigned lldb_private::RegisterFlags::GetSize ( ) const
inline

Definition at line 167 of file RegisterFlags.h.

References m_size.

Referenced by EnumsToXML(), lldb_private::RegisterTypeBuilderClang::GetRegisterType(), and ToXML().

◆ ReverseFieldOrder()

template<typename T >
T lldb_private::RegisterFlags::ReverseFieldOrder ( value) const
inline

Definition at line 154 of file RegisterFlags.h.

References GetFields().

Referenced by dump_type_value().

◆ SetFields()

void RegisterFlags::SetFields ( const std::vector< Field > &  fields)

Replace all the fields with the new set of fields.

All the assumptions and checks apply as when you use the constructor. Intended to only be used when runtime field detection is needed.

Definition at line 110 of file RegisterFlags.cpp.

◆ ToXML()

void RegisterFlags::ToXML ( Stream strm) const

Member Data Documentation

◆ m_fields

std::vector<Field> lldb_private::RegisterFlags::m_fields
private

Definition at line 193 of file RegisterFlags.h.

Referenced by AsTable(), DumpEnums(), EnumsToXML(), GetFields(), and ToXML().

◆ m_id

const std::string lldb_private::RegisterFlags::m_id
private

Definition at line 190 of file RegisterFlags.h.

Referenced by lldb_private::FieldEnum::DumpToLog(), and GetID().

◆ m_size

const unsigned lldb_private::RegisterFlags::m_size
private

Size in bytes.

Definition at line 192 of file RegisterFlags.h.

Referenced by GetSize().


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