LLDB  mainline
ValueObjectPrinter.h
Go to the documentation of this file.
1 //===-- ValueObjectPrinter.h ---------------------------------------*- C++
2 //-*-===//
3 //
4 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 // See https://llvm.org/LICENSE.txt for license information.
6 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #ifndef LLDB_DATAFORMATTERS_VALUEOBJECTPRINTER_H
11 #define LLDB_DATAFORMATTERS_VALUEOBJECTPRINTER_H
12 
13 #include "lldb/lldb-private.h"
14 #include "lldb/lldb-public.h"
15 
16 #include "lldb/Utility/Flags.h"
17 
20 
21 namespace lldb_private {
22 
24 public:
26 
28  const DumpValueObjectOptions &options);
29 
30  ~ValueObjectPrinter() = default;
31 
32  bool PrintValueObject();
33 
34 protected:
35  typedef std::set<uint64_t> InstancePointersSet;
36  typedef std::shared_ptr<InstancePointersSet> InstancePointersSetSP;
37 
39 
40  // only this class (and subclasses, if any) should ever be concerned with the
41  // depth mechanism
43  const DumpValueObjectOptions &options,
44  const DumpValueObjectOptions::PointerDepth &ptr_depth,
45  uint32_t curr_depth,
46  InstancePointersSetSP printed_instance_pointers);
47 
48  // we should actually be using delegating constructors here but some versions
49  // of GCC still have trouble with those
50  void Init(ValueObject *valobj, Stream *s,
51  const DumpValueObjectOptions &options,
52  const DumpValueObjectOptions::PointerDepth &ptr_depth,
53  uint32_t curr_depth,
54  InstancePointersSetSP printed_instance_pointers);
55 
57 
58  const char *GetDescriptionForDisplay();
59 
60  const char *GetRootNameForDisplay();
61 
63 
64  bool IsNil();
65 
66  bool IsUninitialized();
67 
68  bool IsPtr();
69 
70  bool IsRef();
71 
72  bool IsInstancePointer();
73 
74  bool IsAggregate();
75 
76  bool PrintLocationIfNeeded();
77 
78  void PrintDecl();
79 
80  bool CheckScopeIfNeeded();
81 
82  bool ShouldPrintEmptyBrackets(bool value_printed, bool summary_printed);
83 
84  TypeSummaryImpl *GetSummaryFormatter(bool null_if_omitted = true);
85 
86  void GetValueSummaryError(std::string &value, std::string &summary,
88 
89  bool PrintValueAndSummaryIfNeeded(bool &value_printed, bool &summary_printed);
90 
91  bool PrintObjectDescriptionIfNeeded(bool value_printed, bool summary_printed);
92 
93  bool
94  ShouldPrintChildren(bool is_failed_description,
95  DumpValueObjectOptions::PointerDepth &curr_ptr_depth);
96 
98 
100 
101  void PrintChildrenPreamble();
102 
103  void PrintChildrenPostamble(bool print_dotdotdot);
104 
105  lldb::ValueObjectSP GenerateChild(ValueObject *synth_valobj, size_t idx);
106 
107  void PrintChild(lldb::ValueObjectSP child_sp,
108  const DumpValueObjectOptions::PointerDepth &curr_ptr_depth);
109 
110  uint32_t GetMaxNumChildrenToPrint(bool &print_dotdotdot);
111 
112  void
113  PrintChildren(bool value_printed, bool summary_printed,
114  const DumpValueObjectOptions::PointerDepth &curr_ptr_depth);
115 
116  void PrintChildrenIfNeeded(bool value_printed, bool summary_printed);
117 
118  bool PrintChildrenOneLiner(bool hide_names);
119 
120 private:
136  std::pair<TypeSummaryImpl *, bool> m_summary_formatter;
141 
142  friend struct StringSummaryFormat;
143 
144  ValueObjectPrinter(const ValueObjectPrinter &) = delete;
145  const ValueObjectPrinter &operator=(const ValueObjectPrinter &) = delete;
146 };
147 
148 } // namespace lldb_private
149 
150 #endif // LLDB_DATAFORMATTERS_VALUEOBJECTPRINTER_H
lldb_private::ValueObjectPrinter::ShouldPrintChildren
bool ShouldPrintChildren(bool is_failed_description, DumpValueObjectOptions::PointerDepth &curr_ptr_depth)
Definition: ValueObjectPrinter.cpp:483
lldb_private::ValueObjectPrinter::PrintDecl
void PrintDecl()
Definition: ValueObjectPrinter.cpp:222
lldb_private::ValueObjectPrinter::m_should_print
LazyBool m_should_print
Definition: ValueObjectPrinter.h:129
lldb_private::ValueObjectPrinter::PrintChild
void PrintChild(lldb::ValueObjectSP child_sp, const DumpValueObjectOptions::PointerDepth &curr_ptr_depth)
Definition: ValueObjectPrinter.cpp:560
lldb-public.h
lldb_private::ValueObjectPrinter::InstancePointersSetSP
std::shared_ptr< InstancePointersSet > InstancePointersSetSP
Definition: ValueObjectPrinter.h:36
lldb_private::ValueObjectPrinter::PrintChildrenIfNeeded
void PrintChildrenIfNeeded(bool value_printed, bool summary_printed)
Definition: ValueObjectPrinter.cpp:754
lldb_private::ValueObjectPrinter::m_valobj
ValueObject * m_valobj
Definition: ValueObjectPrinter.h:122
lldb_private::ValueObjectPrinter::m_summary
std::string m_summary
Definition: ValueObjectPrinter.h:138
lldb_private::TypeSummaryImpl
Definition: TypeSummary.h:45
lldb_private::ValueObjectPrinter::IsUninitialized
bool IsUninitialized()
Definition: ValueObjectPrinter.cpp:176
lldb_private::ValueObjectPrinter::GetSummaryFormatter
TypeSummaryImpl * GetSummaryFormatter(bool null_if_omitted=true)
Definition: ValueObjectPrinter.cpp:316
lldb_private::ValueObjectPrinter::CheckScopeIfNeeded
bool CheckScopeIfNeeded()
Definition: ValueObjectPrinter.cpp:310
lldb_private::ValueObjectPrinter::m_curr_depth
uint32_t m_curr_depth
Definition: ValueObjectPrinter.h:128
lldb_private::ValueObjectPrinter::m_is_ptr
LazyBool m_is_ptr
Definition: ValueObjectPrinter.h:132
lldb_private::Flags
Definition: Flags.h:22
lldb_private::ValueObjectPrinter::GetMostSpecializedValue
bool GetMostSpecializedValue()
Definition: ValueObjectPrinter.cpp:98
lldb_private::Stream
Definition: Stream.h:28
lldb_private::LazyBool
LazyBool
Definition: lldb-private-enumerations.h:115
lldb_private::ValueObjectPrinter::ShouldPrintValueObject
bool ShouldPrintValueObject()
Definition: ValueObjectPrinter.cpp:161
lldb_private::ValueObjectPrinter::GetValueObjectForChildrenGeneration
ValueObject * GetValueObjectForChildrenGeneration()
Definition: ValueObjectPrinter.cpp:545
lldb_private::ValueObjectPrinter::PrintChildrenOneLiner
bool PrintChildrenOneLiner(bool hide_names)
Definition: ValueObjectPrinter.cpp:712
lldb_private::ValueObjectPrinter::IsInstancePointer
bool IsInstancePointer()
Definition: ValueObjectPrinter.cpp:202
lldb_private::ValueObjectPrinter::m_options
DumpValueObjectOptions m_options
Definition: ValueObjectPrinter.h:124
lldb_private::ValueObjectPrinter
Definition: ValueObjectPrinter.h:23
lldb_private::ValueObjectPrinter::InstancePointersSet
std::set< uint64_t > InstancePointersSet
Definition: ValueObjectPrinter.h:35
lldb_private::ValueObjectPrinter::m_is_instance_ptr
LazyBool m_is_instance_ptr
Definition: ValueObjectPrinter.h:135
error
static llvm::raw_ostream & error(Stream &strm)
Definition: CommandReturnObject.cpp:17
lldb_private::ValueObjectPrinter::PrintValueAndSummaryIfNeeded
bool PrintValueAndSummaryIfNeeded(bool &value_printed, bool &summary_printed)
Definition: ValueObjectPrinter.cpp:389
lldb_private::ValueObjectPrinter::m_stream
Stream * m_stream
Definition: ValueObjectPrinter.h:123
lldb_private::ValueObjectPrinter::GenerateChild
lldb::ValueObjectSP GenerateChild(ValueObject *synth_valobj, size_t idx)
Definition: ValueObjectPrinter.cpp:649
lldb_private::ValueObjectPrinter::GetValueSummaryError
void GetValueSummaryError(std::string &value, std::string &summary, std::string &error)
Definition: ValueObjectPrinter.cpp:339
lldb_private::ValueObjectPrinter::m_is_nil
LazyBool m_is_nil
Definition: ValueObjectPrinter.h:130
lldb_private::ValueObjectPrinter::m_printed_instance_pointers
InstancePointersSetSP m_printed_instance_pointers
Definition: ValueObjectPrinter.h:38
lldb_private::ValueObjectPrinter::PrintObjectDescriptionIfNeeded
bool PrintObjectDescriptionIfNeeded(bool value_printed, bool summary_printed)
Definition: ValueObjectPrinter.cpp:442
lldb_private::ValueObjectPrinter::IsRef
bool IsRef()
Definition: ValueObjectPrinter.cpp:189
lldb_private::ValueObjectPrinter::GetDescriptionForDisplay
const char * GetDescriptionForDisplay()
Definition: ValueObjectPrinter.cpp:145
lldb_private::ValueObjectPrinter::m_ptr_depth
DumpValueObjectOptions::PointerDepth m_ptr_depth
Definition: ValueObjectPrinter.h:127
string
string(SUBSTRING ${p} 10 -1 pStripped) if($
Definition: Plugins/CMakeLists.txt:40
lldb_private::ValueObjectPrinter::Init
void Init(ValueObject *valobj, Stream *s, const DumpValueObjectOptions &options, const DumpValueObjectOptions::PointerDepth &ptr_depth, uint32_t curr_depth, InstancePointersSetSP printed_instance_pointers)
Definition: ValueObjectPrinter.cpp:43
CompilerType.h
lldb-private.h
lldb_private::ValueObjectPrinter::IsAggregate
bool IsAggregate()
Definition: ValueObjectPrinter.cpp:195
lldb_private::ValueObjectPrinter::m_compiler_type
CompilerType m_compiler_type
Definition: ValueObjectPrinter.h:126
lldb_private::ValueObjectPrinter::~ValueObjectPrinter
~ValueObjectPrinter()=default
lldb_private::ValueObjectPrinter::ShouldPrintEmptyBrackets
bool ShouldPrintEmptyBrackets(bool value_printed, bool summary_printed)
Definition: ValueObjectPrinter.cpp:623
lldb_private::ValueObjectPrinter::PrintLocationIfNeeded
bool PrintLocationIfNeeded()
Definition: ValueObjectPrinter.cpp:214
lldb_private::ValueObject
ValueObject:
Definition: ValueObject.h:105
lldb_private::ValueObjectPrinter::m_type_flags
Flags m_type_flags
Definition: ValueObjectPrinter.h:125
uint32_t
lldb_private::ValueObjectPrinter::PrintValueObject
bool PrintValueObject()
Definition: ValueObjectPrinter.cpp:73
DumpValueObjectOptions.h
lldb_private::ValueObjectPrinter::m_error
std::string m_error
Definition: ValueObjectPrinter.h:139
lldb_private::ValueObjectPrinter::PrintChildrenPreamble
void PrintChildrenPreamble()
Definition: ValueObjectPrinter.cpp:549
lldb_private::ValueObjectPrinter::operator=
const ValueObjectPrinter & operator=(const ValueObjectPrinter &)=delete
lldb_private::ValueObjectPrinter::m_value
std::string m_value
Definition: ValueObjectPrinter.h:137
lldb_private::ValueObjectPrinter::ShouldExpandEmptyAggregates
bool ShouldExpandEmptyAggregates()
Definition: ValueObjectPrinter.cpp:536
lldb_private::ValueObjectPrinter::m_is_uninit
LazyBool m_is_uninit
Definition: ValueObjectPrinter.h:131
lldb_private::ValueObjectPrinter::m_orig_valobj
ValueObject * m_orig_valobj
Definition: ValueObjectPrinter.h:121
lldb_private::CompilerType
Generic representation of a type in a programming language.
Definition: CompilerType.h:33
lldb_private::DumpValueObjectOptions
Definition: DumpValueObjectOptions.h:22
lldb_private::ValueObjectPrinter::m_is_aggregate
LazyBool m_is_aggregate
Definition: ValueObjectPrinter.h:134
lldb_private::ValueObjectPrinter::IsPtr
bool IsPtr()
Definition: ValueObjectPrinter.cpp:183
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb_private::ValueObjectPrinter::GetRootNameForDisplay
const char * GetRootNameForDisplay()
Definition: ValueObjectPrinter.cpp:154
lldb_private::ValueObjectPrinter::IsNil
bool IsNil()
Definition: ValueObjectPrinter.cpp:170
lldb_private::ValueObjectPrinter::PrintChildren
void PrintChildren(bool value_printed, bool summary_printed, const DumpValueObjectOptions::PointerDepth &curr_ptr_depth)
Definition: ValueObjectPrinter.cpp:664
lldb_private::DumpValueObjectOptions::PointerDepth
Definition: DumpValueObjectOptions.h:24
lldb_private::ValueObjectPrinter::GetMaxNumChildrenToPrint
uint32_t GetMaxNumChildrenToPrint(bool &print_dotdotdot)
Definition: ValueObjectPrinter.cpp:589
lldb_private::ValueObjectPrinter::ValueObjectPrinter
ValueObjectPrinter(ValueObject *valobj, Stream *s)
Definition: ValueObjectPrinter.cpp:21
Flags.h
lldb_private::StringSummaryFormat
Definition: TypeSummary.h:278
lldb_private::ValueObjectPrinter::PrintChildrenPostamble
void PrintChildrenPostamble(bool print_dotdotdot)
Definition: ValueObjectPrinter.cpp:609
lldb_private::ValueObjectPrinter::m_val_summary_ok
bool m_val_summary_ok
Definition: ValueObjectPrinter.h:140
lldb_private::ValueObjectPrinter::m_summary_formatter
std::pair< TypeSummaryImpl *, bool > m_summary_formatter
Definition: ValueObjectPrinter.h:136
lldb_private::ValueObjectPrinter::m_is_ref
LazyBool m_is_ref
Definition: ValueObjectPrinter.h:133