1cfca06d7SDimitry Andric //===-- SBCommandInterpreterRunOptions.cpp --------------------------------===//
2cfca06d7SDimitry Andric //
3cfca06d7SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4cfca06d7SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
5cfca06d7SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6cfca06d7SDimitry Andric //
7cfca06d7SDimitry Andric //===----------------------------------------------------------------------===//
8cfca06d7SDimitry Andric
9cfca06d7SDimitry Andric #include "lldb/lldb-types.h"
10cfca06d7SDimitry Andric
116f8fc217SDimitry Andric #include "lldb/Utility/Instrumentation.h"
12cfca06d7SDimitry Andric
13cfca06d7SDimitry Andric #include "lldb/API/SBCommandInterpreterRunOptions.h"
14cfca06d7SDimitry Andric #include "lldb/Interpreter/CommandInterpreter.h"
15cfca06d7SDimitry Andric
16cfca06d7SDimitry Andric #include <memory>
17cfca06d7SDimitry Andric
18cfca06d7SDimitry Andric using namespace lldb;
19cfca06d7SDimitry Andric using namespace lldb_private;
20cfca06d7SDimitry Andric
SBCommandInterpreterRunOptions()21cfca06d7SDimitry Andric SBCommandInterpreterRunOptions::SBCommandInterpreterRunOptions() {
226f8fc217SDimitry Andric LLDB_INSTRUMENT_VA(this);
23cfca06d7SDimitry Andric
24cfca06d7SDimitry Andric m_opaque_up = std::make_unique<CommandInterpreterRunOptions>();
25cfca06d7SDimitry Andric }
26cfca06d7SDimitry Andric
SBCommandInterpreterRunOptions(const SBCommandInterpreterRunOptions & rhs)27b60736ecSDimitry Andric SBCommandInterpreterRunOptions::SBCommandInterpreterRunOptions(
286f8fc217SDimitry Andric const SBCommandInterpreterRunOptions &rhs) {
296f8fc217SDimitry Andric LLDB_INSTRUMENT_VA(this, rhs);
30b60736ecSDimitry Andric
31b60736ecSDimitry Andric m_opaque_up = std::make_unique<CommandInterpreterRunOptions>(rhs.ref());
32b60736ecSDimitry Andric }
33b60736ecSDimitry Andric
34cfca06d7SDimitry Andric SBCommandInterpreterRunOptions::~SBCommandInterpreterRunOptions() = default;
35cfca06d7SDimitry Andric
operator =(const SBCommandInterpreterRunOptions & rhs)36b60736ecSDimitry Andric SBCommandInterpreterRunOptions &SBCommandInterpreterRunOptions::operator=(
37b60736ecSDimitry Andric const SBCommandInterpreterRunOptions &rhs) {
386f8fc217SDimitry Andric LLDB_INSTRUMENT_VA(this, rhs);
39b60736ecSDimitry Andric
40b60736ecSDimitry Andric if (this == &rhs)
416f8fc217SDimitry Andric return *this;
42b60736ecSDimitry Andric *m_opaque_up = *rhs.m_opaque_up;
436f8fc217SDimitry Andric return *this;
44b60736ecSDimitry Andric }
45b60736ecSDimitry Andric
GetStopOnContinue() const46cfca06d7SDimitry Andric bool SBCommandInterpreterRunOptions::GetStopOnContinue() const {
476f8fc217SDimitry Andric LLDB_INSTRUMENT_VA(this);
48cfca06d7SDimitry Andric
49cfca06d7SDimitry Andric return m_opaque_up->GetStopOnContinue();
50cfca06d7SDimitry Andric }
51cfca06d7SDimitry Andric
SetStopOnContinue(bool stop_on_continue)52cfca06d7SDimitry Andric void SBCommandInterpreterRunOptions::SetStopOnContinue(bool stop_on_continue) {
536f8fc217SDimitry Andric LLDB_INSTRUMENT_VA(this, stop_on_continue);
54cfca06d7SDimitry Andric
55cfca06d7SDimitry Andric m_opaque_up->SetStopOnContinue(stop_on_continue);
56cfca06d7SDimitry Andric }
57cfca06d7SDimitry Andric
GetStopOnError() const58cfca06d7SDimitry Andric bool SBCommandInterpreterRunOptions::GetStopOnError() const {
596f8fc217SDimitry Andric LLDB_INSTRUMENT_VA(this);
60cfca06d7SDimitry Andric
61cfca06d7SDimitry Andric return m_opaque_up->GetStopOnError();
62cfca06d7SDimitry Andric }
63cfca06d7SDimitry Andric
SetStopOnError(bool stop_on_error)64cfca06d7SDimitry Andric void SBCommandInterpreterRunOptions::SetStopOnError(bool stop_on_error) {
656f8fc217SDimitry Andric LLDB_INSTRUMENT_VA(this, stop_on_error);
66cfca06d7SDimitry Andric
67cfca06d7SDimitry Andric m_opaque_up->SetStopOnError(stop_on_error);
68cfca06d7SDimitry Andric }
69cfca06d7SDimitry Andric
GetStopOnCrash() const70cfca06d7SDimitry Andric bool SBCommandInterpreterRunOptions::GetStopOnCrash() const {
716f8fc217SDimitry Andric LLDB_INSTRUMENT_VA(this);
72cfca06d7SDimitry Andric
73cfca06d7SDimitry Andric return m_opaque_up->GetStopOnCrash();
74cfca06d7SDimitry Andric }
75cfca06d7SDimitry Andric
SetStopOnCrash(bool stop_on_crash)76cfca06d7SDimitry Andric void SBCommandInterpreterRunOptions::SetStopOnCrash(bool stop_on_crash) {
776f8fc217SDimitry Andric LLDB_INSTRUMENT_VA(this, stop_on_crash);
78cfca06d7SDimitry Andric
79cfca06d7SDimitry Andric m_opaque_up->SetStopOnCrash(stop_on_crash);
80cfca06d7SDimitry Andric }
81cfca06d7SDimitry Andric
GetEchoCommands() const82cfca06d7SDimitry Andric bool SBCommandInterpreterRunOptions::GetEchoCommands() const {
836f8fc217SDimitry Andric LLDB_INSTRUMENT_VA(this);
84cfca06d7SDimitry Andric
85cfca06d7SDimitry Andric return m_opaque_up->GetEchoCommands();
86cfca06d7SDimitry Andric }
87cfca06d7SDimitry Andric
SetEchoCommands(bool echo_commands)88cfca06d7SDimitry Andric void SBCommandInterpreterRunOptions::SetEchoCommands(bool echo_commands) {
896f8fc217SDimitry Andric LLDB_INSTRUMENT_VA(this, echo_commands);
90cfca06d7SDimitry Andric
91cfca06d7SDimitry Andric m_opaque_up->SetEchoCommands(echo_commands);
92cfca06d7SDimitry Andric }
93cfca06d7SDimitry Andric
GetEchoCommentCommands() const94cfca06d7SDimitry Andric bool SBCommandInterpreterRunOptions::GetEchoCommentCommands() const {
956f8fc217SDimitry Andric LLDB_INSTRUMENT_VA(this);
96cfca06d7SDimitry Andric
97cfca06d7SDimitry Andric return m_opaque_up->GetEchoCommentCommands();
98cfca06d7SDimitry Andric }
99cfca06d7SDimitry Andric
SetEchoCommentCommands(bool echo)100cfca06d7SDimitry Andric void SBCommandInterpreterRunOptions::SetEchoCommentCommands(bool echo) {
1016f8fc217SDimitry Andric LLDB_INSTRUMENT_VA(this, echo);
102cfca06d7SDimitry Andric
103cfca06d7SDimitry Andric m_opaque_up->SetEchoCommentCommands(echo);
104cfca06d7SDimitry Andric }
105cfca06d7SDimitry Andric
GetPrintResults() const106cfca06d7SDimitry Andric bool SBCommandInterpreterRunOptions::GetPrintResults() const {
1076f8fc217SDimitry Andric LLDB_INSTRUMENT_VA(this);
108cfca06d7SDimitry Andric
109cfca06d7SDimitry Andric return m_opaque_up->GetPrintResults();
110cfca06d7SDimitry Andric }
111cfca06d7SDimitry Andric
SetPrintResults(bool print_results)112cfca06d7SDimitry Andric void SBCommandInterpreterRunOptions::SetPrintResults(bool print_results) {
1136f8fc217SDimitry Andric LLDB_INSTRUMENT_VA(this, print_results);
114cfca06d7SDimitry Andric
115cfca06d7SDimitry Andric m_opaque_up->SetPrintResults(print_results);
116cfca06d7SDimitry Andric }
117cfca06d7SDimitry Andric
GetPrintErrors() const118344a3780SDimitry Andric bool SBCommandInterpreterRunOptions::GetPrintErrors() const {
1196f8fc217SDimitry Andric LLDB_INSTRUMENT_VA(this);
120344a3780SDimitry Andric
121344a3780SDimitry Andric return m_opaque_up->GetPrintErrors();
122344a3780SDimitry Andric }
123344a3780SDimitry Andric
SetPrintErrors(bool print_errors)124344a3780SDimitry Andric void SBCommandInterpreterRunOptions::SetPrintErrors(bool print_errors) {
1256f8fc217SDimitry Andric LLDB_INSTRUMENT_VA(this, print_errors);
126344a3780SDimitry Andric
127344a3780SDimitry Andric m_opaque_up->SetPrintErrors(print_errors);
128344a3780SDimitry Andric }
129344a3780SDimitry Andric
GetAddToHistory() const130cfca06d7SDimitry Andric bool SBCommandInterpreterRunOptions::GetAddToHistory() const {
1316f8fc217SDimitry Andric LLDB_INSTRUMENT_VA(this);
132cfca06d7SDimitry Andric
133cfca06d7SDimitry Andric return m_opaque_up->GetAddToHistory();
134cfca06d7SDimitry Andric }
135cfca06d7SDimitry Andric
SetAddToHistory(bool add_to_history)136cfca06d7SDimitry Andric void SBCommandInterpreterRunOptions::SetAddToHistory(bool add_to_history) {
1376f8fc217SDimitry Andric LLDB_INSTRUMENT_VA(this, add_to_history);
138cfca06d7SDimitry Andric
139cfca06d7SDimitry Andric m_opaque_up->SetAddToHistory(add_to_history);
140cfca06d7SDimitry Andric }
141cfca06d7SDimitry Andric
GetAutoHandleEvents() const142cfca06d7SDimitry Andric bool SBCommandInterpreterRunOptions::GetAutoHandleEvents() const {
1436f8fc217SDimitry Andric LLDB_INSTRUMENT_VA(this);
144cfca06d7SDimitry Andric
145cfca06d7SDimitry Andric return m_opaque_up->GetAutoHandleEvents();
146cfca06d7SDimitry Andric }
147cfca06d7SDimitry Andric
SetAutoHandleEvents(bool auto_handle_events)148cfca06d7SDimitry Andric void SBCommandInterpreterRunOptions::SetAutoHandleEvents(
149cfca06d7SDimitry Andric bool auto_handle_events) {
1506f8fc217SDimitry Andric LLDB_INSTRUMENT_VA(this, auto_handle_events);
151cfca06d7SDimitry Andric
152cfca06d7SDimitry Andric m_opaque_up->SetAutoHandleEvents(auto_handle_events);
153cfca06d7SDimitry Andric }
154cfca06d7SDimitry Andric
GetSpawnThread() const155cfca06d7SDimitry Andric bool SBCommandInterpreterRunOptions::GetSpawnThread() const {
1566f8fc217SDimitry Andric LLDB_INSTRUMENT_VA(this);
157cfca06d7SDimitry Andric
158cfca06d7SDimitry Andric return m_opaque_up->GetSpawnThread();
159cfca06d7SDimitry Andric }
160cfca06d7SDimitry Andric
SetSpawnThread(bool spawn_thread)161cfca06d7SDimitry Andric void SBCommandInterpreterRunOptions::SetSpawnThread(bool spawn_thread) {
1626f8fc217SDimitry Andric LLDB_INSTRUMENT_VA(this, spawn_thread);
163cfca06d7SDimitry Andric
164cfca06d7SDimitry Andric m_opaque_up->SetSpawnThread(spawn_thread);
165cfca06d7SDimitry Andric }
166cfca06d7SDimitry Andric
GetAllowRepeats() const167ac9a064cSDimitry Andric bool SBCommandInterpreterRunOptions::GetAllowRepeats() const {
168ac9a064cSDimitry Andric LLDB_INSTRUMENT_VA(this);
169ac9a064cSDimitry Andric
170ac9a064cSDimitry Andric return m_opaque_up->GetAllowRepeats();
171ac9a064cSDimitry Andric }
172ac9a064cSDimitry Andric
SetAllowRepeats(bool allow_repeats)173ac9a064cSDimitry Andric void SBCommandInterpreterRunOptions::SetAllowRepeats(bool allow_repeats) {
174ac9a064cSDimitry Andric LLDB_INSTRUMENT_VA(this, allow_repeats);
175ac9a064cSDimitry Andric
176ac9a064cSDimitry Andric m_opaque_up->SetAllowRepeats(allow_repeats);
177ac9a064cSDimitry Andric }
178ac9a064cSDimitry Andric
179cfca06d7SDimitry Andric lldb_private::CommandInterpreterRunOptions *
get() const180cfca06d7SDimitry Andric SBCommandInterpreterRunOptions::get() const {
181cfca06d7SDimitry Andric return m_opaque_up.get();
182cfca06d7SDimitry Andric }
183cfca06d7SDimitry Andric
184cfca06d7SDimitry Andric lldb_private::CommandInterpreterRunOptions &
ref() const185cfca06d7SDimitry Andric SBCommandInterpreterRunOptions::ref() const {
186cfca06d7SDimitry Andric return *m_opaque_up;
187cfca06d7SDimitry Andric }
188cfca06d7SDimitry Andric
SBCommandInterpreterRunResult()189cfca06d7SDimitry Andric SBCommandInterpreterRunResult::SBCommandInterpreterRunResult()
190cfca06d7SDimitry Andric : m_opaque_up(new CommandInterpreterRunResult())
191cfca06d7SDimitry Andric
192cfca06d7SDimitry Andric {
1936f8fc217SDimitry Andric LLDB_INSTRUMENT_VA(this);
194cfca06d7SDimitry Andric }
195cfca06d7SDimitry Andric
SBCommandInterpreterRunResult(const SBCommandInterpreterRunResult & rhs)196cfca06d7SDimitry Andric SBCommandInterpreterRunResult::SBCommandInterpreterRunResult(
197cfca06d7SDimitry Andric const SBCommandInterpreterRunResult &rhs)
198cfca06d7SDimitry Andric : m_opaque_up(new CommandInterpreterRunResult()) {
1996f8fc217SDimitry Andric LLDB_INSTRUMENT_VA(this, rhs);
200cfca06d7SDimitry Andric
201cfca06d7SDimitry Andric *m_opaque_up = *rhs.m_opaque_up;
202cfca06d7SDimitry Andric }
203cfca06d7SDimitry Andric
SBCommandInterpreterRunResult(const CommandInterpreterRunResult & rhs)204cfca06d7SDimitry Andric SBCommandInterpreterRunResult::SBCommandInterpreterRunResult(
2056f8fc217SDimitry Andric const CommandInterpreterRunResult &rhs) {
206cfca06d7SDimitry Andric m_opaque_up = std::make_unique<CommandInterpreterRunResult>(rhs);
207cfca06d7SDimitry Andric }
208cfca06d7SDimitry Andric
209cfca06d7SDimitry Andric SBCommandInterpreterRunResult::~SBCommandInterpreterRunResult() = default;
210cfca06d7SDimitry Andric
operator =(const SBCommandInterpreterRunResult & rhs)211cfca06d7SDimitry Andric SBCommandInterpreterRunResult &SBCommandInterpreterRunResult::operator=(
212cfca06d7SDimitry Andric const SBCommandInterpreterRunResult &rhs) {
2136f8fc217SDimitry Andric LLDB_INSTRUMENT_VA(this, rhs);
214cfca06d7SDimitry Andric
215cfca06d7SDimitry Andric if (this == &rhs)
2166f8fc217SDimitry Andric return *this;
217cfca06d7SDimitry Andric *m_opaque_up = *rhs.m_opaque_up;
2186f8fc217SDimitry Andric return *this;
219cfca06d7SDimitry Andric }
220cfca06d7SDimitry Andric
GetNumberOfErrors() const221cfca06d7SDimitry Andric int SBCommandInterpreterRunResult::GetNumberOfErrors() const {
2226f8fc217SDimitry Andric LLDB_INSTRUMENT_VA(this);
223cfca06d7SDimitry Andric
224cfca06d7SDimitry Andric return m_opaque_up->GetNumErrors();
225cfca06d7SDimitry Andric }
226cfca06d7SDimitry Andric
227cfca06d7SDimitry Andric lldb::CommandInterpreterResult
GetResult() const228cfca06d7SDimitry Andric SBCommandInterpreterRunResult::GetResult() const {
2296f8fc217SDimitry Andric LLDB_INSTRUMENT_VA(this);
230cfca06d7SDimitry Andric
231cfca06d7SDimitry Andric return m_opaque_up->GetResult();
232cfca06d7SDimitry Andric }
233