LLDB mainline
lldb_private::ValueObjectPrinter Class Reference

#include <ValueObjectPrinter.h>

Public Member Functions

 ValueObjectPrinter (ValueObject &valobj, Stream *s)
 The ValueObjectPrinter is a one-shot printer for ValueObjects.
 ValueObjectPrinter (ValueObject &valobj, Stream *s, const DumpValueObjectOptions &options)
 ~ValueObjectPrinter ()=default
llvm::Error PrintValueObject ()

Protected Types

typedef std::set< uint64_t > InstancePointersSet
typedef std::shared_ptr< InstancePointersSetInstancePointersSetSP

Protected Member Functions

 ValueObjectPrinter (ValueObject &valobj, Stream *s, const DumpValueObjectOptions &options, const DumpValueObjectOptions::PointerDepth &ptr_depth, uint32_t curr_depth, InstancePointersSetSP printed_instance_pointers)
 Only this class (and subclasses, if any) should ever be concerned with the depth mechanism.
void Init (ValueObject &valobj, Stream *s, const DumpValueObjectOptions &options, const DumpValueObjectOptions::PointerDepth &ptr_depth, uint32_t curr_depth, InstancePointersSetSP printed_instance_pointers)
 Ee should actually be using delegating constructors here but some versions of GCC still have trouble with those.
ValueObjectGetMostSpecializedValue ()
 Cache the ValueObject we are actually going to print.
void SetupMostSpecializedValue ()
const char * GetRootNameForDisplay ()
bool ShouldPrintValueObject ()
bool IsNil ()
bool IsUninitialized ()
bool IsPtr ()
bool IsRef ()
bool IsInstancePointer ()
bool IsAggregate ()
bool PrintLocationIfNeeded ()
void PrintDecl ()
bool CheckScopeIfNeeded ()
bool ShouldPrintEmptyBrackets (bool value_printed, bool summary_printed)
TypeSummaryImplGetSummaryFormatter (bool null_if_omitted=true)
void GetValueSummaryError (std::string &value, std::string &summary, std::string &error)
bool PrintValueAndSummaryIfNeeded (bool &value_printed, bool &summary_printed)
void PrintObjectDescriptionIfNeeded (std::optional< std::string > object_desc)
bool ShouldPrintChildren (DumpValueObjectOptions::PointerDepth &curr_ptr_depth)
bool ShouldExpandEmptyAggregates ()
ValueObjectGetValueObjectForChildrenGeneration ()
void PrintChildrenPreamble (bool value_printed, bool summary_printed)
void PrintChildrenPostamble (bool print_dotdotdot)
lldb::ValueObjectSP GenerateChild (ValueObject &synth_valobj, size_t idx)
void PrintChild (lldb::ValueObjectSP child_sp, const DumpValueObjectOptions::PointerDepth &curr_ptr_depth)
llvm::Expected< uint32_t > GetMaxNumChildrenToPrint (bool &print_dotdotdot)
void PrintChildren (bool value_printed, bool summary_printed, const DumpValueObjectOptions::PointerDepth &curr_ptr_depth)
llvm::Error PrintChildrenIfNeeded (bool value_printed, bool summary_printed)
bool PrintChildrenOneLiner (bool hide_names)
bool HasReachedMaximumDepth ()

Protected Attributes

InstancePointersSetSP m_printed_instance_pointers

Private Member Functions

bool ShouldShowName () const
bool ShouldPrintObjectDescription ()
 ValueObjectPrinter (const ValueObjectPrinter &)=delete
const ValueObjectPrinteroperator= (const ValueObjectPrinter &)=delete

Private Attributes

ValueObjectm_orig_valobj
ValueObjectm_cached_valobj
 Cache the current "most specialized" value.
Streamm_stream
DumpValueObjectOptions m_options
Flags m_type_flags
CompilerType m_compiler_type
DumpValueObjectOptions::PointerDepth m_ptr_depth
uint32_t m_curr_depth
LazyBool m_should_print
LazyBool m_is_nil
LazyBool m_is_uninit
LazyBool m_is_ptr
LazyBool m_is_ref
LazyBool m_is_aggregate
LazyBool m_is_instance_ptr
std::pair< TypeSummaryImpl *, boolm_summary_formatter
std::string m_value
std::string m_summary
std::string m_error
bool m_val_summary_ok

