1 //===-- DumpValueObjectOptions.cpp -----------------------------------*- 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 #include "lldb/DataFormatters/DumpValueObjectOptions.h" 11 12 // C Includes 13 // C++ Includes 14 // Other libraries and framework includes 15 // Project includes 16 #include "lldb/Core/ValueObject.h" 17 18 using namespace lldb; 19 using namespace lldb_private; 20 21 DumpValueObjectOptions::DumpValueObjectOptions() : 22 m_summary_sp(), 23 m_root_valobj_name(), 24 m_max_ptr_depth(PointerDepth{PointerDepth::Mode::Default,0}), 25 m_decl_printing_helper(), 26 m_use_synthetic(true), 27 m_scope_already_checked(false), 28 m_flat_output(false), 29 m_ignore_cap(false), 30 m_show_types(false), 31 m_show_location(false), 32 m_use_objc(false), 33 m_hide_root_type(false), 34 m_hide_name(false), 35 m_hide_value(false), 36 m_run_validator(false), 37 m_use_type_display_name(true), 38 m_allow_oneliner_mode(true), 39 m_hide_pointer_value(false), 40 m_reveal_empty_aggregates(true) 41 {} 42 43 44 DumpValueObjectOptions::DumpValueObjectOptions (ValueObject& valobj) : 45 DumpValueObjectOptions() 46 { 47 m_use_dynamic = valobj.GetDynamicValueType(); 48 m_use_synthetic = valobj.IsSynthetic(); 49 m_varformat_language = valobj.GetPreferredDisplayLanguage(); 50 } 51 52 DumpValueObjectOptions& 53 DumpValueObjectOptions::SetMaximumPointerDepth(PointerDepth depth) 54 { 55 m_max_ptr_depth = depth; 56 return *this; 57 } 58 59 DumpValueObjectOptions& 60 DumpValueObjectOptions::SetMaximumDepth(uint32_t depth) 61 { 62 m_max_depth = depth; 63 return *this; 64 } 65 66 DumpValueObjectOptions& 67 DumpValueObjectOptions::SetDeclPrintingHelper(DeclPrintingHelper helper) 68 { 69 m_decl_printing_helper = helper; 70 return *this; 71 } 72 73 DumpValueObjectOptions& 74 DumpValueObjectOptions::SetShowTypes(bool show) 75 { 76 m_show_types = show; 77 return *this; 78 } 79 80 DumpValueObjectOptions& 81 DumpValueObjectOptions::SetShowLocation(bool show) 82 { 83 m_show_location = show; 84 return *this; 85 } 86 87 DumpValueObjectOptions& 88 DumpValueObjectOptions::SetUseObjectiveC(bool use) 89 { 90 m_use_objc = use; 91 return *this; 92 } 93 94 DumpValueObjectOptions& 95 DumpValueObjectOptions::SetShowSummary(bool show) 96 { 97 if (show == false) 98 SetOmitSummaryDepth(UINT32_MAX); 99 else 100 SetOmitSummaryDepth(0); 101 return *this; 102 } 103 104 DumpValueObjectOptions& 105 DumpValueObjectOptions::SetUseDynamicType(lldb::DynamicValueType dyn) 106 { 107 m_use_dynamic = dyn; 108 return *this; 109 } 110 111 DumpValueObjectOptions& 112 DumpValueObjectOptions::SetUseSyntheticValue(bool use_synthetic) 113 { 114 m_use_synthetic = use_synthetic; 115 return *this; 116 } 117 118 DumpValueObjectOptions& 119 DumpValueObjectOptions::SetScopeChecked(bool check) 120 { 121 m_scope_already_checked = check; 122 return *this; 123 } 124 125 DumpValueObjectOptions& 126 DumpValueObjectOptions::SetFlatOutput(bool flat) 127 { 128 m_flat_output = flat; 129 return *this; 130 } 131 132 DumpValueObjectOptions& 133 DumpValueObjectOptions::SetOmitSummaryDepth(uint32_t depth) 134 { 135 m_omit_summary_depth = depth; 136 return *this; 137 } 138 139 DumpValueObjectOptions& 140 DumpValueObjectOptions::SetIgnoreCap(bool ignore) 141 { 142 m_ignore_cap = ignore; 143 return *this; 144 } 145 146 DumpValueObjectOptions& 147 DumpValueObjectOptions::SetRawDisplay() 148 { 149 SetUseSyntheticValue(false); 150 SetOmitSummaryDepth(UINT32_MAX); 151 SetIgnoreCap(true); 152 SetHideName(false); 153 SetHideValue(false); 154 SetUseTypeDisplayName(false); 155 SetAllowOnelinerMode(false); 156 return *this; 157 } 158 159 DumpValueObjectOptions& 160 DumpValueObjectOptions::SetFormat (lldb::Format format) 161 { 162 m_format = format; 163 return *this; 164 } 165 166 DumpValueObjectOptions& 167 DumpValueObjectOptions::SetSummary (lldb::TypeSummaryImplSP summary) 168 { 169 m_summary_sp = summary; 170 return *this; 171 } 172 173 DumpValueObjectOptions& 174 DumpValueObjectOptions::SetRootValueObjectName (const char* name) 175 { 176 if (name) 177 m_root_valobj_name.assign(name); 178 else 179 m_root_valobj_name.clear(); 180 return *this; 181 } 182 183 DumpValueObjectOptions& 184 DumpValueObjectOptions::SetHideRootType (bool hide_root_type) 185 { 186 m_hide_root_type = hide_root_type; 187 return *this; 188 } 189 190 DumpValueObjectOptions& 191 DumpValueObjectOptions::SetHideName (bool hide_name) 192 { 193 m_hide_name = hide_name; 194 return *this; 195 } 196 197 DumpValueObjectOptions& 198 DumpValueObjectOptions::SetHideValue (bool hide_value) 199 { 200 m_hide_value = hide_value; 201 return *this; 202 } 203 204 DumpValueObjectOptions& 205 DumpValueObjectOptions::SetHidePointerValue (bool hide) 206 { 207 m_hide_pointer_value = hide; 208 return *this; 209 } 210 211 DumpValueObjectOptions& 212 DumpValueObjectOptions::SetVariableFormatDisplayLanguage (lldb::LanguageType lang) 213 { 214 m_varformat_language = lang; 215 return *this; 216 } 217 218 DumpValueObjectOptions& 219 DumpValueObjectOptions::SetRunValidator (bool run) 220 { 221 m_run_validator = run; 222 return *this; 223 } 224 225 DumpValueObjectOptions& 226 DumpValueObjectOptions::SetUseTypeDisplayName (bool dis) 227 { 228 m_use_type_display_name = dis; 229 return *this; 230 } 231 232 DumpValueObjectOptions& 233 DumpValueObjectOptions::SetAllowOnelinerMode (bool oneliner) 234 { 235 m_allow_oneliner_mode = oneliner; 236 return *this; 237 } 238 239 DumpValueObjectOptions& 240 DumpValueObjectOptions::SetRevealEmptyAggregates (bool reveal) 241 { 242 m_reveal_empty_aggregates = reveal; 243 return *this; 244 } 245 246 DumpValueObjectOptions& 247 DumpValueObjectOptions::SetElementCount (uint32_t element_count) 248 { 249 m_element_count = element_count; 250 return *this; 251 } 252