blob: 7c9d5eb77a019f6e22da91fc5f1f1c2c77ab1ca9 [file] [log] [blame]
Kate Stoneb9c1b512016-09-06 20:57:50 +00001//===-- DumpValueObjectOptions.cpp -----------------------------------*- C++
2//-*-===//
Enrico Granatac8e76492015-10-19 22:04:25 +00003//
4// The LLVM Compiler Infrastructure
5//
6// This file is distributed under the University of Illinois Open Source
7// License. See LICENSE.TXT for details.
8//
9//===----------------------------------------------------------------------===//
10
11#include "lldb/DataFormatters/DumpValueObjectOptions.h"
12
13// C Includes
14// C++ Includes
15// Other libraries and framework includes
16// Project includes
17#include "lldb/Core/ValueObject.h"
18
19using namespace lldb;
20using namespace lldb_private;
21
Kate Stoneb9c1b512016-09-06 20:57:50 +000022DumpValueObjectOptions::DumpValueObjectOptions()
23 : m_summary_sp(), m_root_valobj_name(),
24 m_max_ptr_depth(PointerDepth{PointerDepth::Mode::Default, 0}),
Enrico Granata9ac0dac2016-11-04 18:15:39 +000025 m_decl_printing_helper(), m_pointer_as_array(), m_use_synthetic(true),
Kate Stoneb9c1b512016-09-06 20:57:50 +000026 m_scope_already_checked(false), m_flat_output(false), m_ignore_cap(false),
27 m_show_types(false), m_show_location(false), m_use_objc(false),
28 m_hide_root_type(false), m_hide_name(false), m_hide_value(false),
29 m_run_validator(false), m_use_type_display_name(true),
30 m_allow_oneliner_mode(true), m_hide_pointer_value(false),
31 m_reveal_empty_aggregates(true) {}
Enrico Granatac8e76492015-10-19 22:04:25 +000032
Kate Stoneb9c1b512016-09-06 20:57:50 +000033DumpValueObjectOptions::DumpValueObjectOptions(ValueObject &valobj)
34 : DumpValueObjectOptions() {
35 m_use_dynamic = valobj.GetDynamicValueType();
36 m_use_synthetic = valobj.IsSynthetic();
37 m_varformat_language = valobj.GetPreferredDisplayLanguage();
Enrico Granatac8e76492015-10-19 22:04:25 +000038}
39
Kate Stoneb9c1b512016-09-06 20:57:50 +000040DumpValueObjectOptions &
41DumpValueObjectOptions::SetMaximumPointerDepth(PointerDepth depth) {
42 m_max_ptr_depth = depth;
43 return *this;
Enrico Granatac8e76492015-10-19 22:04:25 +000044}
45
Kate Stoneb9c1b512016-09-06 20:57:50 +000046DumpValueObjectOptions &
47DumpValueObjectOptions::SetMaximumDepth(uint32_t depth) {
48 m_max_depth = depth;
49 return *this;
Enrico Granatac8e76492015-10-19 22:04:25 +000050}
51
Kate Stoneb9c1b512016-09-06 20:57:50 +000052DumpValueObjectOptions &
53DumpValueObjectOptions::SetDeclPrintingHelper(DeclPrintingHelper helper) {
54 m_decl_printing_helper = helper;
55 return *this;
Enrico Granatac8e76492015-10-19 22:04:25 +000056}
57
Kate Stoneb9c1b512016-09-06 20:57:50 +000058DumpValueObjectOptions &DumpValueObjectOptions::SetShowTypes(bool show) {
59 m_show_types = show;
60 return *this;
Enrico Granatac8e76492015-10-19 22:04:25 +000061}
62
Kate Stoneb9c1b512016-09-06 20:57:50 +000063DumpValueObjectOptions &DumpValueObjectOptions::SetShowLocation(bool show) {
64 m_show_location = show;
65 return *this;
Enrico Granatac8e76492015-10-19 22:04:25 +000066}
67
Kate Stoneb9c1b512016-09-06 20:57:50 +000068DumpValueObjectOptions &DumpValueObjectOptions::SetUseObjectiveC(bool use) {
69 m_use_objc = use;
70 return *this;
Enrico Granatac8e76492015-10-19 22:04:25 +000071}
72
Kate Stoneb9c1b512016-09-06 20:57:50 +000073DumpValueObjectOptions &DumpValueObjectOptions::SetShowSummary(bool show) {
74 if (show == false)
Enrico Granatac8e76492015-10-19 22:04:25 +000075 SetOmitSummaryDepth(UINT32_MAX);
Kate Stoneb9c1b512016-09-06 20:57:50 +000076 else
77 SetOmitSummaryDepth(0);
78 return *this;
Enrico Granatac8e76492015-10-19 22:04:25 +000079}
80
Kate Stoneb9c1b512016-09-06 20:57:50 +000081DumpValueObjectOptions &
82DumpValueObjectOptions::SetUseDynamicType(lldb::DynamicValueType dyn) {
83 m_use_dynamic = dyn;
84 return *this;
Enrico Granatac8e76492015-10-19 22:04:25 +000085}
86
Kate Stoneb9c1b512016-09-06 20:57:50 +000087DumpValueObjectOptions &
88DumpValueObjectOptions::SetUseSyntheticValue(bool use_synthetic) {
89 m_use_synthetic = use_synthetic;
90 return *this;
Enrico Granatac8e76492015-10-19 22:04:25 +000091}
92
Kate Stoneb9c1b512016-09-06 20:57:50 +000093DumpValueObjectOptions &DumpValueObjectOptions::SetScopeChecked(bool check) {
94 m_scope_already_checked = check;
95 return *this;
Enrico Granatac8e76492015-10-19 22:04:25 +000096}
97
Kate Stoneb9c1b512016-09-06 20:57:50 +000098DumpValueObjectOptions &DumpValueObjectOptions::SetFlatOutput(bool flat) {
99 m_flat_output = flat;
100 return *this;
Enrico Granatac8e76492015-10-19 22:04:25 +0000101}
102
Kate Stoneb9c1b512016-09-06 20:57:50 +0000103DumpValueObjectOptions &
104DumpValueObjectOptions::SetOmitSummaryDepth(uint32_t depth) {
105 m_omit_summary_depth = depth;
106 return *this;
Enrico Granatac8e76492015-10-19 22:04:25 +0000107}
108
Kate Stoneb9c1b512016-09-06 20:57:50 +0000109DumpValueObjectOptions &DumpValueObjectOptions::SetIgnoreCap(bool ignore) {
110 m_ignore_cap = ignore;
111 return *this;
Enrico Granatac8e76492015-10-19 22:04:25 +0000112}
113
Kate Stoneb9c1b512016-09-06 20:57:50 +0000114DumpValueObjectOptions &DumpValueObjectOptions::SetRawDisplay() {
115 SetUseSyntheticValue(false);
116 SetOmitSummaryDepth(UINT32_MAX);
117 SetIgnoreCap(true);
118 SetHideName(false);
119 SetHideValue(false);
120 SetUseTypeDisplayName(false);
121 SetAllowOnelinerMode(false);
122 return *this;
Enrico Granatac8e76492015-10-19 22:04:25 +0000123}
124
Kate Stoneb9c1b512016-09-06 20:57:50 +0000125DumpValueObjectOptions &DumpValueObjectOptions::SetFormat(lldb::Format format) {
126 m_format = format;
127 return *this;
Enrico Granatac8e76492015-10-19 22:04:25 +0000128}
129
Kate Stoneb9c1b512016-09-06 20:57:50 +0000130DumpValueObjectOptions &
131DumpValueObjectOptions::SetSummary(lldb::TypeSummaryImplSP summary) {
132 m_summary_sp = summary;
133 return *this;
Enrico Granatac8e76492015-10-19 22:04:25 +0000134}
135
Kate Stoneb9c1b512016-09-06 20:57:50 +0000136DumpValueObjectOptions &
137DumpValueObjectOptions::SetRootValueObjectName(const char *name) {
138 if (name)
139 m_root_valobj_name.assign(name);
140 else
141 m_root_valobj_name.clear();
142 return *this;
Enrico Granatac8e76492015-10-19 22:04:25 +0000143}
144
Kate Stoneb9c1b512016-09-06 20:57:50 +0000145DumpValueObjectOptions &
146DumpValueObjectOptions::SetHideRootType(bool hide_root_type) {
147 m_hide_root_type = hide_root_type;
148 return *this;
Enrico Granatac8e76492015-10-19 22:04:25 +0000149}
Enrico Granata8cf44d92015-11-10 19:07:58 +0000150
Kate Stoneb9c1b512016-09-06 20:57:50 +0000151DumpValueObjectOptions &DumpValueObjectOptions::SetHideName(bool hide_name) {
152 m_hide_name = hide_name;
153 return *this;
Enrico Granata8cf44d92015-11-10 19:07:58 +0000154}
Enrico Granata520a4222016-04-25 00:52:47 +0000155
Kate Stoneb9c1b512016-09-06 20:57:50 +0000156DumpValueObjectOptions &DumpValueObjectOptions::SetHideValue(bool hide_value) {
157 m_hide_value = hide_value;
158 return *this;
159}
160
161DumpValueObjectOptions &DumpValueObjectOptions::SetHidePointerValue(bool hide) {
162 m_hide_pointer_value = hide;
163 return *this;
164}
165
166DumpValueObjectOptions &
167DumpValueObjectOptions::SetVariableFormatDisplayLanguage(
168 lldb::LanguageType lang) {
169 m_varformat_language = lang;
170 return *this;
171}
172
173DumpValueObjectOptions &DumpValueObjectOptions::SetRunValidator(bool run) {
174 m_run_validator = run;
175 return *this;
176}
177
178DumpValueObjectOptions &
179DumpValueObjectOptions::SetUseTypeDisplayName(bool dis) {
180 m_use_type_display_name = dis;
181 return *this;
182}
183
184DumpValueObjectOptions &
185DumpValueObjectOptions::SetAllowOnelinerMode(bool oneliner) {
186 m_allow_oneliner_mode = oneliner;
187 return *this;
188}
189
190DumpValueObjectOptions &
191DumpValueObjectOptions::SetRevealEmptyAggregates(bool reveal) {
192 m_reveal_empty_aggregates = reveal;
193 return *this;
194}
195
196DumpValueObjectOptions &
197DumpValueObjectOptions::SetElementCount(uint32_t element_count) {
Enrico Granata9ac0dac2016-11-04 18:15:39 +0000198 m_pointer_as_array = PointerAsArraySettings(element_count);
199 return *this;
200}
201
202DumpValueObjectOptions &DumpValueObjectOptions::SetPointerAsArray(
203 const PointerAsArraySettings &ptr_array) {
204 m_pointer_as_array = ptr_array;
Kate Stoneb9c1b512016-09-06 20:57:50 +0000205 return *this;
Enrico Granata520a4222016-04-25 00:52:47 +0000206}