Friends

struct StringSummaryFormat

Detailed Description

Definition at line 22 of file ValueObjectPrinter.h.

Member Typedef Documentation

◆ InstancePointersSet

typedef std::set<uint64_t> lldb_private::ValueObjectPrinter::InstancePointersSet
protected

Definition at line 39 of file ValueObjectPrinter.h.

◆ InstancePointersSetSP

Definition at line 40 of file ValueObjectPrinter.h.

Constructor & Destructor Documentation

◆ ValueObjectPrinter() [1/4]

ValueObjectPrinter::ValueObjectPrinter ( ValueObject & valobj,
Stream * s )

The ValueObjectPrinter is a one-shot printer for ValueObjects.

It does not retain the ValueObject it is printing, that is the job of its caller. It also doesn't attempt to track changes in the ValueObject, e.g. changing synthetic child providers or changing dynamic versus static versus synthetic settings.

Definition at line 26 of file ValueObjectPrinter.cpp.

References Init(), m_options, and m_orig_valobj.

Referenced by operator=(), PrintChild(), and ValueObjectPrinter().

◆ ValueObjectPrinter() [2/4]

ValueObjectPrinter::ValueObjectPrinter ( ValueObject & valobj,
Stream * s,
const DumpValueObjectOptions & options )

Definition at line 32 of file ValueObjectPrinter.cpp.

References Init(), m_options, and m_orig_valobj.

◆ ~ValueObjectPrinter()

lldb_private::ValueObjectPrinter::~ValueObjectPrinter ( )
default

◆ ValueObjectPrinter() [3/4]

ValueObjectPrinter::ValueObjectPrinter ( ValueObject & valobj,
Stream * s,
const DumpValueObjectOptions & options,
const DumpValueObjectOptions::PointerDepth & ptr_depth,
uint32_t curr_depth,
InstancePointersSetSP printed_instance_pointers )
protected

Only this class (and subclasses, if any) should ever be concerned with the depth mechanism.

Definition at line 38 of file ValueObjectPrinter.cpp.

References Init(), and m_orig_valobj.

◆ ValueObjectPrinter() [4/4]

lldb_private::ValueObjectPrinter::ValueObjectPrinter ( const ValueObjectPrinter & )
privatedelete

References ValueObjectPrinter().

Member Function Documentation

◆ CheckScopeIfNeeded()

bool ValueObjectPrinter::CheckScopeIfNeeded ( )
protected

◆ GenerateChild()

ValueObjectSP ValueObjectPrinter::GenerateChild ( ValueObject & synth_valobj,
size_t idx )
protected

◆ GetMaxNumChildrenToPrint()

llvm::Expected< uint32_t > ValueObjectPrinter::GetMaxNumChildrenToPrint ( bool & print_dotdotdot)
protected

◆ GetMostSpecializedValue()

ValueObject & ValueObjectPrinter::GetMostSpecializedValue ( )
protected

Cache the ValueObject we are actually going to print.

If this ValueObject has a Dynamic type, we return that, if either the original ValueObject or its Dynamic type has a Synthetic provider, return that. This will never return an empty ValueObject, since we use the ValueObject to carry errors. Note, this gets called when making the printer object, and uses the use dynamic and use synthetic settings of the ValueObject being printed, so changes made to these settings won't affect already made ValueObjectPrinters. SetupMostSpecializedValue();

Access the cached "most specialized value" - that is the one to use for printing the value object's value. However, be sure to use GetValueForChildGeneration when you are generating the children of this value.

Definition at line 135 of file ValueObjectPrinter.cpp.

References m_cached_valobj.

Referenced by CheckScopeIfNeeded(), GetMaxNumChildrenToPrint(), GetRootNameForDisplay(), GetSummaryFormatter(), GetValueObjectForChildrenGeneration(), GetValueSummaryError(), IsInstancePointer(), IsNil(), IsUninitialized(), PrintChildren(), PrintChildrenIfNeeded(), PrintChildrenPostamble(), PrintDecl(), PrintLocationIfNeeded(), PrintValueAndSummaryIfNeeded(), PrintValueObject(), and ShouldPrintChildren().

