LLDB  mainline
SBVariablesOptions.cpp
Go to the documentation of this file.
1 //===-- SBVariablesOptions.cpp --------------------------------------------===//
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 
10 #include "lldb/API/SBTarget.h"
11 #include "lldb/Target/Target.h"
13 
14 #include "lldb/lldb-private.h"
15 
16 using namespace lldb;
17 using namespace lldb_private;
18 
20 public:
22  : m_include_arguments(false), m_include_locals(false),
23  m_include_statics(false), m_in_scope_only(false),
24  m_include_runtime_support_values(false) {}
25 
26  VariablesOptionsImpl(const VariablesOptionsImpl &) = default;
27 
28  ~VariablesOptionsImpl() = default;
29 
30  VariablesOptionsImpl &operator=(const VariablesOptionsImpl &) = default;
31 
32  bool GetIncludeArguments() const { return m_include_arguments; }
33 
34  void SetIncludeArguments(bool b) { m_include_arguments = b; }
35 
36  bool GetIncludeRecognizedArguments(const lldb::TargetSP &target_sp) const {
37  if (m_include_recognized_arguments != eLazyBoolCalculate)
38  return m_include_recognized_arguments;
39  return target_sp ? target_sp->GetDisplayRecognizedArguments() : false;
40  }
41 
43  m_include_recognized_arguments = b ? eLazyBoolYes : eLazyBoolNo;
44  }
45 
46  bool GetIncludeLocals() const { return m_include_locals; }
47 
48  void SetIncludeLocals(bool b) { m_include_locals = b; }
49 
50  bool GetIncludeStatics() const { return m_include_statics; }
51 
52  void SetIncludeStatics(bool b) { m_include_statics = b; }
53 
54  bool GetInScopeOnly() const { return m_in_scope_only; }
55 
56  void SetInScopeOnly(bool b) { m_in_scope_only = b; }
57 
59  return m_include_runtime_support_values;
60  }
61 
63  m_include_runtime_support_values = b;
64  }
65 
66  lldb::DynamicValueType GetUseDynamic() const { return m_use_dynamic; }
67 
68  void SetUseDynamic(lldb::DynamicValueType d) { m_use_dynamic = d; }
69 
70 private:
72  bool m_include_locals : 1;
74  bool m_in_scope_only : 1;
76  LazyBool m_include_recognized_arguments =
77  eLazyBoolCalculate; // can be overridden with a setting
79 };
80 
82  : m_opaque_up(new VariablesOptionsImpl()) {
83  LLDB_INSTRUMENT_VA(this);
84 }
85 
87  : m_opaque_up(new VariablesOptionsImpl(options.ref())) {
88  LLDB_INSTRUMENT_VA(this, options);
89 }
90 
92 operator=(const SBVariablesOptions &options) {
93  LLDB_INSTRUMENT_VA(this, options);
94 
95  m_opaque_up = std::make_unique<VariablesOptionsImpl>(options.ref());
96  return *this;
97 }
98 
100 
102  LLDB_INSTRUMENT_VA(this);
103  return this->operator bool();
104 }
105 SBVariablesOptions::operator bool() const {
106  LLDB_INSTRUMENT_VA(this);
107 
108  return m_opaque_up != nullptr;
109 }
110 
112  LLDB_INSTRUMENT_VA(this);
113 
114  return m_opaque_up->GetIncludeArguments();
115 }
116 
118  LLDB_INSTRUMENT_VA(this, arguments);
119 
120  m_opaque_up->SetIncludeArguments(arguments);
121 }
122 
124  const lldb::SBTarget &target) const {
125  LLDB_INSTRUMENT_VA(this, target);
126 
127  return m_opaque_up->GetIncludeRecognizedArguments(target.GetSP());
128 }
129 
131  LLDB_INSTRUMENT_VA(this, arguments);
132 
133  m_opaque_up->SetIncludeRecognizedArguments(arguments);
134 }
135 
137  LLDB_INSTRUMENT_VA(this);
138 
139  return m_opaque_up->GetIncludeLocals();
140 }
141 
143  LLDB_INSTRUMENT_VA(this, locals);
144 
145  m_opaque_up->SetIncludeLocals(locals);
146 }
147 
149  LLDB_INSTRUMENT_VA(this);
150 
151  return m_opaque_up->GetIncludeStatics();
152 }
153 
155  LLDB_INSTRUMENT_VA(this, statics);
156 
157  m_opaque_up->SetIncludeStatics(statics);
158 }
159 
161  LLDB_INSTRUMENT_VA(this);
162 
163  return m_opaque_up->GetInScopeOnly();
164 }
165 
166 void SBVariablesOptions::SetInScopeOnly(bool in_scope_only) {
167  LLDB_INSTRUMENT_VA(this, in_scope_only);
168 
169  m_opaque_up->SetInScopeOnly(in_scope_only);
170 }
171 
173  LLDB_INSTRUMENT_VA(this);
174 
175  return m_opaque_up->GetIncludeRuntimeSupportValues();
176 }
177 
179  bool runtime_support_values) {
180  LLDB_INSTRUMENT_VA(this, runtime_support_values);
181 
182  m_opaque_up->SetIncludeRuntimeSupportValues(runtime_support_values);
183 }
184 
186  LLDB_INSTRUMENT_VA(this);
187 
188  return m_opaque_up->GetUseDynamic();
189 }
190 
192  LLDB_INSTRUMENT_VA(this, dynamic);
193 
194  m_opaque_up->SetUseDynamic(dynamic);
195 }
196 
198  return m_opaque_up.operator->();
199 }
200 
202  return m_opaque_up.operator->();
203 }
204 
206 
208 
210  return *m_opaque_up;
211 }
212 
214  : m_opaque_up(std::move(lldb_object_ptr)) {}
215 
217  m_opaque_up.reset(std::move(lldb_object_ptr));
218 }
Instrumentation.h
lldb::SBVariablesOptions
Definition: SBVariablesOptions.h:19
VariablesOptionsImpl::GetIncludeLocals
bool GetIncludeLocals() const
Definition: SBVariablesOptions.cpp:46
lldb::SBVariablesOptions::~SBVariablesOptions
~SBVariablesOptions()
lldb::eNoDynamicValues
@ eNoDynamicValues
Definition: lldb-enumerations.h:495
VariablesOptionsImpl::GetIncludeStatics
bool GetIncludeStatics() const
Definition: SBVariablesOptions.cpp:50
lldb::SBVariablesOptions::GetIncludeLocals
bool GetIncludeLocals() const
Definition: SBVariablesOptions.cpp:136
lldb::SBVariablesOptions::get
VariablesOptionsImpl * get()
Definition: SBVariablesOptions.cpp:205
VariablesOptionsImpl::GetIncludeRuntimeSupportValues
bool GetIncludeRuntimeSupportValues() const
Definition: SBVariablesOptions.cpp:58
lldb_private::eLazyBoolYes
@ eLazyBoolYes
Definition: lldb-private-enumerations.h:115
VariablesOptionsImpl::GetInScopeOnly
bool GetInScopeOnly() const
Definition: SBVariablesOptions.cpp:54
lldb::SBVariablesOptions::IsValid
bool IsValid() const
Definition: SBVariablesOptions.cpp:101
lldb::SBVariablesOptions::GetUseDynamic
lldb::DynamicValueType GetUseDynamic() const
Definition: SBVariablesOptions.cpp:185
lldb_private::LazyBool
LazyBool
Definition: lldb-private-enumerations.h:115
VariablesOptionsImpl::SetInScopeOnly
void SetInScopeOnly(bool b)
Definition: SBVariablesOptions.cpp:56
VariablesOptionsImpl::SetUseDynamic
void SetUseDynamic(lldb::DynamicValueType d)
Definition: SBVariablesOptions.cpp:68
lldb::SBVariablesOptions::GetIncludeRecognizedArguments
bool GetIncludeRecognizedArguments(const lldb::SBTarget &) const
Definition: SBVariablesOptions.cpp:123
Target.h
lldb::SBTarget
Definition: SBTarget.h:29
lldb::SBVariablesOptions::SetIncludeRecognizedArguments
void SetIncludeRecognizedArguments(bool)
Definition: SBVariablesOptions.cpp:130
lldb::SBVariablesOptions::GetIncludeStatics
bool GetIncludeStatics() const
Definition: SBVariablesOptions.cpp:148
VariablesOptionsImpl::m_include_runtime_support_values
bool m_include_runtime_support_values
Definition: SBVariablesOptions.cpp:75
lldb::SBVariablesOptions::operator->
VariablesOptionsImpl * operator->()
Definition: SBVariablesOptions.cpp:197
lldb::SBVariablesOptions::SetInScopeOnly
void SetInScopeOnly(bool)
Definition: SBVariablesOptions.cpp:166
lldb::DynamicValueType
DynamicValueType
Definition: lldb-enumerations.h:494
VariablesOptionsImpl::SetIncludeStatics
void SetIncludeStatics(bool b)
Definition: SBVariablesOptions.cpp:52
lldb::SBVariablesOptions::GetIncludeRuntimeSupportValues
bool GetIncludeRuntimeSupportValues() const
Definition: SBVariablesOptions.cpp:172
lldb::SBVariablesOptions::GetIncludeArguments
bool GetIncludeArguments() const
Definition: SBVariablesOptions.cpp:111
lldb::SBVariablesOptions::SetIncludeRuntimeSupportValues
void SetIncludeRuntimeSupportValues(bool)
Definition: SBVariablesOptions.cpp:178
lldb::SBVariablesOptions::SetIncludeLocals
void SetIncludeLocals(bool)
Definition: SBVariablesOptions.cpp:142
lldb-private.h
VariablesOptionsImpl::VariablesOptionsImpl
VariablesOptionsImpl()
Definition: SBVariablesOptions.cpp:21
lldb::SBVariablesOptions::m_opaque_up
std::unique_ptr< VariablesOptionsImpl > m_opaque_up
Definition: SBVariablesOptions.h:77
SBVariablesOptions.h
lldb_private::eLazyBoolNo
@ eLazyBoolNo
Definition: lldb-private-enumerations.h:115
lldb::SBVariablesOptions::SetOptions
void SetOptions(VariablesOptionsImpl *lldb_object_ptr)
Definition: SBVariablesOptions.cpp:216
lldb::SBVariablesOptions::GetInScopeOnly
bool GetInScopeOnly() const
Definition: SBVariablesOptions.cpp:160
VariablesOptionsImpl::m_include_statics
bool m_include_statics
Definition: SBVariablesOptions.cpp:73
VariablesOptionsImpl::GetIncludeArguments
bool GetIncludeArguments() const
Definition: SBVariablesOptions.cpp:32
lldb::SBVariablesOptions::ref
VariablesOptionsImpl & ref()
Definition: SBVariablesOptions.cpp:207
lldb::SBVariablesOptions::SetIncludeStatics
void SetIncludeStatics(bool)
Definition: SBVariablesOptions.cpp:154
VariablesOptionsImpl::SetIncludeLocals
void SetIncludeLocals(bool b)
Definition: SBVariablesOptions.cpp:48
VariablesOptionsImpl::m_include_arguments
bool m_include_arguments
Definition: SBVariablesOptions.cpp:71
lldb::SBVariablesOptions::SBVariablesOptions
SBVariablesOptions()
Definition: SBVariablesOptions.cpp:81
lldb::SBVariablesOptions::SetUseDynamic
void SetUseDynamic(lldb::DynamicValueType)
Definition: SBVariablesOptions.cpp:191
VariablesOptionsImpl::SetIncludeRuntimeSupportValues
void SetIncludeRuntimeSupportValues(bool b)
Definition: SBVariablesOptions.cpp:62
lldb::SBVariablesOptions::operator=
SBVariablesOptions & operator=(const SBVariablesOptions &options)
Definition: SBVariablesOptions.cpp:92
VariablesOptionsImpl
Definition: SBVariablesOptions.cpp:19
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb_private::eLazyBoolCalculate
@ eLazyBoolCalculate
Definition: lldb-private-enumerations.h:115
VariablesOptionsImpl::m_include_locals
bool m_include_locals
Definition: SBVariablesOptions.cpp:72
lldb::SBTarget::GetSP
lldb::TargetSP GetSP() const
Definition: SBTarget.cpp:576
LLDB_INSTRUMENT_VA
#define LLDB_INSTRUMENT_VA(...)
Definition: Instrumentation.h:98
VariablesOptionsImpl::m_in_scope_only
bool m_in_scope_only
Definition: SBVariablesOptions.cpp:74
VariablesOptionsImpl::SetIncludeArguments
void SetIncludeArguments(bool b)
Definition: SBVariablesOptions.cpp:34
VariablesOptionsImpl::GetUseDynamic
lldb::DynamicValueType GetUseDynamic() const
Definition: SBVariablesOptions.cpp:66
VariablesOptionsImpl::SetIncludeRecognizedArguments
void SetIncludeRecognizedArguments(bool b)
Definition: SBVariablesOptions.cpp:42
SBTarget.h
lldb::SBVariablesOptions::SetIncludeArguments
void SetIncludeArguments(bool)
Definition: SBVariablesOptions.cpp:117
lldb
Definition: SBAddress.h:15
VariablesOptionsImpl::GetIncludeRecognizedArguments
bool GetIncludeRecognizedArguments(const lldb::TargetSP &target_sp) const
Definition: SBVariablesOptions.cpp:36