1 //===-- DumpValueObjectOptions.h --------------------------------*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #ifndef lldb_DumpValueObjectOptions_h_
10 #define lldb_DumpValueObjectOptions_h_
14 #include "lldb/lldb-private.h"
15 #include "lldb/lldb-public.h"
20 namespace lldb_private {
22 class DumpValueObjectOptions {
25 enum class Mode { Always, Default, Never } m_mode;
28 PointerDepth operator--() const {
30 return PointerDepth{m_mode, m_count - 1};
31 return PointerDepth{m_mode, m_count};
34 bool CanAllowExpansion() const;
37 struct PointerAsArraySettings {
38 size_t m_element_count;
39 size_t m_base_element;
42 PointerAsArraySettings()
43 : m_element_count(0), m_base_element(0), m_stride() {}
45 PointerAsArraySettings(size_t elem_count, size_t base_elem = 0,
47 : m_element_count(elem_count), m_base_element(base_elem),
50 operator bool() { return m_element_count > 0; }
53 typedef std::function<bool(ConstString, ConstString,
54 const DumpValueObjectOptions &, Stream &)>
57 static const DumpValueObjectOptions DefaultOptions() {
58 static DumpValueObjectOptions g_default_options;
60 return g_default_options;
63 DumpValueObjectOptions();
65 DumpValueObjectOptions(const DumpValueObjectOptions &rhs) = default;
67 DumpValueObjectOptions(ValueObject &valobj);
69 DumpValueObjectOptions &
70 SetMaximumPointerDepth(PointerDepth depth = {PointerDepth::Mode::Never, 0});
72 DumpValueObjectOptions &SetMaximumDepth(uint32_t depth = 0);
74 DumpValueObjectOptions &SetDeclPrintingHelper(DeclPrintingHelper helper);
76 DumpValueObjectOptions &SetShowTypes(bool show = false);
78 DumpValueObjectOptions &SetShowLocation(bool show = false);
80 DumpValueObjectOptions &SetUseObjectiveC(bool use = false);
82 DumpValueObjectOptions &SetShowSummary(bool show = true);
84 DumpValueObjectOptions &
85 SetUseDynamicType(lldb::DynamicValueType dyn = lldb::eNoDynamicValues);
87 DumpValueObjectOptions &SetUseSyntheticValue(bool use_synthetic = true);
89 DumpValueObjectOptions &SetScopeChecked(bool check = true);
91 DumpValueObjectOptions &SetFlatOutput(bool flat = false);
93 DumpValueObjectOptions &SetOmitSummaryDepth(uint32_t depth = 0);
95 DumpValueObjectOptions &SetIgnoreCap(bool ignore = false);
97 DumpValueObjectOptions &SetRawDisplay();
99 DumpValueObjectOptions &SetFormat(lldb::Format format = lldb::eFormatDefault);
101 DumpValueObjectOptions &
102 SetSummary(lldb::TypeSummaryImplSP summary = lldb::TypeSummaryImplSP());
104 DumpValueObjectOptions &SetRootValueObjectName(const char *name = nullptr);
106 DumpValueObjectOptions &SetHideRootType(bool hide_root_type = false);
108 DumpValueObjectOptions &SetHideName(bool hide_name = false);
110 DumpValueObjectOptions &SetHideValue(bool hide_value = false);
112 DumpValueObjectOptions &SetHidePointerValue(bool hide = false);
114 DumpValueObjectOptions &SetVariableFormatDisplayLanguage(
115 lldb::LanguageType lang = lldb::eLanguageTypeUnknown);
117 DumpValueObjectOptions &SetRunValidator(bool run = true);
119 DumpValueObjectOptions &SetUseTypeDisplayName(bool dis = false);
121 DumpValueObjectOptions &SetAllowOnelinerMode(bool oneliner = false);
123 DumpValueObjectOptions &SetRevealEmptyAggregates(bool reveal = true);
125 DumpValueObjectOptions &SetElementCount(uint32_t element_count = 0);
127 DumpValueObjectOptions &
128 SetPointerAsArray(const PointerAsArraySettings &ptr_array);
131 uint32_t m_max_depth = UINT32_MAX;
132 lldb::DynamicValueType m_use_dynamic = lldb::eNoDynamicValues;
133 uint32_t m_omit_summary_depth = 0;
134 lldb::Format m_format = lldb::eFormatDefault;
135 lldb::TypeSummaryImplSP m_summary_sp;
136 std::string m_root_valobj_name;
137 lldb::LanguageType m_varformat_language = lldb::eLanguageTypeUnknown;
138 PointerDepth m_max_ptr_depth;
139 DeclPrintingHelper m_decl_printing_helper;
140 PointerAsArraySettings m_pointer_as_array;
141 bool m_use_synthetic : 1;
142 bool m_scope_already_checked : 1;
143 bool m_flat_output : 1;
144 bool m_ignore_cap : 1;
145 bool m_show_types : 1;
146 bool m_show_location : 1;
148 bool m_hide_root_type : 1;
149 bool m_hide_name : 1;
150 bool m_hide_value : 1;
151 bool m_run_validator : 1;
152 bool m_use_type_display_name : 1;
153 bool m_allow_oneliner_mode : 1;
154 bool m_hide_pointer_value : 1;
155 bool m_reveal_empty_aggregates : 1;
158 } // namespace lldb_private
160 #endif // lldb_DumpValueObjectOptions_h_