LLDB  mainline
SBExpressionOptions.cpp
Go to the documentation of this file.
1 //===-- SBExpressionOptions.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 "Utils.h"
12 #include "lldb/API/SBStream.h"
13 #include "lldb/Target/Target.h"
14 
15 using namespace lldb;
16 using namespace lldb_private;
17 
19  : m_opaque_up(new EvaluateExpressionOptions()) {
21 }
22 
24  : m_opaque_up() {
26  (const lldb::SBExpressionOptions &), rhs);
27 
29 }
30 
35  SBExpressionOptions, operator=,(const lldb::SBExpressionOptions &), rhs);
36 
37  if (this != &rhs)
39  return LLDB_RECORD_RESULT(*this);
40 }
41 
43 
47 
48  return m_opaque_up->DoesCoerceToId();
49 }
50 
53  coerce);
54 
55  m_opaque_up->SetCoerceToId(coerce);
56 }
57 
60 
61  return m_opaque_up->DoesUnwindOnError();
62 }
63 
66  unwind);
67 
68  m_opaque_up->SetUnwindOnError(unwind);
69 }
70 
74 
75  return m_opaque_up->DoesIgnoreBreakpoints();
76 }
77 
80  ignore);
81 
82  m_opaque_up->SetIgnoreBreakpoints(ignore);
83 }
84 
88 
89  return m_opaque_up->GetUseDynamic();
90 }
91 
94  (lldb::DynamicValueType), dynamic);
95 
96  m_opaque_up->SetUseDynamic(dynamic);
97 }
98 
102 
103  return m_opaque_up->GetTimeout() ? m_opaque_up->GetTimeout()->count() : 0;
104 }
105 
108  (uint32_t), timeout);
109 
110  m_opaque_up->SetTimeout(timeout == 0 ? Timeout<std::micro>(llvm::None)
111  : std::chrono::microseconds(timeout));
112 }
113 
117 
118  return m_opaque_up->GetOneThreadTimeout()
119  ? m_opaque_up->GetOneThreadTimeout()->count()
120  : 0;
121 }
122 
126 
127  m_opaque_up->SetOneThreadTimeout(timeout == 0
128  ? Timeout<std::micro>(llvm::None)
129  : std::chrono::microseconds(timeout));
130 }
131 
134 
135  return m_opaque_up->GetTryAllThreads();
136 }
137 
140  run_others);
141 
142  m_opaque_up->SetTryAllThreads(run_others);
143 }
144 
147 
148  return m_opaque_up->GetStopOthers();
149 }
150 
151 void SBExpressionOptions::SetStopOthers(bool run_others) {
153  run_others);
154 
155  m_opaque_up->SetStopOthers(run_others);
156 }
157 
161 
162  return m_opaque_up->GetTrapExceptions();
163 }
164 
165 void SBExpressionOptions::SetTrapExceptions(bool trap_exceptions) {
167  trap_exceptions);
168 
169  m_opaque_up->SetTrapExceptions(trap_exceptions);
170 }
171 
174  (lldb::LanguageType), language);
175 
176  m_opaque_up->SetLanguage(language);
177 }
178 
180  lldb::ExpressionCancelCallback callback, void *baton) {
182  (lldb::ExpressionCancelCallback, void *), callback, baton);
183 
184  m_opaque_up->SetCancelCallback(callback, baton);
185 }
186 
189 
190  return m_opaque_up->GetGenerateDebugInfo();
191 }
192 
195  b);
196 
197  return m_opaque_up->SetGenerateDebugInfo(b);
198 }
199 
203 
204  return m_opaque_up->GetResultIsInternal();
205 }
206 
209  (bool), b);
210 
211  return m_opaque_up->SetResultIsInternal(b);
212 }
213 
214 const char *SBExpressionOptions::GetPrefix() const {
216  GetPrefix);
217 
218  return m_opaque_up->GetPrefix();
219 }
220 
221 void SBExpressionOptions::SetPrefix(const char *prefix) {
222  LLDB_RECORD_METHOD(void, SBExpressionOptions, SetPrefix, (const char *),
223  prefix);
224 
225  return m_opaque_up->SetPrefix(prefix);
226 }
227 
230 
231  return m_opaque_up->GetAutoApplyFixIts();
232 }
233 
236 
237  return m_opaque_up->SetAutoApplyFixIts(b);
238 }
239 
243 
244  return m_opaque_up->GetRetriesWithFixIts();
245 }
246 
249  (uint64_t), retries);
250 
251  return m_opaque_up->SetRetriesWithFixIts(retries);
252 }
253 
256 
257  return m_opaque_up->GetExecutionPolicy() == eExecutionPolicyTopLevel;
258 }
259 
262 
263  m_opaque_up->SetExecutionPolicy(b ? eExecutionPolicyTopLevel
264  : m_opaque_up->default_execution_policy);
265 }
266 
269 
270  return m_opaque_up->GetExecutionPolicy() != eExecutionPolicyNever;
271 }
272 
274  LLDB_RECORD_METHOD(void, SBExpressionOptions, SetAllowJIT, (bool), allow);
275 
276  m_opaque_up->SetExecutionPolicy(allow ? m_opaque_up->default_execution_policy
278 }
279 
281  return m_opaque_up.get();
282 }
283 
285  return *(m_opaque_up.get());
286 }
287 
288 namespace lldb_private {
289 namespace repro {
290 
291 template <>
295  (const lldb::SBExpressionOptions &));
298  SBExpressionOptions, operator=,(const lldb::SBExpressionOptions &));
299  LLDB_REGISTER_METHOD_CONST(bool, SBExpressionOptions, GetCoerceResultToId,
300  ());
301  LLDB_REGISTER_METHOD(void, SBExpressionOptions, SetCoerceResultToId,
302  (bool));
303  LLDB_REGISTER_METHOD_CONST(bool, SBExpressionOptions, GetUnwindOnError, ());
304  LLDB_REGISTER_METHOD(void, SBExpressionOptions, SetUnwindOnError, (bool));
305  LLDB_REGISTER_METHOD_CONST(bool, SBExpressionOptions, GetIgnoreBreakpoints,
306  ());
307  LLDB_REGISTER_METHOD(void, SBExpressionOptions, SetIgnoreBreakpoints,
308  (bool));
310  GetFetchDynamicValue, ());
311  LLDB_REGISTER_METHOD(void, SBExpressionOptions, SetFetchDynamicValue,
314  GetTimeoutInMicroSeconds, ());
315  LLDB_REGISTER_METHOD(void, SBExpressionOptions, SetTimeoutInMicroSeconds,
316  (uint32_t));
318  GetOneThreadTimeoutInMicroSeconds, ());
320  SetOneThreadTimeoutInMicroSeconds, (uint32_t));
321  LLDB_REGISTER_METHOD_CONST(bool, SBExpressionOptions, GetTryAllThreads, ());
322  LLDB_REGISTER_METHOD(void, SBExpressionOptions, SetTryAllThreads, (bool));
323  LLDB_REGISTER_METHOD_CONST(bool, SBExpressionOptions, GetStopOthers, ());
324  LLDB_REGISTER_METHOD(void, SBExpressionOptions, SetStopOthers, (bool));
325  LLDB_REGISTER_METHOD_CONST(bool, SBExpressionOptions, GetTrapExceptions,
326  ());
327  LLDB_REGISTER_METHOD(void, SBExpressionOptions, SetTrapExceptions, (bool));
328  LLDB_REGISTER_METHOD(void, SBExpressionOptions, SetLanguage,
330  LLDB_REGISTER_METHOD(bool, SBExpressionOptions, GetGenerateDebugInfo, ());
331  LLDB_REGISTER_METHOD(void, SBExpressionOptions, SetGenerateDebugInfo,
332  (bool));
333  LLDB_REGISTER_METHOD(bool, SBExpressionOptions, GetSuppressPersistentResult,
334  ());
335  LLDB_REGISTER_METHOD(void, SBExpressionOptions, SetSuppressPersistentResult,
336  (bool));
337  LLDB_REGISTER_METHOD_CONST(const char *, SBExpressionOptions, GetPrefix,
338  ());
339  LLDB_REGISTER_METHOD(void, SBExpressionOptions, SetPrefix, (const char *));
340  LLDB_REGISTER_METHOD(bool, SBExpressionOptions, GetAutoApplyFixIts, ());
341  LLDB_REGISTER_METHOD(void, SBExpressionOptions, SetAutoApplyFixIts, (bool));
342  LLDB_REGISTER_METHOD(bool, SBExpressionOptions, GetTopLevel, ());
343  LLDB_REGISTER_METHOD(void, SBExpressionOptions, SetTopLevel, (bool));
344  LLDB_REGISTER_METHOD(bool, SBExpressionOptions, GetAllowJIT, ());
345  LLDB_REGISTER_METHOD(void, SBExpressionOptions, SetAllowJIT, (bool));
346  LLDB_REGISTER_METHOD(uint64_t, SBExpressionOptions, GetRetriesWithFixIts, ());
347  LLDB_REGISTER_METHOD(void, SBExpressionOptions, SetRetriesWithFixIts,
348  (uint64_t));
349 }
350 
351 }
352 }
lldb::SBExpressionOptions::get
lldb_private::EvaluateExpressionOptions * get() const
Definition: SBExpressionOptions.cpp:280
lldb::SBExpressionOptions::GetIgnoreBreakpoints
bool GetIgnoreBreakpoints() const
Definition: SBExpressionOptions.cpp:71
lldb::SBExpressionOptions::SetRetriesWithFixIts
void SetRetriesWithFixIts(uint64_t retries)
Definition: SBExpressionOptions.cpp:247
lldb::SBExpressionOptions::GetTimeoutInMicroSeconds
uint32_t GetTimeoutInMicroSeconds() const
Definition: SBExpressionOptions.cpp:99
LLDB_RECORD_RESULT
#define LLDB_RECORD_RESULT(Result)
Definition: ReproducerInstrumentation.h:211
lldb_private::repro::RegisterMethods< SBExpressionOptions >
void RegisterMethods< SBExpressionOptions >(Registry &R)
Definition: SBExpressionOptions.cpp:292
lldb::SBExpressionOptions::GetFetchDynamicValue
lldb::DynamicValueType GetFetchDynamicValue() const
Definition: SBExpressionOptions.cpp:85
LLDB_RECORD_METHOD_CONST_NO_ARGS
#define LLDB_RECORD_METHOD_CONST_NO_ARGS(Result, Class, Method)
Definition: ReproducerInstrumentation.h:168
lldb::ExpressionCancelCallback
bool(* ExpressionCancelCallback)(ExpressionEvaluationPhase phase, void *baton)
Definition: lldb-types.h:74
lldb::SBExpressionOptions::SetGenerateDebugInfo
void SetGenerateDebugInfo(bool b=true)
Definition: SBExpressionOptions.cpp:193
lldb::SBExpressionOptions::SetTopLevel
void SetTopLevel(bool b=true)
Definition: SBExpressionOptions.cpp:260
LLDB_RECORD_METHOD_NO_ARGS
#define LLDB_RECORD_METHOD_NO_ARGS(Result, Class, Method)
Definition: ReproducerInstrumentation.h:165
lldb_private::eExecutionPolicyNever
@ eExecutionPolicyNever
Definition: lldb-private-enumerations.h:146
lldb_private::EvaluateExpressionOptions
Definition: Target.h:262
lldb::LanguageType
LanguageType
Programming language type.
Definition: lldb-enumerations.h:436
LLDB_RECORD_CONSTRUCTOR_NO_ARGS
#define LLDB_RECORD_CONSTRUCTOR_NO_ARGS(Class)
Definition: ReproducerInstrumentation.h:136
lldb::SBExpressionOptions::SetUnwindOnError
void SetUnwindOnError(bool unwind=true)
Definition: SBExpressionOptions.cpp:64
lldb::SBExpressionOptions::GetOneThreadTimeoutInMicroSeconds
uint32_t GetOneThreadTimeoutInMicroSeconds() const
Definition: SBExpressionOptions.cpp:114
LLDB_REGISTER_METHOD_CONST
#define LLDB_REGISTER_METHOD_CONST(Result, Class, Method, Signature)
Definition: ReproducerInstrumentation.h:98
lldb::SBExpressionOptions::SetAllowJIT
void SetAllowJIT(bool allow)
Definition: SBExpressionOptions.cpp:273
lldb::SBExpressionOptions::SetStopOthers
void SetStopOthers(bool stop_others=true)
Definition: SBExpressionOptions.cpp:151
SBReproducerPrivate.h
lldb::SBExpressionOptions::ref
lldb_private::EvaluateExpressionOptions & ref() const
Definition: SBExpressionOptions.cpp:284
lldb::SBExpressionOptions::SBExpressionOptions
SBExpressionOptions()
Definition: SBExpressionOptions.cpp:18
LLDB_REGISTER_CONSTRUCTOR
#define LLDB_REGISTER_CONSTRUCTOR(Class, Signature)
Definition: ReproducerInstrumentation.h:89
lldb_private::eExecutionPolicyTopLevel
@ eExecutionPolicyTopLevel
Definition: lldb-private-enumerations.h:148
SBExpressionOptions.h
lldb::SBExpressionOptions::m_opaque_up
std::unique_ptr< lldb_private::EvaluateExpressionOptions > m_opaque_up
Definition: SBExpressionOptions.h:114
Target.h
lldb::SBExpressionOptions::GetCoerceResultToId
bool GetCoerceResultToId() const
Definition: SBExpressionOptions.cpp:44
SBStream.h
lldb::SBExpressionOptions::SetTimeoutInMicroSeconds
void SetTimeoutInMicroSeconds(uint32_t timeout=0)
Definition: SBExpressionOptions.cpp:106
lldb::SBExpressionOptions::SetOneThreadTimeoutInMicroSeconds
void SetOneThreadTimeoutInMicroSeconds(uint32_t timeout=0)
Definition: SBExpressionOptions.cpp:123
LLDB_RECORD_METHOD
#define LLDB_RECORD_METHOD(Result, Class, Method, Signature,...)
Definition: ReproducerInstrumentation.h:158
lldb::SBExpressionOptions::GetStopOthers
bool GetStopOthers() const
Definition: SBExpressionOptions.cpp:145
lldb::SBExpressionOptions::SetTrapExceptions
void SetTrapExceptions(bool trap_exceptions=true)
Definition: SBExpressionOptions.cpp:165
lldb_private::clone
std::unique_ptr< T > clone(const std::unique_ptr< T > &src)
Definition: Utils.h:17
Utils.h
lldb::SBExpressionOptions::GetTryAllThreads
bool GetTryAllThreads() const
Definition: SBExpressionOptions.cpp:132
lldb::SBExpressionOptions::operator=
const SBExpressionOptions & operator=(const lldb::SBExpressionOptions &rhs)
Definition: SBExpressionOptions.cpp:32
lldb::DynamicValueType
DynamicValueType
Definition: lldb-enumerations.h:494
lldb::SBExpressionOptions::SetPrefix
void SetPrefix(const char *prefix)
Definition: SBExpressionOptions.cpp:221
lldb::SBExpressionOptions::GetRetriesWithFixIts
uint64_t GetRetriesWithFixIts()
Definition: SBExpressionOptions.cpp:240
lldb::SBExpressionOptions::SetLanguage
void SetLanguage(lldb::LanguageType language)
Definition: SBExpressionOptions.cpp:172
lldb::SBExpressionOptions::SetCoerceResultToId
void SetCoerceResultToId(bool coerce=true)
Definition: SBExpressionOptions.cpp:51
lldb::SBExpressionOptions::SetSuppressPersistentResult
void SetSuppressPersistentResult(bool b=false)
Definition: SBExpressionOptions.cpp:207
lldb::SBExpressionOptions::SetAutoApplyFixIts
void SetAutoApplyFixIts(bool b=true)
Definition: SBExpressionOptions.cpp:234
lldb::SBExpressionOptions::SetFetchDynamicValue
void SetFetchDynamicValue(lldb::DynamicValueType dynamic=lldb::eDynamicCanRunTarget)
Definition: SBExpressionOptions.cpp:92
lldb::SBExpressionOptions::GetGenerateDebugInfo
bool GetGenerateDebugInfo()
Definition: SBExpressionOptions.cpp:187
LLDB_RECORD_CONSTRUCTOR
#define LLDB_RECORD_CONSTRUCTOR(Class, Signature,...)
Definition: ReproducerInstrumentation.h:133
lldb_private::repro::Registry
The registry contains a unique mapping between functions and their ID.
Definition: ReproducerInstrumentation.h:517
lldb::SBExpressionOptions
Definition: SBExpressionOptions.h:18
lldb_private::Timeout< std::micro >
uint32_t
lldb::SBExpressionOptions::GetAutoApplyFixIts
bool GetAutoApplyFixIts()
Definition: SBExpressionOptions.cpp:228
lldb::SBExpressionOptions::GetUnwindOnError
bool GetUnwindOnError() const
Definition: SBExpressionOptions.cpp:58
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb::SBExpressionOptions::~SBExpressionOptions
~SBExpressionOptions()
lldb::SBExpressionOptions::SetCancelCallback
void SetCancelCallback(lldb::ExpressionCancelCallback callback, void *baton)
Definition: SBExpressionOptions.cpp:179
lldb::SBExpressionOptions::GetAllowJIT
bool GetAllowJIT()
Definition: SBExpressionOptions.cpp:267
lldb::SBExpressionOptions::GetPrefix
const char * GetPrefix() const
Definition: SBExpressionOptions.cpp:214
lldb::SBExpressionOptions::GetTopLevel
bool GetTopLevel()
Definition: SBExpressionOptions.cpp:254
LLDB_RECORD_DUMMY
#define LLDB_RECORD_DUMMY(Result, Class, Method, Signature,...)
The LLDB_RECORD_DUMMY macro is special because it doesn't actually record anything.
Definition: ReproducerInstrumentation.h:216
lldb::SBExpressionOptions::SetTryAllThreads
void SetTryAllThreads(bool run_others=true)
Definition: SBExpressionOptions.cpp:138
lldb::SBExpressionOptions::GetTrapExceptions
bool GetTrapExceptions() const
Definition: SBExpressionOptions.cpp:158
lldb
Definition: SBAddress.h:15
lldb::SBExpressionOptions::GetSuppressPersistentResult
bool GetSuppressPersistentResult()
Definition: SBExpressionOptions.cpp:200
lldb::SBExpressionOptions::SetIgnoreBreakpoints
void SetIgnoreBreakpoints(bool ignore=true)
Definition: SBExpressionOptions.cpp:78
LLDB_REGISTER_METHOD
#define LLDB_REGISTER_METHOD(Result, Class, Method, Signature)
Definition: ReproducerInstrumentation.h:93