LLDB  mainline
DumpValueObjectOptions.h
Go to the documentation of this file.
1 //===-- DumpValueObjectOptions.h --------------------------------*- C++ -*-===//
2 //
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
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLDB_DATAFORMATTERS_DUMPVALUEOBJECTOPTIONS_H
10 #define LLDB_DATAFORMATTERS_DUMPVALUEOBJECTOPTIONS_H
11 
12 #include <string>
13 
14 #include "lldb/lldb-private.h"
15 #include "lldb/lldb-public.h"
16 
17 #include <functional>
18 #include <string>
19 
20 namespace lldb_private {
21 
23 public:
24  struct PointerDepth {
25  enum class Mode { Always, Default, Never } m_mode;
27 
29  if (m_count > 0)
30  return PointerDepth{m_mode, m_count - 1};
31  return PointerDepth{m_mode, m_count};
32  }
33 
34  bool CanAllowExpansion() const;
35  };
36 
38  size_t m_element_count = 0;
39  size_t m_base_element = 0;
40  size_t m_stride = 0;
41 
42  PointerAsArraySettings() = default;
43 
44  PointerAsArraySettings(size_t elem_count, size_t base_elem = 0,
45  size_t stride = 1)
46  : m_element_count(elem_count), m_base_element(base_elem),
47  m_stride(stride) {}
48 
49  operator bool() { return m_element_count > 0; }
50  };
51 
52  typedef std::function<bool(ConstString, ConstString,
53  const DumpValueObjectOptions &, Stream &)>
55 
57  static DumpValueObjectOptions g_default_options;
58 
59  return g_default_options;
60  }
61 
63 
65 
67  SetMaximumPointerDepth(PointerDepth depth = {PointerDepth::Mode::Never, 0});
68 
70 
72 
73  DumpValueObjectOptions &SetShowTypes(bool show = false);
74 
75  DumpValueObjectOptions &SetShowLocation(bool show = false);
76 
77  DumpValueObjectOptions &SetUseObjectiveC(bool use = false);
78 
79  DumpValueObjectOptions &SetShowSummary(bool show = true);
80 
83 
84  DumpValueObjectOptions &SetUseSyntheticValue(bool use_synthetic = true);
85 
86  DumpValueObjectOptions &SetScopeChecked(bool check = true);
87 
88  DumpValueObjectOptions &SetFlatOutput(bool flat = false);
89 
91 
92  DumpValueObjectOptions &SetIgnoreCap(bool ignore = false);
93 
95 
97 
99  SetSummary(lldb::TypeSummaryImplSP summary = lldb::TypeSummaryImplSP());
100 
101  DumpValueObjectOptions &SetRootValueObjectName(const char *name = nullptr);
102 
103  DumpValueObjectOptions &SetHideRootType(bool hide_root_type = false);
104 
105  DumpValueObjectOptions &SetHideName(bool hide_name = false);
106 
107  DumpValueObjectOptions &SetHideValue(bool hide_value = false);
108 
109  DumpValueObjectOptions &SetHidePointerValue(bool hide = false);
110 
113 
114  DumpValueObjectOptions &SetRunValidator(bool run = true);
115 
117 
118  DumpValueObjectOptions &SetAllowOnelinerMode(bool oneliner = false);
119 
121 
122  DumpValueObjectOptions &SetElementCount(uint32_t element_count = 0);
123 
125  SetPointerAsArray(const PointerAsArraySettings &ptr_array);
126 
131  lldb::TypeSummaryImplSP m_summary_sp;
137  bool m_use_synthetic : 1;
139  bool m_flat_output : 1;
140  bool m_ignore_cap : 1;
141  bool m_show_types : 1;
142  bool m_show_location : 1;
143  bool m_use_objc : 1;
145  bool m_hide_name : 1;
146  bool m_hide_value : 1;
147  bool m_run_validator : 1;
152 };
153 
154 } // namespace lldb_private
155 
156 #endif // LLDB_DATAFORMATTERS_DUMPVALUEOBJECTOPTIONS_H
lldb_private::DumpValueObjectOptions::SetFormat
DumpValueObjectOptions & SetFormat(lldb::Format format=lldb::eFormatDefault)
Definition: DumpValueObjectOptions.cpp:119
lldb_private::DumpValueObjectOptions::PointerAsArraySettings::m_base_element
size_t m_base_element
Definition: DumpValueObjectOptions.h:39
lldb_private::DumpValueObjectOptions::m_flat_output
bool m_flat_output
Definition: DumpValueObjectOptions.h:139
lldb_private::DumpValueObjectOptions::PointerAsArraySettings::m_stride
size_t m_stride
Definition: DumpValueObjectOptions.h:40
lldb_private::DumpValueObjectOptions::DefaultOptions
static const DumpValueObjectOptions DefaultOptions()
Definition: DumpValueObjectOptions.h:56
lldb_private::DumpValueObjectOptions::SetMaximumPointerDepth
DumpValueObjectOptions & SetMaximumPointerDepth(PointerDepth depth={PointerDepth::Mode::Never, 0})
Definition: DumpValueObjectOptions.cpp:35
lldb_private::DumpValueObjectOptions::PointerDepth::Mode
Mode
Definition: DumpValueObjectOptions.h:25
lldb_private::DumpValueObjectOptions::m_use_type_display_name
bool m_use_type_display_name
Definition: DumpValueObjectOptions.h:148
lldb_private::DumpValueObjectOptions::m_hide_root_type
bool m_hide_root_type
Definition: DumpValueObjectOptions.h:144
lldb-public.h
lldb_private::DumpValueObjectOptions::DeclPrintingHelper
std::function< bool(ConstString, ConstString, const DumpValueObjectOptions &, Stream &)> DeclPrintingHelper
Definition: DumpValueObjectOptions.h:54
lldb_private::DumpValueObjectOptions::SetHideRootType
DumpValueObjectOptions & SetHideRootType(bool hide_root_type=false)
Definition: DumpValueObjectOptions.cpp:140
lldb::Format
Format
Display format definitions.
Definition: lldb-enumerations.h:155
lldb::eNoDynamicValues
@ eNoDynamicValues
Definition: lldb-enumerations.h:495
lldb_private::DumpValueObjectOptions::m_summary_sp
lldb::TypeSummaryImplSP m_summary_sp
Definition: DumpValueObjectOptions.h:131
lldb_private::DumpValueObjectOptions::m_varformat_language
lldb::LanguageType m_varformat_language
Definition: DumpValueObjectOptions.h:133
lldb_private::DumpValueObjectOptions::SetDeclPrintingHelper
DumpValueObjectOptions & SetDeclPrintingHelper(DeclPrintingHelper helper)
Definition: DumpValueObjectOptions.cpp:47
lldb_private::DumpValueObjectOptions::SetUseDynamicType
DumpValueObjectOptions & SetUseDynamicType(lldb::DynamicValueType dyn=lldb::eNoDynamicValues)
Definition: DumpValueObjectOptions.cpp:76
lldb_private::DumpValueObjectOptions::m_scope_already_checked
bool m_scope_already_checked
Definition: DumpValueObjectOptions.h:138
lldb_private::DumpValueObjectOptions::m_omit_summary_depth
uint32_t m_omit_summary_depth
Definition: DumpValueObjectOptions.h:129
lldb_private::DumpValueObjectOptions::m_hide_name
bool m_hide_name
Definition: DumpValueObjectOptions.h:145
lldb::LanguageType
LanguageType
Programming language type.
Definition: lldb-enumerations.h:436
lldb_private::DumpValueObjectOptions::PointerAsArraySettings::PointerAsArraySettings
PointerAsArraySettings(size_t elem_count, size_t base_elem=0, size_t stride=1)
Definition: DumpValueObjectOptions.h:44
lldb_private::DumpValueObjectOptions::SetShowTypes
DumpValueObjectOptions & SetShowTypes(bool show=false)
Definition: DumpValueObjectOptions.cpp:52
lldb_private::DumpValueObjectOptions::SetOmitSummaryDepth
DumpValueObjectOptions & SetOmitSummaryDepth(uint32_t depth=0)
Definition: DumpValueObjectOptions.cpp:98
lldb_private::DumpValueObjectOptions::SetRevealEmptyAggregates
DumpValueObjectOptions & SetRevealEmptyAggregates(bool reveal=true)
Definition: DumpValueObjectOptions.cpp:185
lldb_private::DumpValueObjectOptions::SetAllowOnelinerMode
DumpValueObjectOptions & SetAllowOnelinerMode(bool oneliner=false)
Definition: DumpValueObjectOptions.cpp:179
lldb_private::Stream
Definition: Stream.h:28
lldb_private::DumpValueObjectOptions::DumpValueObjectOptions
DumpValueObjectOptions()
Definition: DumpValueObjectOptions.cpp:16
lldb_private::DumpValueObjectOptions::m_format
lldb::Format m_format
Definition: DumpValueObjectOptions.h:130
lldb_private::DumpValueObjectOptions::m_use_synthetic
bool m_use_synthetic
Definition: DumpValueObjectOptions.h:137
lldb_private::DumpValueObjectOptions::SetUseTypeDisplayName
DumpValueObjectOptions & SetUseTypeDisplayName(bool dis=false)
Definition: DumpValueObjectOptions.cpp:173
lldb_private::DumpValueObjectOptions::SetHideName
DumpValueObjectOptions & SetHideName(bool hide_name=false)
Definition: DumpValueObjectOptions.cpp:145
lldb_private::DumpValueObjectOptions::PointerDepth::m_mode
enum lldb_private::DumpValueObjectOptions::PointerDepth::Mode m_mode
lldb_private::DumpValueObjectOptions::SetUseObjectiveC
DumpValueObjectOptions & SetUseObjectiveC(bool use=false)
Definition: DumpValueObjectOptions.cpp:62
lldb_private::DumpValueObjectOptions::SetFlatOutput
DumpValueObjectOptions & SetFlatOutput(bool flat=false)
Definition: DumpValueObjectOptions.cpp:92
lldb_private::DumpValueObjectOptions::SetIgnoreCap
DumpValueObjectOptions & SetIgnoreCap(bool ignore=false)
Definition: DumpValueObjectOptions.cpp:103
lldb_private::DumpValueObjectOptions::PointerDepth::Mode::Never
@ Never
lldb_private::DumpValueObjectOptions::PointerDepth::m_count
uint32_t m_count
Definition: DumpValueObjectOptions.h:26
lldb_private::DumpValueObjectOptions::PointerAsArraySettings
Definition: DumpValueObjectOptions.h:37
lldb_private::DumpValueObjectOptions::m_show_types
bool m_show_types
Definition: DumpValueObjectOptions.h:141
lldb_private::DumpValueObjectOptions::m_run_validator
bool m_run_validator
Definition: DumpValueObjectOptions.h:147
lldb_private::DumpValueObjectOptions::SetRawDisplay
DumpValueObjectOptions & SetRawDisplay()
Definition: DumpValueObjectOptions.cpp:108
lldb_private::DumpValueObjectOptions::m_use_objc
bool m_use_objc
Definition: DumpValueObjectOptions.h:143
lldb_private::DumpValueObjectOptions::SetUseSyntheticValue
DumpValueObjectOptions & SetUseSyntheticValue(bool use_synthetic=true)
Definition: DumpValueObjectOptions.cpp:82
lldb_private::ConstString
Definition: ConstString.h:40
lldb_private::DumpValueObjectOptions::m_reveal_empty_aggregates
bool m_reveal_empty_aggregates
Definition: DumpValueObjectOptions.h:151
lldb_private::DumpValueObjectOptions::SetVariableFormatDisplayLanguage
DumpValueObjectOptions & SetVariableFormatDisplayLanguage(lldb::LanguageType lang=lldb::eLanguageTypeUnknown)
Definition: DumpValueObjectOptions.cpp:161
lldb_private::DumpValueObjectOptions::m_root_valobj_name
std::string m_root_valobj_name
Definition: DumpValueObjectOptions.h:132
lldb::DynamicValueType
DynamicValueType
Definition: lldb-enumerations.h:494
string
string(SUBSTRING ${p} 10 -1 pStripped) if($
Definition: Plugins/CMakeLists.txt:40
lldb_private::DumpValueObjectOptions::SetSummary
DumpValueObjectOptions & SetSummary(lldb::TypeSummaryImplSP summary=lldb::TypeSummaryImplSP())
Definition: DumpValueObjectOptions.cpp:125
lldb_private::DumpValueObjectOptions::SetMaximumDepth
DumpValueObjectOptions & SetMaximumDepth(uint32_t depth=0)
Definition: DumpValueObjectOptions.cpp:41
lldb_private::DumpValueObjectOptions::m_hide_pointer_value
bool m_hide_pointer_value
Definition: DumpValueObjectOptions.h:150
lldb-private.h
lldb_private::DumpValueObjectOptions::m_allow_oneliner_mode
bool m_allow_oneliner_mode
Definition: DumpValueObjectOptions.h:149
lldb_private::DumpValueObjectOptions::SetHidePointerValue
DumpValueObjectOptions & SetHidePointerValue(bool hide=false)
Definition: DumpValueObjectOptions.cpp:155
lldb_private::DumpValueObjectOptions::PointerAsArraySettings::m_element_count
size_t m_element_count
Definition: DumpValueObjectOptions.h:38
lldb_private::DumpValueObjectOptions::PointerDepth::Mode::Default
@ Default
lldb_private::DumpValueObjectOptions::m_pointer_as_array
PointerAsArraySettings m_pointer_as_array
Definition: DumpValueObjectOptions.h:136
lldb_private::ValueObject
ValueObject:
Definition: ValueObject.h:105
lldb::eLanguageTypeUnknown
@ eLanguageTypeUnknown
Unknown or invalid language value.
Definition: lldb-enumerations.h:437
uint32_t
lldb_private::DumpValueObjectOptions::m_use_dynamic
lldb::DynamicValueType m_use_dynamic
Definition: DumpValueObjectOptions.h:128
lldb_private::DumpValueObjectOptions::m_max_depth
uint32_t m_max_depth
Definition: DumpValueObjectOptions.h:127
UINT32_MAX
#define UINT32_MAX
Definition: lldb-defines.h:31
lldb_private::DumpValueObjectOptions::SetShowLocation
DumpValueObjectOptions & SetShowLocation(bool show=false)
Definition: DumpValueObjectOptions.cpp:57
lldb_private::DumpValueObjectOptions::SetHideValue
DumpValueObjectOptions & SetHideValue(bool hide_value=false)
Definition: DumpValueObjectOptions.cpp:150
lldb_private::DumpValueObjectOptions::m_decl_printing_helper
DeclPrintingHelper m_decl_printing_helper
Definition: DumpValueObjectOptions.h:135
lldb_private::DumpValueObjectOptions
Definition: DumpValueObjectOptions.h:22
lldb_private::DumpValueObjectOptions::m_ignore_cap
bool m_ignore_cap
Definition: DumpValueObjectOptions.h:140
lldb_private::DumpValueObjectOptions::PointerDepth::CanAllowExpansion
bool CanAllowExpansion() const
Definition: ValueObjectPrinter.cpp:472
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb_private::DumpValueObjectOptions::PointerDepth::Mode::Always
@ Always
lldb_private::DumpValueObjectOptions::m_max_ptr_depth
PointerDepth m_max_ptr_depth
Definition: DumpValueObjectOptions.h:134
lldb_private::DumpValueObjectOptions::SetElementCount
DumpValueObjectOptions & SetElementCount(uint32_t element_count=0)
Definition: DumpValueObjectOptions.cpp:191
lldb_private::DumpValueObjectOptions::PointerDepth
Definition: DumpValueObjectOptions.h:24
lldb_private::DumpValueObjectOptions::SetScopeChecked
DumpValueObjectOptions & SetScopeChecked(bool check=true)
Definition: DumpValueObjectOptions.cpp:87
lldb_private::DumpValueObjectOptions::m_show_location
bool m_show_location
Definition: DumpValueObjectOptions.h:142
lldb_private::DumpValueObjectOptions::SetRunValidator
DumpValueObjectOptions & SetRunValidator(bool run=true)
Definition: DumpValueObjectOptions.cpp:167
lldb_private::DumpValueObjectOptions::PointerAsArraySettings::PointerAsArraySettings
PointerAsArraySettings()=default
lldb_private::DumpValueObjectOptions::SetPointerAsArray
DumpValueObjectOptions & SetPointerAsArray(const PointerAsArraySettings &ptr_array)
Definition: DumpValueObjectOptions.cpp:196
lldb_private::DumpValueObjectOptions::SetShowSummary
DumpValueObjectOptions & SetShowSummary(bool show=true)
Definition: DumpValueObjectOptions.cpp:67
lldb_private::DumpValueObjectOptions::m_hide_value
bool m_hide_value
Definition: DumpValueObjectOptions.h:146
lldb_private::DumpValueObjectOptions::PointerDepth::operator--
PointerDepth operator--() const
Definition: DumpValueObjectOptions.h:28
lldb_private::DumpValueObjectOptions::SetRootValueObjectName
DumpValueObjectOptions & SetRootValueObjectName(const char *name=nullptr)
Definition: DumpValueObjectOptions.cpp:131
lldb::eFormatDefault
@ eFormatDefault
Definition: lldb-enumerations.h:156