1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
|
//===-- ValueObjectPrinter.h ---------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef lldb_ValueObjectPrinter_h_
#define lldb_ValueObjectPrinter_h_
// C Includes
// C++ Includes
// Other libraries and framework includes
// Project includes
#include "lldb/lldb-private.h"
#include "lldb/lldb-public.h"
#include "lldb/Core/Flags.h"
#include "lldb/DataFormatters/DumpValueObjectOptions.h"
#include "lldb/Symbol/CompilerType.h"
//#include <functional>
//#include <memory>
//#include <set>
namespace lldb_private {
class ValueObjectPrinter
{
public:
ValueObjectPrinter (ValueObject* valobj,
Stream* s);
ValueObjectPrinter (ValueObject* valobj,
Stream* s,
const DumpValueObjectOptions& options);
~ValueObjectPrinter () {}
bool
PrintValueObject ();
protected:
typedef std::set<uint64_t> InstancePointersSet;
typedef std::shared_ptr<InstancePointersSet> InstancePointersSetSP;
InstancePointersSetSP m_printed_instance_pointers;
// only this class (and subclasses, if any) should ever be concerned with
// the depth mechanism
ValueObjectPrinter (ValueObject* valobj,
Stream* s,
const DumpValueObjectOptions& options,
const DumpValueObjectOptions::PointerDepth& ptr_depth,
uint32_t curr_depth,
InstancePointersSetSP printed_instance_pointers);
// we should actually be using delegating constructors here
// but some versions of GCC still have trouble with those
void
Init (ValueObject* valobj,
Stream* s,
const DumpValueObjectOptions& options,
const DumpValueObjectOptions::PointerDepth& ptr_depth,
uint32_t curr_depth,
InstancePointersSetSP printed_instance_pointers);
bool
GetMostSpecializedValue ();
const char*
GetDescriptionForDisplay ();
const char*
GetRootNameForDisplay (const char* if_fail = nullptr);
bool
ShouldPrintValueObject ();
bool
ShouldPrintValidation ();
bool
IsNil ();
bool
IsUninitialized ();
bool
IsPtr ();
bool
IsRef ();
bool
IsInstancePointer ();
bool
IsAggregate ();
bool
PrintValidationMarkerIfNeeded ();
bool
PrintValidationErrorIfNeeded ();
bool
PrintLocationIfNeeded ();
void
PrintDecl ();
bool
CheckScopeIfNeeded ();
bool
ShouldPrintEmptyBrackets (bool value_printed,
bool summary_printed);
TypeSummaryImpl*
GetSummaryFormatter (bool null_if_omitted = true);
void
GetValueSummaryError (std::string& value,
std::string& summary,
std::string& error);
bool
PrintValueAndSummaryIfNeeded (bool& value_printed,
bool& summary_printed);
bool
PrintObjectDescriptionIfNeeded (bool value_printed,
bool summary_printed);
bool
ShouldPrintChildren (bool is_failed_description,
DumpValueObjectOptions::PointerDepth& curr_ptr_depth);
bool
ShouldExpandEmptyAggregates ();
ValueObject*
GetValueObjectForChildrenGeneration ();
void
PrintChildrenPreamble ();
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);
uint32_t
GetMaxNumChildrenToPrint (bool& print_dotdotdot);
void
PrintChildren (bool value_printed,
bool summary_printed,
const DumpValueObjectOptions::PointerDepth& curr_ptr_depth);
void
PrintChildrenIfNeeded (bool value_printed,
bool summary_printed);
bool
PrintChildrenOneLiner (bool hide_names);
private:
ValueObject *m_orig_valobj;
ValueObject *m_valobj;
Stream *m_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;
std::pair<TypeValidatorResult,std::string> m_validation;
friend struct StringSummaryFormat;
DISALLOW_COPY_AND_ASSIGN(ValueObjectPrinter);
};
} // namespace lldb_private
#endif // lldb_ValueObjectPrinter_h_
|