LLDB mainline
lldb_private::RegisterTypeFlags Class Reference

#include <RegisterTypeFlags.h>

Inheritance diagram for lldb_private::RegisterTypeFlags:
[legend]

Classes

class  Field

Public Member Functions

 RegisterTypeFlags (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
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.
virtual void ToXMLElement (Stream &strm, const RegisterType *user=nullptr) const override
 Output the register type as an XML element.
Public Member Functions inherited from lldb_private::RegisterType
RegisterTypeKind getKind () const
 RegisterType (RegisterTypeKind kind, std::string id)
void ToXML (Stream &strm, std::unordered_set< const RegisterType * > &previously_emitted, const RegisterType *user=nullptr) const
 Output XML that describes this type, to be inserted into a target XML file.
virtual ~RegisterType ()=default
const std::string & GetID () const
void SetDependencies (std::vector< const RegisterType * > dependencies)

Static Public Member Functions

static bool classof (const RegisterType *register_type)

Private Attributes

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

Additional Inherited Members

Public Types inherited from lldb_private::RegisterType
enum  RegisterTypeKind { eRegisterTypeKindFlags , eRegisterTypeKindEnum }

Detailed Description

Definition at line 62 of file RegisterTypeFlags.h.

Constructor & Destructor Documentation

◆ RegisterTypeFlags()

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

Member Function Documentation

◆ AsTable()

std::string RegisterTypeFlags::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 197 of file RegisterTypeFlags.cpp.

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

◆ classof()

bool lldb_private::RegisterTypeFlags::classof ( const RegisterType * register_type)
inlinestatic

◆ DumpEnums()

std::string RegisterTypeFlags::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 297 of file RegisterTypeFlags.cpp.

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

◆ DumpToLog()

void RegisterTypeFlags::DumpToLog ( Log * log) const

Definition at line 164 of file RegisterTypeFlags.cpp.

References ID, m_fields, and m_size.

◆ GetFields()

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

◆ GetSize()

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

Definition at line 166 of file RegisterTypeFlags.h.

References m_size.

Referenced by lldb_private::RegisterTypeBuilderClang::BuildFlagsType(), and ToXMLElement().

◆ ReverseFieldOrder()

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

Definition at line 154 of file RegisterTypeFlags.h.

References GetFields().

Referenced by dump_type_value().

◆ SetFields()

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

◆ ToXMLElement()

void RegisterTypeFlags::ToXMLElement ( Stream & strm,
const RegisterType * user = nullptr ) const
overridevirtual

Output the register type as an XML element.

That is, "<foo ...>" until the closing </foo>, including any child types in between. For example the flags in a register flag set.

Implements lldb_private::RegisterType.

Definition at line 384 of file RegisterTypeFlags.cpp.

References lldb_private::RegisterType::GetID(), GetSize(), lldb_private::Stream::Indent(), lldb_private::Stream::IndentLess(), lldb_private::Stream::IndentMore(), m_fields, lldb_private::Stream::Printf(), lldb_private::Stream::PutChar(), and lldb_private::RegisterType::RegisterType().

Member Data Documentation

◆ m_fields

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

Definition at line 187 of file RegisterTypeFlags.h.

Referenced by AsTable(), DumpEnums(), DumpToLog(), GetFields(), and ToXMLElement().

◆ m_size

const unsigned lldb_private::RegisterTypeFlags::m_size
private

Size in bytes.

Definition at line 186 of file RegisterTypeFlags.h.

Referenced by DumpToLog(), and GetSize().


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