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
21namespace lldb_private {
22
24public:
26
28 const DumpValueObjectOptions &options);
29
31
32 bool PrintValueObject();
33
34protected:
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,
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,
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
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,
87 std::string &error);
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,
96
98
100
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
121
122private:
138 std::pair<TypeSummaryImpl *, bool> m_summary_formatter;
139 std::string m_value;
140 std::string m_summary;
141 std::string m_error;
143
144 friend struct StringSummaryFormat;
145
148};
149
150} // namespace lldb_private
151
152#endif // LLDB_DATAFORMATTERS_VALUEOBJECTPRINTER_H
static llvm::raw_ostream & error(Stream &strm)
Generic representation of a type in a programming language.
Definition: CompilerType.h:36
A class to manage flags.
Definition: Flags.h:22
A stream class that can stream formatted output to a file.
Definition: Stream.h:28
bool PrintObjectDescriptionIfNeeded(bool value_printed, bool summary_printed)
std::shared_ptr< InstancePointersSet > InstancePointersSetSP
lldb::ValueObjectSP GenerateChild(ValueObject *synth_valobj, size_t idx)
std::pair< TypeSummaryImpl *, bool > m_summary_formatter
void Init(ValueObject *valobj, Stream *s, const DumpValueObjectOptions &options, const DumpValueObjectOptions::PointerDepth &ptr_depth, uint32_t curr_depth, InstancePointersSetSP printed_instance_pointers)
void PrintChild(lldb::ValueObjectSP child_sp, const DumpValueObjectOptions::PointerDepth &curr_ptr_depth)
TypeSummaryImpl * GetSummaryFormatter(bool null_if_omitted=true)
void PrintChildrenIfNeeded(bool value_printed, bool summary_printed)
const ValueObjectPrinter & operator=(const ValueObjectPrinter &)=delete
DumpValueObjectOptions::PointerDepth m_ptr_depth
uint32_t GetMaxNumChildrenToPrint(bool &print_dotdotdot)
void PrintChildrenPostamble(bool print_dotdotdot)
ValueObjectPrinter(const ValueObjectPrinter &)=delete
InstancePointersSetSP m_printed_instance_pointers
void PrintChildren(bool value_printed, bool summary_printed, const DumpValueObjectOptions::PointerDepth &curr_ptr_depth)
bool PrintChildrenOneLiner(bool hide_names)
std::set< uint64_t > InstancePointersSet
void GetValueSummaryError(std::string &value, std::string &summary, std::string &error)
bool PrintValueAndSummaryIfNeeded(bool &value_printed, bool &summary_printed)
bool ShouldPrintChildren(bool is_failed_description, DumpValueObjectOptions::PointerDepth &curr_ptr_depth)
bool ShouldPrintEmptyBrackets(bool value_printed, bool summary_printed)
A class that represents a running process on the host machine.