1 //===-- DumpValueObjectOptions.h --------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef lldb_DumpValueObjectOptions_h_
11 #define lldb_DumpValueObjectOptions_h_
17 // Other libraries and framework includes
19 #include "lldb/lldb-private.h"
20 #include "lldb/lldb-public.h"
25 namespace lldb_private {
27 class DumpValueObjectOptions {
30 enum class Mode { Always, Formatters, Default, Never } m_mode;
33 PointerDepth operator--() const {
35 return PointerDepth{m_mode, m_count - 1};
36 return PointerDepth{m_mode, m_count};
39 bool CanAllowExpansion() const;
41 bool CanAllowExpansion(bool is_root, TypeSummaryImpl *entry,
42 ValueObject *valobj, const std::string &summary);
45 struct PointerAsArraySettings {
46 size_t m_element_count;
47 size_t m_base_element;
50 PointerAsArraySettings()
51 : m_element_count(0), m_base_element(0), m_stride() {}
53 PointerAsArraySettings(size_t elem_count, size_t base_elem = 0,
55 : m_element_count(elem_count), m_base_element(base_elem),
58 operator bool() { return m_element_count > 0; }
61 typedef std::function<bool(ConstString, ConstString,
62 const DumpValueObjectOptions &, Stream &)>
65 static const DumpValueObjectOptions DefaultOptions() {
66 static DumpValueObjectOptions g_default_options;
68 return g_default_options;
71 DumpValueObjectOptions();
73 DumpValueObjectOptions(const DumpValueObjectOptions &rhs) = default;
75 DumpValueObjectOptions(ValueObject &valobj);
77 DumpValueObjectOptions &
78 SetMaximumPointerDepth(PointerDepth depth = {PointerDepth::Mode::Never, 0});
80 DumpValueObjectOptions &SetMaximumDepth(uint32_t depth = 0);
82 DumpValueObjectOptions &SetDeclPrintingHelper(DeclPrintingHelper helper);
84 DumpValueObjectOptions &SetShowTypes(bool show = false);
86 DumpValueObjectOptions &SetShowLocation(bool show = false);
88 DumpValueObjectOptions &SetUseObjectiveC(bool use = false);
90 DumpValueObjectOptions &SetShowSummary(bool show = true);
92 DumpValueObjectOptions &
93 SetUseDynamicType(lldb::DynamicValueType dyn = lldb::eNoDynamicValues);
95 DumpValueObjectOptions &SetUseSyntheticValue(bool use_synthetic = true);
97 DumpValueObjectOptions &SetScopeChecked(bool check = true);
99 DumpValueObjectOptions &SetFlatOutput(bool flat = false);
101 DumpValueObjectOptions &SetOmitSummaryDepth(uint32_t depth = 0);
103 DumpValueObjectOptions &SetIgnoreCap(bool ignore = false);
105 DumpValueObjectOptions &SetRawDisplay();
107 DumpValueObjectOptions &SetFormat(lldb::Format format = lldb::eFormatDefault);
109 DumpValueObjectOptions &
110 SetSummary(lldb::TypeSummaryImplSP summary = lldb::TypeSummaryImplSP());
112 DumpValueObjectOptions &SetRootValueObjectName(const char *name = nullptr);
114 DumpValueObjectOptions &SetHideRootType(bool hide_root_type = false);
116 DumpValueObjectOptions &SetHideName(bool hide_name = false);
118 DumpValueObjectOptions &SetHideValue(bool hide_value = false);
120 DumpValueObjectOptions &SetHidePointerValue(bool hide = false);
122 DumpValueObjectOptions &SetVariableFormatDisplayLanguage(
123 lldb::LanguageType lang = lldb::eLanguageTypeUnknown);
125 DumpValueObjectOptions &SetRunValidator(bool run = true);
127 DumpValueObjectOptions &SetUseTypeDisplayName(bool dis = false);
129 DumpValueObjectOptions &SetAllowOnelinerMode(bool oneliner = false);
131 DumpValueObjectOptions &SetRevealEmptyAggregates(bool reveal = true);
133 DumpValueObjectOptions &SetElementCount(uint32_t element_count = 0);
135 DumpValueObjectOptions &
136 SetPointerAsArray(const PointerAsArraySettings &ptr_array);
139 uint32_t m_max_depth = UINT32_MAX;
140 lldb::DynamicValueType m_use_dynamic = lldb::eNoDynamicValues;
141 uint32_t m_omit_summary_depth = 0;
142 lldb::Format m_format = lldb::eFormatDefault;
143 lldb::TypeSummaryImplSP m_summary_sp;
144 std::string m_root_valobj_name;
145 lldb::LanguageType m_varformat_language = lldb::eLanguageTypeUnknown;
146 PointerDepth m_max_ptr_depth;
147 DeclPrintingHelper m_decl_printing_helper;
148 PointerAsArraySettings m_pointer_as_array;
149 bool m_use_synthetic : 1;
150 bool m_scope_already_checked : 1;
151 bool m_flat_output : 1;
152 bool m_ignore_cap : 1;
153 bool m_show_types : 1;
154 bool m_show_location : 1;
156 bool m_hide_root_type : 1;
157 bool m_hide_name : 1;
158 bool m_hide_value : 1;
159 bool m_run_validator : 1;
160 bool m_use_type_display_name : 1;
161 bool m_allow_oneliner_mode : 1;
162 bool m_hide_pointer_value : 1;
163 bool m_reveal_empty_aggregates : 1;
166 } // namespace lldb_private
168 #endif // lldb_DumpValueObjectOptions_h_