LLDB mainline
Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | Friends | List of all members
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 ()
 
llvm::Expected< std::string > GetDescriptionForDisplay ()
 
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)
 
llvm::Error PrintObjectDescriptionIfNeeded (bool value_printed, bool summary_printed)
 
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
 
 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 *, bool > m_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 23 of file ValueObjectPrinter.cpp.

References Init(), lldb_private::DumpValueObjectOptions::m_max_ptr_depth, and m_options.

◆ ValueObjectPrinter() [2/4]

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

◆ ~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 35 of file ValueObjectPrinter.cpp.

References Init().

◆ ValueObjectPrinter() [4/4]

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

Member Function Documentation

◆ CheckScopeIfNeeded()

bool ValueObjectPrinter::CheckScopeIfNeeded ( )
protected

◆ GenerateChild()

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

◆ GetDescriptionForDisplay()

llvm::Expected< std::string > ValueObjectPrinter::GetDescriptionForDisplay ( )
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 100 of file ValueObjectPrinter.cpp.

References m_cached_valobj.

Referenced by CheckScopeIfNeeded(), GetDescriptionForDisplay(), GetRootNameForDisplay(), GetSummaryFormatter(), GetValueSummaryError(), IsInstancePointer(), IsNil(), IsUninitialized(), PrintDecl(), PrintLocationIfNeeded(), PrintObjectDescriptionIfNeeded(), and PrintValueAndSummaryIfNeeded().

◆ GetRootNameForDisplay()

const char * ValueObjectPrinter::GetRootNameForDisplay ( )
protected

◆ GetSummaryFormatter()

TypeSummaryImpl * ValueObjectPrinter::GetSummaryFormatter ( bool  null_if_omitted = true)
protected

◆ GetValueObjectForChildrenGeneration()

ValueObject & ValueObjectPrinter::GetValueObjectForChildrenGeneration ( )
protected

Definition at line 581 of file ValueObjectPrinter.cpp.

◆ GetValueSummaryError()

void ValueObjectPrinter::GetValueSummaryError ( std::string &  value,
std::string &  summary,
std::string &  error 
)
protected

◆ HasReachedMaximumDepth()

bool ValueObjectPrinter::HasReachedMaximumDepth ( )
protected

Definition at line 878 of file ValueObjectPrinter.cpp.

◆ 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()

bool ValueObjectPrinter::IsInstancePointer ( )
protected

◆ IsNil()

bool ValueObjectPrinter::IsNil ( )
protected

◆ IsPtr()

bool ValueObjectPrinter::IsPtr ( )
protected

◆ IsRef()

bool ValueObjectPrinter::IsRef ( )
protected

◆ IsUninitialized()

bool ValueObjectPrinter::IsUninitialized ( )
protected

◆ operator=()

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

◆ PrintChild()

void ValueObjectPrinter::PrintChild ( lldb::ValueObjectSP  child_sp,
const DumpValueObjectOptions::PointerDepth curr_ptr_depth 
)
protected

◆ PrintChildren()

void ValueObjectPrinter::PrintChildren ( bool  value_printed,
bool  summary_printed,
const DumpValueObjectOptions::PointerDepth curr_ptr_depth 
)
protected

Definition at line 721 of file ValueObjectPrinter.cpp.

◆ PrintChildrenIfNeeded()

llvm::Error ValueObjectPrinter::PrintChildrenIfNeeded ( bool  value_printed,
bool  summary_printed 
)
protected

◆ PrintChildrenOneLiner()

bool ValueObjectPrinter::PrintChildrenOneLiner ( bool  hide_names)
protected

◆ PrintChildrenPostamble()

void ValueObjectPrinter::PrintChildrenPostamble ( bool  print_dotdotdot)
protected

Definition at line 665 of file ValueObjectPrinter.cpp.

◆ PrintChildrenPreamble()

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

Definition at line 585 of file ValueObjectPrinter.cpp.

◆ PrintDecl()

void ValueObjectPrinter::PrintDecl ( )
protected

◆ PrintLocationIfNeeded()

bool ValueObjectPrinter::PrintLocationIfNeeded ( )
protected

◆ PrintObjectDescriptionIfNeeded()

