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 "SBReproducerPrivate.h"
11 #include "lldb/API/SBTarget.h"
12 #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  m_include_recognized_arguments(eLazyBoolCalculate),
26  m_use_dynamic(lldb::eNoDynamicValues) {}
27 
28  VariablesOptionsImpl(const VariablesOptionsImpl &) = default;
29 
30  ~VariablesOptionsImpl() = default;
31 
32  VariablesOptionsImpl &operator=(const VariablesOptionsImpl &) = default;
33 
34  bool GetIncludeArguments() const { return m_include_arguments; }
35 
36  void SetIncludeArguments(bool b) { m_include_arguments = b; }
37 
38  bool GetIncludeRecognizedArguments(const lldb::TargetSP &target_sp) const {
39  if (m_include_recognized_arguments != eLazyBoolCalculate)
40  return m_include_recognized_arguments;
41  return target_sp ? target_sp->GetDisplayRecognizedArguments() : false;
42  }
43 
45  m_include_recognized_arguments = b ? eLazyBoolYes : eLazyBoolNo;
46  }
47 
48  bool GetIncludeLocals() const { return m_include_locals; }
49 
50  void SetIncludeLocals(bool b) { m_include_locals = b; }
51 
52  bool GetIncludeStatics() const { return m_include_statics; }
53 
54  void SetIncludeStatics(bool b) { m_include_statics = b; }
55 
56  bool GetInScopeOnly() const { return m_in_scope_only; }
57 
58  void SetInScopeOnly(bool b) { m_in_scope_only = b; }
59 
61  return m_include_runtime_support_values;
62  }
63 
65  m_include_runtime_support_values = b;
66  }
67 
68  lldb::DynamicValueType GetUseDynamic() const { return m_use_dynamic; }
69 
70  void SetUseDynamic(lldb::DynamicValueType d) { m_use_dynamic = d; }
71 
72 private:
74  bool m_include_locals : 1;
76  bool m_in_scope_only : 1;
78  LazyBool m_include_recognized_arguments; // can be overridden with a setting
80 };
81 
83  : m_opaque_up(new VariablesOptionsImpl()) {
85 }
86 
88  : m_opaque_up(new VariablesOptionsImpl(options.ref())) {
90  (const lldb::SBVariablesOptions &), options);
91 }
92 
94 operator=(const SBVariablesOptions &options) {
97  SBVariablesOptions, operator=,(const lldb::SBVariablesOptions &),
98  options);
99 
100  m_opaque_up = std::make_unique<VariablesOptionsImpl>(options.ref());
101  return LLDB_RECORD_RESULT(*this);
102 }
103 
105 
108  return this->operator bool();
109 }
110 SBVariablesOptions::operator bool() const {
112 
113  return m_opaque_up != nullptr;
114 }
115 
119 
120  return m_opaque_up->GetIncludeArguments();
121 }
122 
125  arguments);
126 
127  m_opaque_up->SetIncludeArguments(arguments);
128 }
129 
131  const lldb::SBTarget &target) const {
134  (const lldb::SBTarget &), target);
135 
136  return m_opaque_up->GetIncludeRecognizedArguments(target.GetSP());
137 }
138 
141  (bool), arguments);
142 
143  m_opaque_up->SetIncludeRecognizedArguments(arguments);
144 }
145 
148 
149  return m_opaque_up->GetIncludeLocals();
150 }
151 
154  locals);
155 
156  m_opaque_up->SetIncludeLocals(locals);
157 }
158 
161 
162  return m_opaque_up->GetIncludeStatics();
163 }
164 
167  statics);
168 
169  m_opaque_up->SetIncludeStatics(statics);
170 }
171 
174 
175  return m_opaque_up->GetInScopeOnly();
176 }
177 
178 void SBVariablesOptions::SetInScopeOnly(bool in_scope_only) {
180  in_scope_only);
181 
182  m_opaque_up->SetInScopeOnly(in_scope_only);
183 }
184 
188 
189  return m_opaque_up->GetIncludeRuntimeSupportValues();
190 }
191 
193  bool runtime_support_values) {
195  (bool), runtime_support_values);
196 
197  m_opaque_up->SetIncludeRuntimeSupportValues(runtime_support_values);
198 }
199 
202  GetUseDynamic);
203 
204  return m_opaque_up->GetUseDynamic();
205 }
206 
209  (lldb::DynamicValueType), dynamic);
210 
211  m_opaque_up->SetUseDynamic(dynamic);
212 }
213 
215  return m_opaque_up.operator->();
216 }
217 
219  return m_opaque_up.operator->();
220 }
221 
223 
225 
227  return *m_opaque_up;
228 }
229 
231  : m_opaque_up(std::move(lldb_object_ptr)) {}
232 
234  m_opaque_up.reset(std::move(lldb_object_ptr));
235 }
236 
237 namespace lldb_private {
238 namespace repro {
239 
240 template <>
244  (const lldb::SBVariablesOptions &));
247  SBVariablesOptions, operator=,(const lldb::SBVariablesOptions &));
249  LLDB_REGISTER_METHOD_CONST(bool, SBVariablesOptions, operator bool, ());
251  ());
255  (const lldb::SBTarget &));
269  GetUseDynamic, ());
272 }
273 
274 }
275 }
The registry contains a unique mapping between functions and their ID.
VariablesOptionsImpl * get()
A class that represents a running process on the host machine.
#define LLDB_RECORD_CONSTRUCTOR_NO_ARGS(Class)
void SetIncludeArguments(bool b)
void SetUseDynamic(lldb::DynamicValueType d)
bool GetIncludeRecognizedArguments(const lldb::SBTarget &) const
bool GetIncludeRecognizedArguments(const lldb::TargetSP &target_sp) const
lldb::DynamicValueType GetUseDynamic() const
void SetUseDynamic(lldb::DynamicValueType)
#define LLDB_REGISTER_CONSTRUCTOR(Class, Signature)
lldb::TargetSP GetSP() const
Definition: SBTarget.cpp:608
void RegisterMethods< SBVariablesOptions >(Registry &R)
void SetIncludeRecognizedArguments(bool b)
#define LLDB_RECORD_CONSTRUCTOR(Class, Signature,...)
#define LLDB_RECORD_METHOD(Result, Class, Method, Signature,...)
bool GetIncludeArguments() const
VariablesOptionsImpl * operator->()
#define LLDB_RECORD_METHOD_CONST(Result, Class, Method, Signature,...)
bool GetIncludeRuntimeSupportValues() const
VariablesOptionsImpl & ref()
SBVariablesOptions & operator=(const SBVariablesOptions &options)
lldb::DynamicValueType GetUseDynamic() const
void SetOptions(VariablesOptionsImpl *lldb_object_ptr)
std::unique_ptr< VariablesOptionsImpl > m_opaque_up
Definition: SBAddress.h:15
bool GetIncludeRuntimeSupportValues() const
#define LLDB_REGISTER_METHOD(Result, Class, Method, Signature)
#define LLDB_RECORD_METHOD_CONST_NO_ARGS(Result, Class, Method)
void SetIncludeRuntimeSupportValues(bool b)
lldb::DynamicValueType m_use_dynamic
#define LLDB_RECORD_RESULT(Result)
#define LLDB_REGISTER_METHOD_CONST(Result, Class, Method, Signature)