1 //===-- DumpValueObjectOptions.h --------------------------------*- C++ -*-===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 #ifndef lldb_DumpValueObjectOptions_h_ 11 #define lldb_DumpValueObjectOptions_h_ 12 13 #include <string> 14 15 #include "lldb/lldb-private.h" 16 #include "lldb/lldb-public.h" 17 18 #include <functional> 19 #include <string> 20 21 namespace lldb_private { 22 23 class DumpValueObjectOptions { 24 public: 25 struct PointerDepth { 26 enum class Mode { Always, Default, Never } m_mode; 27 uint32_t m_count; 28 29 PointerDepth operator--() const { 30 if (m_count > 0) 31 return PointerDepth{m_mode, m_count - 1}; 32 return PointerDepth{m_mode, m_count}; 33 } 34 35 bool CanAllowExpansion() const; 36 }; 37 38 struct PointerAsArraySettings { 39 size_t m_element_count; 40 size_t m_base_element; 41 size_t m_stride; 42 PointerAsArraySettingsPointerAsArraySettings43 PointerAsArraySettings() 44 : m_element_count(0), m_base_element(0), m_stride() {} 45 46 PointerAsArraySettings(size_t elem_count, size_t base_elem = 0, 47 size_t stride = 1) m_element_countPointerAsArraySettings48 : m_element_count(elem_count), m_base_element(base_elem), 49 m_stride(stride) {} 50 51 operator bool() { return m_element_count > 0; } 52 }; 53 54 typedef std::function<bool(ConstString, ConstString, 55 const DumpValueObjectOptions &, Stream &)> 56 DeclPrintingHelper; 57 DefaultOptions()58 static const DumpValueObjectOptions DefaultOptions() { 59 static DumpValueObjectOptions g_default_options; 60 61 return g_default_options; 62 } 63 64 DumpValueObjectOptions(); 65 66 DumpValueObjectOptions(const DumpValueObjectOptions &rhs) = default; 67 68 DumpValueObjectOptions(ValueObject &valobj); 69 70 DumpValueObjectOptions & 71 SetMaximumPointerDepth(PointerDepth depth = {PointerDepth::Mode::Never, 0}); 72 73 DumpValueObjectOptions &SetMaximumDepth(uint32_t depth = 0); 74 75 DumpValueObjectOptions &SetDeclPrintingHelper(DeclPrintingHelper helper); 76 77 DumpValueObjectOptions &SetShowTypes(bool show = false); 78 79 DumpValueObjectOptions &SetShowLocation(bool show = false); 80 81 DumpValueObjectOptions &SetUseObjectiveC(bool use = false); 82 83 DumpValueObjectOptions &SetShowSummary(bool show = true); 84 85 DumpValueObjectOptions & 86 SetUseDynamicType(lldb::DynamicValueType dyn = lldb::eNoDynamicValues); 87 88 DumpValueObjectOptions &SetUseSyntheticValue(bool use_synthetic = true); 89 90 DumpValueObjectOptions &SetScopeChecked(bool check = true); 91 92 DumpValueObjectOptions &SetFlatOutput(bool flat = false); 93 94 DumpValueObjectOptions &SetOmitSummaryDepth(uint32_t depth = 0); 95 96 DumpValueObjectOptions &SetIgnoreCap(bool ignore = false); 97 98 DumpValueObjectOptions &SetRawDisplay(); 99 100 DumpValueObjectOptions &SetFormat(lldb::Format format = lldb::eFormatDefault); 101 102 DumpValueObjectOptions & 103 SetSummary(lldb::TypeSummaryImplSP summary = lldb::TypeSummaryImplSP()); 104 105 DumpValueObjectOptions &SetRootValueObjectName(const char *name = nullptr); 106 107 DumpValueObjectOptions &SetHideRootType(bool hide_root_type = false); 108 109 DumpValueObjectOptions &SetHideName(bool hide_name = false); 110 111 DumpValueObjectOptions &SetHideValue(bool hide_value = false); 112 113 DumpValueObjectOptions &SetHidePointerValue(bool hide = false); 114 115 DumpValueObjectOptions &SetVariableFormatDisplayLanguage( 116 lldb::LanguageType lang = lldb::eLanguageTypeUnknown); 117 118 DumpValueObjectOptions &SetRunValidator(bool run = true); 119 120 DumpValueObjectOptions &SetUseTypeDisplayName(bool dis = false); 121 122 DumpValueObjectOptions &SetAllowOnelinerMode(bool oneliner = false); 123 124 DumpValueObjectOptions &SetRevealEmptyAggregates(bool reveal = true); 125 126 DumpValueObjectOptions &SetElementCount(uint32_t element_count = 0); 127 128 DumpValueObjectOptions & 129 SetPointerAsArray(const PointerAsArraySettings &ptr_array); 130 131 public: 132 uint32_t m_max_depth = UINT32_MAX; 133 lldb::DynamicValueType m_use_dynamic = lldb::eNoDynamicValues; 134 uint32_t m_omit_summary_depth = 0; 135 lldb::Format m_format = lldb::eFormatDefault; 136 lldb::TypeSummaryImplSP m_summary_sp; 137 std::string m_root_valobj_name; 138 lldb::LanguageType m_varformat_language = lldb::eLanguageTypeUnknown; 139 PointerDepth m_max_ptr_depth; 140 DeclPrintingHelper m_decl_printing_helper; 141 PointerAsArraySettings m_pointer_as_array; 142 bool m_use_synthetic : 1; 143 bool m_scope_already_checked : 1; 144 bool m_flat_output : 1; 145 bool m_ignore_cap : 1; 146 bool m_show_types : 1; 147 bool m_show_location : 1; 148 bool m_use_objc : 1; 149 bool m_hide_root_type : 1; 150 bool m_hide_name : 1; 151 bool m_hide_value : 1; 152 bool m_run_validator : 1; 153 bool m_use_type_display_name : 1; 154 bool m_allow_oneliner_mode : 1; 155 bool m_hide_pointer_value : 1; 156 bool m_reveal_empty_aggregates : 1; 157 }; 158 159 } // namespace lldb_private 160 161 #endif // lldb_DumpValueObjectOptions_h_ 162