◆ GetRootNameForDisplay()

const char * ValueObjectPrinter::GetRootNameForDisplay ( )
protected

◆ GetSummaryFormatter()

◆ GetValueObjectForChildrenGeneration()

ValueObject & ValueObjectPrinter::GetValueObjectForChildrenGeneration ( )
protected

◆ GetValueSummaryError()

◆ HasReachedMaximumDepth()

bool ValueObjectPrinter::HasReachedMaximumDepth ( )
protected

Definition at line 862 of file ValueObjectPrinter.cpp.

References m_curr_depth, and m_options.

Referenced by PrintChildrenIfNeeded(), and ShouldPrintChildren().

◆ Init()

void ValueObjectPrinter::Init ( ValueObject & valobj,
Stream * s,
const DumpValueObjectOptions & options,
const DumpValueObjectOptions::PointerDepth & ptr_depth,
uint32_t curr_depth,
InstancePointersSetSP printed_instance_pointers )
protected

◆ IsAggregate()

bool ValueObjectPrinter::IsAggregate ( )
protected

◆ IsInstancePointer()

◆ IsNil()

◆ IsPtr()

bool ValueObjectPrinter::IsPtr ( )
protected

◆ IsRef()

◆ IsUninitialized()

◆ operator=()

const ValueObjectPrinter & lldb_private::ValueObjectPrinter::operator= ( const ValueObjectPrinter & )
privatedelete

References ValueObjectPrinter().

◆ PrintChild()

◆ PrintChildren()

◆ PrintChildrenIfNeeded()

◆ PrintChildrenOneLiner()

◆ PrintChildrenPostamble()

void ValueObjectPrinter::PrintChildrenPostamble ( bool print_dotdotdot)
protected

Definition at line 652 of file ValueObjectPrinter.cpp.

References GetMostSpecializedValue(), m_options, and m_stream.

Referenced by PrintChildren().

◆ PrintChildrenPreamble()

void ValueObjectPrinter::PrintChildrenPreamble ( bool value_printed,
bool summary_printed )
protected

Definition at line 572 of file ValueObjectPrinter.cpp.

References IsRef(), m_options, m_stream, ShouldPrintValueObject(), and ShouldShowName().

Referenced by PrintChildren().

◆ PrintDecl()

◆ PrintLocationIfNeeded()

bool ValueObjectPrinter::PrintLocationIfNeeded ( )
protected

Definition at line 246 of file ValueObjectPrinter.cpp.

References GetMostSpecializedValue(), m_options, and m_stream.

Referenced by PrintValueObject().

◆ PrintObjectDescriptionIfNeeded()

void ValueObjectPrinter::PrintObjectDescriptionIfNeeded ( std::optional< std::string > object_desc)
protected

Definition at line 488 of file ValueObjectPrinter.cpp.

References m_options, m_stream, maybeNewline(), and ShouldShowName().

Referenced by PrintValueObject().

◆ PrintValueAndSummaryIfNeeded()

◆ PrintValueObject()

◆ SetupMostSpecializedValue()

void ValueObjectPrinter::SetupMostSpecializedValue ( )
protected

◆ ShouldExpandEmptyAggregates()

bool ValueObjectPrinter::ShouldExpandEmptyAggregates ( )
protected

◆ ShouldPrintChildren()

◆ ShouldPrintEmptyBrackets()

bool ValueObjectPrinter::ShouldPrintEmptyBrackets ( bool value_printed,
bool summary_printed )
protected

◆ ShouldPrintObjectDescription()

bool ValueObjectPrinter::ShouldPrintObjectDescription ( )
private

Definition at line 81 of file ValueObjectPrinter.cpp.

References IsNil(), IsUninitialized(), m_options, and ShouldPrintValueObject().

Referenced by PrintValueObject().

◆ ShouldPrintValueObject()

◆ ShouldShowName()

bool ValueObjectPrinter::ShouldShowName ( ) const
private

◆ StringSummaryFormat

friend struct StringSummaryFormat
friend

Definition at line 166 of file ValueObjectPrinter.h.

References StringSummaryFormat.