llvm::Error ValueObjectPrinter::PrintObjectDescriptionIfNeeded ( bool  value_printed,
bool  summary_printed 
)
protected

◆ PrintValueAndSummaryIfNeeded()

bool ValueObjectPrinter::PrintValueAndSummaryIfNeeded ( bool &  value_printed,
bool &  summary_printed 
)
protected

◆ PrintValueObject()

llvm::Error ValueObjectPrinter::PrintValueObject ( )

◆ SetupMostSpecializedValue()

void ValueObjectPrinter::SetupMostSpecializedValue ( )
protected

◆ ShouldExpandEmptyAggregates()

bool ValueObjectPrinter::ShouldExpandEmptyAggregates ( )
protected

◆ ShouldPrintChildren()

bool ValueObjectPrinter::ShouldPrintChildren ( DumpValueObjectOptions::PointerDepth curr_ptr_depth)
protected

◆ ShouldPrintEmptyBrackets()

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

◆ ShouldPrintValueObject()

bool ValueObjectPrinter::ShouldPrintValueObject ( )
protected

◆ ShouldShowName()

bool ValueObjectPrinter::ShouldShowName ( ) const
private

Friends And Related Function Documentation

◆ StringSummaryFormat

friend struct StringSummaryFormat
friend

Definition at line 168 of file ValueObjectPrinter.h.

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 148 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

Definition at line 154 of file ValueObjectPrinter.h.

Referenced by Init(), and PrintDecl().

◆ m_error

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

Definition at line 165 of file ValueObjectPrinter.h.

Referenced by Init(), and PrintValueAndSummaryIfNeeded().

◆ m_is_aggregate

LazyBool lldb_private::ValueObjectPrinter::m_is_aggregate
private

Definition at line 160 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 161 of file ValueObjectPrinter.h.

Referenced by Init(), and IsInstancePointer().

◆ m_is_nil

LazyBool lldb_private::ValueObjectPrinter::m_is_nil
private

Definition at line 156 of file ValueObjectPrinter.h.

Referenced by Init(), and IsNil().

◆ m_is_ptr

LazyBool lldb_private::ValueObjectPrinter::m_is_ptr
private

Definition at line 158 of file ValueObjectPrinter.h.

Referenced by Init(), and IsPtr().

◆ m_is_ref

LazyBool lldb_private::ValueObjectPrinter::m_is_ref
private

Definition at line 159 of file ValueObjectPrinter.h.

Referenced by Init(), and IsRef().

◆ m_is_uninit

LazyBool lldb_private::ValueObjectPrinter::m_is_uninit
private

Definition at line 157 of file ValueObjectPrinter.h.

Referenced by Init(), and IsUninitialized().

◆ m_options

DumpValueObjectOptions lldb_private::ValueObjectPrinter::m_options
private

◆ m_orig_valobj

ValueObject& lldb_private::ValueObjectPrinter::m_orig_valobj
private

Definition at line 145 of file ValueObjectPrinter.h.

Referenced by PrintValueObject(), and SetupMostSpecializedValue().

◆ m_printed_instance_pointers

InstancePointersSetSP lldb_private::ValueObjectPrinter::m_printed_instance_pointers
protected

Definition at line 42 of file ValueObjectPrinter.h.

Referenced by Init().

◆ m_ptr_depth

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

Definition at line 153 of file ValueObjectPrinter.h.

Referenced by Init().

◆ m_should_print

LazyBool lldb_private::ValueObjectPrinter::m_should_print
private

Definition at line 155 of file ValueObjectPrinter.h.

Referenced by Init(), and ShouldPrintValueObject().

◆ m_stream

Stream* lldb_private::ValueObjectPrinter::m_stream
private

◆ m_summary

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

Definition at line 164 of file ValueObjectPrinter.h.

Referenced by Init(), and PrintValueAndSummaryIfNeeded().

◆ m_summary_formatter

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

Definition at line 162 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 166 of file ValueObjectPrinter.h.

Referenced by Init(), and PrintValueObject().

◆ m_value

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

Definition at line 163 of file ValueObjectPrinter.h.

Referenced by Init(), and PrintValueAndSummaryIfNeeded().


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