1 //===-- SBCommandInterpreterRunOptions.cpp --------------------------------===//
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
7 //===----------------------------------------------------------------------===//
9 #include "lldb/lldb-types.h"
11 #include "lldb/Utility/Instrumentation.h"
13 #include "lldb/API/SBCommandInterpreterRunOptions.h"
14 #include "lldb/Interpreter/CommandInterpreter.h"
19 using namespace lldb_private
;
21 SBCommandInterpreterRunOptions::SBCommandInterpreterRunOptions() {
22 LLDB_INSTRUMENT_VA(this);
24 m_opaque_up
= std::make_unique
<CommandInterpreterRunOptions
>();
27 SBCommandInterpreterRunOptions::SBCommandInterpreterRunOptions(
28 const SBCommandInterpreterRunOptions
&rhs
) {
29 LLDB_INSTRUMENT_VA(this, rhs
);
31 m_opaque_up
= std::make_unique
<CommandInterpreterRunOptions
>(rhs
.ref());
34 SBCommandInterpreterRunOptions::~SBCommandInterpreterRunOptions() = default;
36 SBCommandInterpreterRunOptions
&SBCommandInterpreterRunOptions::operator=(
37 const SBCommandInterpreterRunOptions
&rhs
) {
38 LLDB_INSTRUMENT_VA(this, rhs
);
42 *m_opaque_up
= *rhs
.m_opaque_up
;
46 bool SBCommandInterpreterRunOptions::GetStopOnContinue() const {
47 LLDB_INSTRUMENT_VA(this);
49 return m_opaque_up
->GetStopOnContinue();
52 void SBCommandInterpreterRunOptions::SetStopOnContinue(bool stop_on_continue
) {
53 LLDB_INSTRUMENT_VA(this, stop_on_continue
);
55 m_opaque_up
->SetStopOnContinue(stop_on_continue
);
58 bool SBCommandInterpreterRunOptions::GetStopOnError() const {
59 LLDB_INSTRUMENT_VA(this);
61 return m_opaque_up
->GetStopOnError();
64 void SBCommandInterpreterRunOptions::SetStopOnError(bool stop_on_error
) {
65 LLDB_INSTRUMENT_VA(this, stop_on_error
);
67 m_opaque_up
->SetStopOnError(stop_on_error
);
70 bool SBCommandInterpreterRunOptions::GetStopOnCrash() const {
71 LLDB_INSTRUMENT_VA(this);
73 return m_opaque_up
->GetStopOnCrash();
76 void SBCommandInterpreterRunOptions::SetStopOnCrash(bool stop_on_crash
) {
77 LLDB_INSTRUMENT_VA(this, stop_on_crash
);
79 m_opaque_up
->SetStopOnCrash(stop_on_crash
);
82 bool SBCommandInterpreterRunOptions::GetEchoCommands() const {
83 LLDB_INSTRUMENT_VA(this);
85 return m_opaque_up
->GetEchoCommands();
88 void SBCommandInterpreterRunOptions::SetEchoCommands(bool echo_commands
) {
89 LLDB_INSTRUMENT_VA(this, echo_commands
);
91 m_opaque_up
->SetEchoCommands(echo_commands
);
94 bool SBCommandInterpreterRunOptions::GetEchoCommentCommands() const {
95 LLDB_INSTRUMENT_VA(this);
97 return m_opaque_up
->GetEchoCommentCommands();
100 void SBCommandInterpreterRunOptions::SetEchoCommentCommands(bool echo
) {
101 LLDB_INSTRUMENT_VA(this, echo
);
103 m_opaque_up
->SetEchoCommentCommands(echo
);
106 bool SBCommandInterpreterRunOptions::GetPrintResults() const {
107 LLDB_INSTRUMENT_VA(this);
109 return m_opaque_up
->GetPrintResults();
112 void SBCommandInterpreterRunOptions::SetPrintResults(bool print_results
) {
113 LLDB_INSTRUMENT_VA(this, print_results
);
115 m_opaque_up
->SetPrintResults(print_results
);
118 bool SBCommandInterpreterRunOptions::GetPrintErrors() const {
119 LLDB_INSTRUMENT_VA(this);
121 return m_opaque_up
->GetPrintErrors();
124 void SBCommandInterpreterRunOptions::SetPrintErrors(bool print_errors
) {
125 LLDB_INSTRUMENT_VA(this, print_errors
);
127 m_opaque_up
->SetPrintErrors(print_errors
);
130 bool SBCommandInterpreterRunOptions::GetAddToHistory() const {
131 LLDB_INSTRUMENT_VA(this);
133 return m_opaque_up
->GetAddToHistory();
136 void SBCommandInterpreterRunOptions::SetAddToHistory(bool add_to_history
) {
137 LLDB_INSTRUMENT_VA(this, add_to_history
);
139 m_opaque_up
->SetAddToHistory(add_to_history
);
142 bool SBCommandInterpreterRunOptions::GetAutoHandleEvents() const {
143 LLDB_INSTRUMENT_VA(this);
145 return m_opaque_up
->GetAutoHandleEvents();
148 void SBCommandInterpreterRunOptions::SetAutoHandleEvents(
149 bool auto_handle_events
) {
150 LLDB_INSTRUMENT_VA(this, auto_handle_events
);
152 m_opaque_up
->SetAutoHandleEvents(auto_handle_events
);
155 bool SBCommandInterpreterRunOptions::GetSpawnThread() const {
156 LLDB_INSTRUMENT_VA(this);
158 return m_opaque_up
->GetSpawnThread();
161 void SBCommandInterpreterRunOptions::SetSpawnThread(bool spawn_thread
) {
162 LLDB_INSTRUMENT_VA(this, spawn_thread
);
164 m_opaque_up
->SetSpawnThread(spawn_thread
);
167 bool SBCommandInterpreterRunOptions::GetAllowRepeats() const {
168 LLDB_INSTRUMENT_VA(this);
170 return m_opaque_up
->GetAllowRepeats();
173 void SBCommandInterpreterRunOptions::SetAllowRepeats(bool allow_repeats
) {
174 LLDB_INSTRUMENT_VA(this, allow_repeats
);
176 m_opaque_up
->SetAllowRepeats(allow_repeats
);
179 lldb_private::CommandInterpreterRunOptions
*
180 SBCommandInterpreterRunOptions::get() const {
181 return m_opaque_up
.get();
184 lldb_private::CommandInterpreterRunOptions
&
185 SBCommandInterpreterRunOptions::ref() const {
189 SBCommandInterpreterRunResult::SBCommandInterpreterRunResult()
190 : m_opaque_up(new CommandInterpreterRunResult())
193 LLDB_INSTRUMENT_VA(this);
196 SBCommandInterpreterRunResult::SBCommandInterpreterRunResult(
197 const SBCommandInterpreterRunResult
&rhs
)
198 : m_opaque_up(new CommandInterpreterRunResult()) {
199 LLDB_INSTRUMENT_VA(this, rhs
);
201 *m_opaque_up
= *rhs
.m_opaque_up
;
204 SBCommandInterpreterRunResult::SBCommandInterpreterRunResult(
205 const CommandInterpreterRunResult
&rhs
) {
206 m_opaque_up
= std::make_unique
<CommandInterpreterRunResult
>(rhs
);
209 SBCommandInterpreterRunResult::~SBCommandInterpreterRunResult() = default;
211 SBCommandInterpreterRunResult
&SBCommandInterpreterRunResult::operator=(
212 const SBCommandInterpreterRunResult
&rhs
) {
213 LLDB_INSTRUMENT_VA(this, rhs
);
217 *m_opaque_up
= *rhs
.m_opaque_up
;
221 int SBCommandInterpreterRunResult::GetNumberOfErrors() const {
222 LLDB_INSTRUMENT_VA(this);
224 return m_opaque_up
->GetNumErrors();
227 lldb::CommandInterpreterResult
228 SBCommandInterpreterRunResult::GetResult() const {
229 LLDB_INSTRUMENT_VA(this);
231 return m_opaque_up
->GetResult();