1 //===-- SBExpressionOptions.cpp ---------------------------------------------*-
2 //C++ -*-===//
3 //
4 //                     The LLVM Compiler Infrastructure
5 //
6 // This file is distributed under the University of Illinois Open Source
7 // License. See LICENSE.TXT for details.
8 //
9 //===----------------------------------------------------------------------===//
10 
11 #include "lldb/API/SBExpressionOptions.h"
12 #include "lldb/API/SBStream.h"
13 
14 #include "lldb/Target/Target.h"
15 
16 using namespace lldb;
17 using namespace lldb_private;
18 
19 SBExpressionOptions::SBExpressionOptions()
20     : m_opaque_ap(new EvaluateExpressionOptions()) {}
21 
22 SBExpressionOptions::SBExpressionOptions(const SBExpressionOptions &rhs) {
23   m_opaque_ap.reset(new EvaluateExpressionOptions());
24   *(m_opaque_ap.get()) = rhs.ref();
25 }
26 
27 const SBExpressionOptions &SBExpressionOptions::
28 operator=(const SBExpressionOptions &rhs) {
29   if (this != &rhs) {
30     this->ref() = rhs.ref();
31   }
32   return *this;
33 }
34 
35 SBExpressionOptions::~SBExpressionOptions() {}
36 
37 bool SBExpressionOptions::GetCoerceResultToId() const {
38   return m_opaque_ap->DoesCoerceToId();
39 }
40 
41 void SBExpressionOptions::SetCoerceResultToId(bool coerce) {
42   m_opaque_ap->SetCoerceToId(coerce);
43 }
44 
45 bool SBExpressionOptions::GetUnwindOnError() const {
46   return m_opaque_ap->DoesUnwindOnError();
47 }
48 
49 void SBExpressionOptions::SetUnwindOnError(bool unwind) {
50   m_opaque_ap->SetUnwindOnError(unwind);
51 }
52 
53 bool SBExpressionOptions::GetIgnoreBreakpoints() const {
54   return m_opaque_ap->DoesIgnoreBreakpoints();
55 }
56 
57 void SBExpressionOptions::SetIgnoreBreakpoints(bool ignore) {
58   m_opaque_ap->SetIgnoreBreakpoints(ignore);
59 }
60 
61 lldb::DynamicValueType SBExpressionOptions::GetFetchDynamicValue() const {
62   return m_opaque_ap->GetUseDynamic();
63 }
64 
65 void SBExpressionOptions::SetFetchDynamicValue(lldb::DynamicValueType dynamic) {
66   m_opaque_ap->SetUseDynamic(dynamic);
67 }
68 
69 uint32_t SBExpressionOptions::GetTimeoutInMicroSeconds() const {
70   return m_opaque_ap->GetTimeoutUsec();
71 }
72 
73 void SBExpressionOptions::SetTimeoutInMicroSeconds(uint32_t timeout) {
74   m_opaque_ap->SetTimeoutUsec(timeout);
75 }
76 
77 uint32_t SBExpressionOptions::GetOneThreadTimeoutInMicroSeconds() const {
78   return m_opaque_ap->GetOneThreadTimeoutUsec();
79 }
80 
81 void SBExpressionOptions::SetOneThreadTimeoutInMicroSeconds(uint32_t timeout) {
82   m_opaque_ap->SetOneThreadTimeoutUsec(timeout);
83 }
84 
85 bool SBExpressionOptions::GetTryAllThreads() const {
86   return m_opaque_ap->GetTryAllThreads();
87 }
88 
89 void SBExpressionOptions::SetTryAllThreads(bool run_others) {
90   m_opaque_ap->SetTryAllThreads(run_others);
91 }
92 
93 bool SBExpressionOptions::GetStopOthers() const {
94   return m_opaque_ap->GetStopOthers();
95 }
96 
97 void SBExpressionOptions::SetStopOthers(bool run_others) {
98   m_opaque_ap->SetStopOthers(run_others);
99 }
100 
101 bool SBExpressionOptions::GetTrapExceptions() const {
102   return m_opaque_ap->GetTrapExceptions();
103 }
104 
105 void SBExpressionOptions::SetTrapExceptions(bool trap_exceptions) {
106   m_opaque_ap->SetTrapExceptions(trap_exceptions);
107 }
108 
109 void SBExpressionOptions::SetLanguage(lldb::LanguageType language) {
110   m_opaque_ap->SetLanguage(language);
111 }
112 
113 void SBExpressionOptions::SetCancelCallback(
114     lldb::ExpressionCancelCallback callback, void *baton) {
115   m_opaque_ap->SetCancelCallback(callback, baton);
116 }
117 
118 bool SBExpressionOptions::GetGenerateDebugInfo() {
119   return m_opaque_ap->GetGenerateDebugInfo();
120 }
121 
122 void SBExpressionOptions::SetGenerateDebugInfo(bool b) {
123   return m_opaque_ap->SetGenerateDebugInfo(b);
124 }
125 
126 bool SBExpressionOptions::GetSuppressPersistentResult() {
127   return m_opaque_ap->GetResultIsInternal();
128 }
129 
130 void SBExpressionOptions::SetSuppressPersistentResult(bool b) {
131   return m_opaque_ap->SetResultIsInternal(b);
132 }
133 
134 const char *SBExpressionOptions::GetPrefix() const {
135   return m_opaque_ap->GetPrefix();
136 }
137 
138 void SBExpressionOptions::SetPrefix(const char *prefix) {
139   return m_opaque_ap->SetPrefix(prefix);
140 }
141 
142 bool SBExpressionOptions::GetAutoApplyFixIts() {
143   return m_opaque_ap->GetAutoApplyFixIts();
144 }
145 
146 void SBExpressionOptions::SetAutoApplyFixIts(bool b) {
147   return m_opaque_ap->SetAutoApplyFixIts(b);
148 }
149 
150 bool SBExpressionOptions::GetTopLevel() {
151   return m_opaque_ap->GetExecutionPolicy() == eExecutionPolicyTopLevel;
152 }
153 
154 void SBExpressionOptions::SetTopLevel(bool b) {
155   m_opaque_ap->SetExecutionPolicy(b ? eExecutionPolicyTopLevel
156                                     : m_opaque_ap->default_execution_policy);
157 }
158 
159 EvaluateExpressionOptions *SBExpressionOptions::get() const {
160   return m_opaque_ap.get();
161 }
162 
163 EvaluateExpressionOptions &SBExpressionOptions::ref() const {
164   return *(m_opaque_ap.get());
165 }
166