Referenced by StringSummaryFormat.

Member Data Documentation

◆ m_cached_valobj

ValueObject* lldb_private::ValueObjectPrinter::m_cached_valobj
private

Cache the current "most specialized" value.

Don't use this directly, use GetMostSpecializedValue.

Definition at line 146 of file ValueObjectPrinter.h.

Referenced by GetMostSpecializedValue(), Init(), and SetupMostSpecializedValue().

◆ m_compiler_type

CompilerType lldb_private::ValueObjectPrinter::m_compiler_type
private

◆ m_curr_depth

uint32_t lldb_private::ValueObjectPrinter::m_curr_depth
private

◆ m_error

std::string lldb_private::ValueObjectPrinter::m_error
private

Definition at line 163 of file ValueObjectPrinter.h.

Referenced by Init(), and PrintValueAndSummaryIfNeeded().

◆ m_is_aggregate

LazyBool lldb_private::ValueObjectPrinter::m_is_aggregate
private

Definition at line 158 of file ValueObjectPrinter.h.

Referenced by Init(), and IsAggregate().

◆ m_is_instance_ptr

LazyBool lldb_private::ValueObjectPrinter::m_is_instance_ptr
private

Definition at line 159 of file ValueObjectPrinter.h.

Referenced by Init(), and IsInstancePointer().

◆ m_is_nil

LazyBool lldb_private::ValueObjectPrinter::m_is_nil
private

Definition at line 154 of file ValueObjectPrinter.h.

Referenced by Init(), and IsNil().

◆ m_is_ptr

LazyBool lldb_private::ValueObjectPrinter::m_is_ptr
private

Definition at line 156 of file ValueObjectPrinter.h.

Referenced by Init(), and IsPtr().

◆ m_is_ref

LazyBool lldb_private::ValueObjectPrinter::m_is_ref
private

Definition at line 157 of file ValueObjectPrinter.h.

Referenced by Init(), and IsRef().

◆ m_is_uninit

LazyBool lldb_private::ValueObjectPrinter::m_is_uninit
private

Definition at line 155 of file ValueObjectPrinter.h.

Referenced by Init(), and IsUninitialized().

◆ m_options

◆ m_orig_valobj

ValueObject& lldb_private::ValueObjectPrinter::m_orig_valobj
private

◆ m_printed_instance_pointers

InstancePointersSetSP lldb_private::ValueObjectPrinter::m_printed_instance_pointers
protected

Definition at line 42 of file ValueObjectPrinter.h.

Referenced by Init(), PrintChild(), and PrintChildrenIfNeeded().

◆ m_ptr_depth

DumpValueObjectOptions::PointerDepth lldb_private::ValueObjectPrinter::m_ptr_depth
private

Definition at line 151 of file ValueObjectPrinter.h.

Referenced by Init(), and PrintChildrenIfNeeded().

◆ m_should_print

LazyBool lldb_private::ValueObjectPrinter::m_should_print
private

Definition at line 153 of file ValueObjectPrinter.h.

Referenced by Init(), and ShouldPrintValueObject().

◆ m_stream

◆ m_summary

std::string lldb_private::ValueObjectPrinter::m_summary
private

Definition at line 162 of file ValueObjectPrinter.h.

Referenced by Init(), PrintValueAndSummaryIfNeeded(), and ShouldPrintChildren().

◆ m_summary_formatter

std::pair<TypeSummaryImpl *, bool> lldb_private::ValueObjectPrinter::m_summary_formatter
private

Definition at line 160 of file ValueObjectPrinter.h.

Referenced by GetSummaryFormatter(), and Init().

◆ m_type_flags

Flags lldb_private::ValueObjectPrinter::m_type_flags
private

◆ m_val_summary_ok

bool lldb_private::ValueObjectPrinter::m_val_summary_ok
private

Definition at line 164 of file ValueObjectPrinter.h.

Referenced by Init(), PrintValueObject(), and ShouldPrintEmptyBrackets().

◆ m_value

std::string lldb_private::ValueObjectPrinter::m_value
private

Definition at line 161 of file ValueObjectPrinter.h.

Referenced by Init(), and PrintValueAndSummaryIfNeeded().


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