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 "Utils.h"
11 #include "lldb/API/SBStream.h"
12 #include "lldb/Target/Target.h"
14 
15 using namespace lldb;
16 using namespace lldb_private;
17 
19  : m_opaque_up(new EvaluateExpressionOptions()) {
20  LLDB_INSTRUMENT_VA(this);
21 }
22 
24  LLDB_INSTRUMENT_VA(this, rhs);
25 
27 }
28 
31  LLDB_INSTRUMENT_VA(this, rhs);
32 
33  if (this != &rhs)
35  return *this;
36 }
37 
39 
41  LLDB_INSTRUMENT_VA(this);
42 
43  return m_opaque_up->DoesCoerceToId();
44 }
45 
47  LLDB_INSTRUMENT_VA(this, coerce);
48 
49  m_opaque_up->SetCoerceToId(coerce);
50 }
51 
53  LLDB_INSTRUMENT_VA(this);
54 
55  return m_opaque_up->DoesUnwindOnError();
56 }
57 
59  LLDB_INSTRUMENT_VA(this, unwind);
60 
61  m_opaque_up->SetUnwindOnError(unwind);
62 }
63 
65  LLDB_INSTRUMENT_VA(this);
66 
67  return m_opaque_up->DoesIgnoreBreakpoints();
68 }
69 
71  LLDB_INSTRUMENT_VA(this, ignore);
72 
73  m_opaque_up->SetIgnoreBreakpoints(ignore);
74 }
75 
77  LLDB_INSTRUMENT_VA(this);
78 
79  return m_opaque_up->GetUseDynamic();
80 }
81 
83  LLDB_INSTRUMENT_VA(this, dynamic);
84 
85  m_opaque_up->SetUseDynamic(dynamic);
86 }
87 
89  LLDB_INSTRUMENT_VA(this);
90 
91  return m_opaque_up->GetTimeout() ? m_opaque_up->GetTimeout()->count() : 0;
92 }
93 
95  LLDB_INSTRUMENT_VA(this, timeout);
96 
97  m_opaque_up->SetTimeout(timeout == 0 ? Timeout<std::micro>(llvm::None)
98  : std::chrono::microseconds(timeout));
99 }
100 
102  LLDB_INSTRUMENT_VA(this);
103 
104  return m_opaque_up->GetOneThreadTimeout()
105  ? m_opaque_up->GetOneThreadTimeout()->count()
106  : 0;
107 }
108 
110  LLDB_INSTRUMENT_VA(this, timeout);
111 
112  m_opaque_up->SetOneThreadTimeout(timeout == 0
113  ? Timeout<std::micro>(llvm::None)
114  : std::chrono::microseconds(timeout));
115 }
116 
118  LLDB_INSTRUMENT_VA(this);
119 
120  return m_opaque_up->GetTryAllThreads();
121 }
122 
124  LLDB_INSTRUMENT_VA(this, run_others);
125 
126  m_opaque_up->SetTryAllThreads(run_others);
127 }
128 
130  LLDB_INSTRUMENT_VA(this);
131 
132  return m_opaque_up->GetStopOthers();
133 }
134 
135 void SBExpressionOptions::SetStopOthers(bool run_others) {
136  LLDB_INSTRUMENT_VA(this, run_others);
137 
138  m_opaque_up->SetStopOthers(run_others);
139 }
140 
142  LLDB_INSTRUMENT_VA(this);
143 
144  return m_opaque_up->GetTrapExceptions();
145 }
146 
147 void SBExpressionOptions::SetTrapExceptions(bool trap_exceptions) {
148  LLDB_INSTRUMENT_VA(this, trap_exceptions);
149 
150  m_opaque_up->SetTrapExceptions(trap_exceptions);
151 }
152 
154  LLDB_INSTRUMENT_VA(this, language);
155 
156  m_opaque_up->SetLanguage(language);
157 }
158 
160  lldb::ExpressionCancelCallback callback, void *baton) {
161  LLDB_INSTRUMENT_VA(this, callback, baton);
162 
163  m_opaque_up->SetCancelCallback(callback, baton);
164 }
165 
167  LLDB_INSTRUMENT_VA(this);
168 
169  return m_opaque_up->GetGenerateDebugInfo();
170 }
171 
173  LLDB_INSTRUMENT_VA(this, b);
174 
175  return m_opaque_up->SetGenerateDebugInfo(b);
176 }
177 
179  LLDB_INSTRUMENT_VA(this);
180 
181  return m_opaque_up->GetResultIsInternal();
182 }
183 
185  LLDB_INSTRUMENT_VA(this, b);
186 
187  return m_opaque_up->SetResultIsInternal(b);
188 }
189 
190 const char *SBExpressionOptions::GetPrefix() const {
191  LLDB_INSTRUMENT_VA(this);
192 
193  return m_opaque_up->GetPrefix();
194 }
195 
196 void SBExpressionOptions::SetPrefix(const char *prefix) {
197  LLDB_INSTRUMENT_VA(this, prefix);
198 
199  return m_opaque_up->SetPrefix(prefix);
200 }
201 
203  LLDB_INSTRUMENT_VA(this);
204 
205  return m_opaque_up->GetAutoApplyFixIts();
206 }
207 
209  LLDB_INSTRUMENT_VA(this, b);
210 
211  return m_opaque_up->SetAutoApplyFixIts(b);
212 }
213 
215  LLDB_INSTRUMENT_VA(this);
216 
217  return m_opaque_up->GetRetriesWithFixIts();
218 }
219 
221  LLDB_INSTRUMENT_VA(this, retries);
222 
223  return m_opaque_up->SetRetriesWithFixIts(retries);
224 }
225 
227  LLDB_INSTRUMENT_VA(this);
228 
229  return m_opaque_up->GetExecutionPolicy() == eExecutionPolicyTopLevel;
230 }
231 
233  LLDB_INSTRUMENT_VA(this, b);
234 
235  m_opaque_up->SetExecutionPolicy(b ? eExecutionPolicyTopLevel
236  : m_opaque_up->default_execution_policy);
237 }
238 
240  LLDB_INSTRUMENT_VA(this);
241 
242  return m_opaque_up->GetExecutionPolicy() != eExecutionPolicyNever;
243 }
244 
246  LLDB_INSTRUMENT_VA(this, allow);
247 
248  m_opaque_up->SetExecutionPolicy(allow ? m_opaque_up->default_execution_policy
250 }
251 
253  return m_opaque_up.get();
254 }
255 
257  return *(m_opaque_up.get());
258 }
Instrumentation.h
lldb::SBExpressionOptions::get
lldb_private::EvaluateExpressionOptions * get() const
Definition: SBExpressionOptions.cpp:252
lldb::SBExpressionOptions::GetIgnoreBreakpoints
bool GetIgnoreBreakpoints() const
Definition: SBExpressionOptions.cpp:64
lldb::SBExpressionOptions::SetRetriesWithFixIts
void SetRetriesWithFixIts(uint64_t retries)
Definition: SBExpressionOptions.cpp:220
lldb::SBExpressionOptions::GetTimeoutInMicroSeconds
uint32_t GetTimeoutInMicroSeconds() const
Definition: SBExpressionOptions.cpp:88
lldb::SBExpressionOptions::GetFetchDynamicValue
lldb::DynamicValueType GetFetchDynamicValue() const
Definition: SBExpressionOptions.cpp:76
lldb::ExpressionCancelCallback
bool(* ExpressionCancelCallback)(ExpressionEvaluationPhase phase, void *baton)
Definition: lldb-types.h:74
lldb::SBExpressionOptions::SetGenerateDebugInfo
void SetGenerateDebugInfo(bool b=true)
Definition: SBExpressionOptions.cpp:172
lldb::SBExpressionOptions::SetTopLevel
void SetTopLevel(bool b=true)
Definition: SBExpressionOptions.cpp:232
lldb_private::eExecutionPolicyNever
@ eExecutionPolicyNever
Definition: lldb-private-enumerations.h:146
lldb_private::EvaluateExpressionOptions
Definition: Target.h:281
lldb::LanguageType
LanguageType
Programming language type.
Definition: lldb-enumerations.h:436
lldb::SBExpressionOptions::SetUnwindOnError
void SetUnwindOnError(bool unwind=true)
Definition: SBExpressionOptions.cpp:58
lldb::SBExpressionOptions::GetOneThreadTimeoutInMicroSeconds
uint32_t GetOneThreadTimeoutInMicroSeconds() const
Definition: SBExpressionOptions.cpp:101
lldb::SBExpressionOptions::SetAllowJIT
void SetAllowJIT(bool allow)
Definition: SBExpressionOptions.cpp:245
lldb::SBExpressionOptions::SetStopOthers
void SetStopOthers(bool stop_others=true)
Definition: SBExpressionOptions.cpp:135
lldb::SBExpressionOptions::ref
lldb_private::EvaluateExpressionOptions & ref() const
Definition: SBExpressionOptions.cpp:256
lldb::SBExpressionOptions::SBExpressionOptions
SBExpressionOptions()
Definition: SBExpressionOptions.cpp:18
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:40
SBStream.h
lldb::SBExpressionOptions::SetTimeoutInMicroSeconds
void SetTimeoutInMicroSeconds(uint32_t timeout=0)
Definition: SBExpressionOptions.cpp:94
lldb::SBExpressionOptions::SetOneThreadTimeoutInMicroSeconds
void SetOneThreadTimeoutInMicroSeconds(uint32_t timeout=0)
Definition: SBExpressionOptions.cpp:109
lldb::SBExpressionOptions::GetStopOthers
bool GetStopOthers() const
Definition: SBExpressionOptions.cpp:129
lldb::SBExpressionOptions::SetTrapExceptions
void SetTrapExceptions(bool trap_exceptions=true)
Definition: SBExpressionOptions.cpp:147
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:117
lldb::SBExpressionOptions::operator=
const SBExpressionOptions & operator=(const lldb::SBExpressionOptions &rhs)
Definition: SBExpressionOptions.cpp:30
lldb::DynamicValueType
DynamicValueType
Definition: lldb-enumerations.h:494
lldb::SBExpressionOptions::SetPrefix
void SetPrefix(const char *prefix)
Definition: SBExpressionOptions.cpp:196
lldb::SBExpressionOptions::GetRetriesWithFixIts
uint64_t GetRetriesWithFixIts()
Definition: SBExpressionOptions.cpp:214
lldb::SBExpressionOptions::SetLanguage
void SetLanguage(lldb::LanguageType language)
Definition: SBExpressionOptions.cpp:153
lldb::SBExpressionOptions::SetCoerceResultToId
void SetCoerceResultToId(bool coerce=true)
Definition: SBExpressionOptions.cpp:46
lldb::SBExpressionOptions::SetSuppressPersistentResult
void SetSuppressPersistentResult(bool b=false)
Definition: SBExpressionOptions.cpp:184
lldb::SBExpressionOptions::SetAutoApplyFixIts
void SetAutoApplyFixIts(bool b=true)
Definition: SBExpressionOptions.cpp:208
lldb::SBExpressionOptions::SetFetchDynamicValue
void SetFetchDynamicValue(lldb::DynamicValueType dynamic=lldb::eDynamicCanRunTarget)
Definition: SBExpressionOptions.cpp:82
lldb::SBExpressionOptions::GetGenerateDebugInfo
bool GetGenerateDebugInfo()
Definition: SBExpressionOptions.cpp:166
lldb::SBExpressionOptions
Definition: SBExpressionOptions.h:18
lldb_private::Timeout< std::micro >
uint32_t
lldb::SBExpressionOptions::GetAutoApplyFixIts
bool GetAutoApplyFixIts()
Definition: SBExpressionOptions.cpp:202
lldb::SBExpressionOptions::GetUnwindOnError
bool GetUnwindOnError() const
Definition: SBExpressionOptions.cpp:52
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:159
LLDB_INSTRUMENT_VA
#define LLDB_INSTRUMENT_VA(...)
Definition: Instrumentation.h:98
lldb::SBExpressionOptions::GetAllowJIT
bool GetAllowJIT()
Definition: SBExpressionOptions.cpp:239
lldb::SBExpressionOptions::GetPrefix
const char * GetPrefix() const
Definition: SBExpressionOptions.cpp:190
lldb::SBExpressionOptions::GetTopLevel
bool GetTopLevel()
Definition: SBExpressionOptions.cpp:226
lldb::SBExpressionOptions::SetTryAllThreads
void SetTryAllThreads(bool run_others=true)
Definition: SBExpressionOptions.cpp:123
lldb::SBExpressionOptions::GetTrapExceptions
bool GetTrapExceptions() const
Definition: SBExpressionOptions.cpp:141
lldb
Definition: SBAddress.h:15
lldb::SBExpressionOptions::GetSuppressPersistentResult
bool GetSuppressPersistentResult()
Definition: SBExpressionOptions.cpp:178
lldb::SBExpressionOptions::SetIgnoreBreakpoints
void SetIgnoreBreakpoints(bool ignore=true)
Definition: SBExpressionOptions.cpp:70