14b354039SJonas Devlieghere //===-- SBCommandInterpreterRunOptions.cpp --------------------------------===//
24b354039SJonas Devlieghere //
34b354039SJonas Devlieghere // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44b354039SJonas Devlieghere // See https://llvm.org/LICENSE.txt for license information.
54b354039SJonas Devlieghere // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
64b354039SJonas Devlieghere //
74b354039SJonas Devlieghere //===----------------------------------------------------------------------===//
84b354039SJonas Devlieghere
94b354039SJonas Devlieghere #include "lldb/lldb-types.h"
104b354039SJonas Devlieghere
11*1755f5b1SJonas Devlieghere #include "lldb/Utility/Instrumentation.h"
124b354039SJonas Devlieghere
134b354039SJonas Devlieghere #include "lldb/API/SBCommandInterpreterRunOptions.h"
144b354039SJonas Devlieghere #include "lldb/Interpreter/CommandInterpreter.h"
154b354039SJonas Devlieghere
164b354039SJonas Devlieghere #include <memory>
174b354039SJonas Devlieghere
184b354039SJonas Devlieghere using namespace lldb;
194b354039SJonas Devlieghere using namespace lldb_private;
204b354039SJonas Devlieghere
SBCommandInterpreterRunOptions()214b354039SJonas Devlieghere SBCommandInterpreterRunOptions::SBCommandInterpreterRunOptions() {
22*1755f5b1SJonas Devlieghere LLDB_INSTRUMENT_VA(this);
234b354039SJonas Devlieghere
241c0bbe43SJonas Devlieghere m_opaque_up = std::make_unique<CommandInterpreterRunOptions>();
254b354039SJonas Devlieghere }
264b354039SJonas Devlieghere
SBCommandInterpreterRunOptions(const SBCommandInterpreterRunOptions & rhs)2741909e96SJonas Devlieghere SBCommandInterpreterRunOptions::SBCommandInterpreterRunOptions(
28a3436f73SKazu Hirata const SBCommandInterpreterRunOptions &rhs) {
29*1755f5b1SJonas Devlieghere LLDB_INSTRUMENT_VA(this, rhs);
3041909e96SJonas Devlieghere
3141909e96SJonas Devlieghere m_opaque_up = std::make_unique<CommandInterpreterRunOptions>(rhs.ref());
3241909e96SJonas Devlieghere }
3341909e96SJonas Devlieghere
344b354039SJonas Devlieghere SBCommandInterpreterRunOptions::~SBCommandInterpreterRunOptions() = default;
354b354039SJonas Devlieghere
operator =(const SBCommandInterpreterRunOptions & rhs)3641909e96SJonas Devlieghere SBCommandInterpreterRunOptions &SBCommandInterpreterRunOptions::operator=(
3741909e96SJonas Devlieghere const SBCommandInterpreterRunOptions &rhs) {
38*1755f5b1SJonas Devlieghere LLDB_INSTRUMENT_VA(this, rhs);
3941909e96SJonas Devlieghere
4041909e96SJonas Devlieghere if (this == &rhs)
41d232abc3SJonas Devlieghere return *this;
4241909e96SJonas Devlieghere *m_opaque_up = *rhs.m_opaque_up;
43d232abc3SJonas Devlieghere return *this;
4441909e96SJonas Devlieghere }
4541909e96SJonas Devlieghere
GetStopOnContinue() const464b354039SJonas Devlieghere bool SBCommandInterpreterRunOptions::GetStopOnContinue() const {
47*1755f5b1SJonas Devlieghere LLDB_INSTRUMENT_VA(this);
484b354039SJonas Devlieghere
494b354039SJonas Devlieghere return m_opaque_up->GetStopOnContinue();
504b354039SJonas Devlieghere }
514b354039SJonas Devlieghere
SetStopOnContinue(bool stop_on_continue)524b354039SJonas Devlieghere void SBCommandInterpreterRunOptions::SetStopOnContinue(bool stop_on_continue) {
53*1755f5b1SJonas Devlieghere LLDB_INSTRUMENT_VA(this, stop_on_continue);
544b354039SJonas Devlieghere
554b354039SJonas Devlieghere m_opaque_up->SetStopOnContinue(stop_on_continue);
564b354039SJonas Devlieghere }
574b354039SJonas Devlieghere
GetStopOnError() const584b354039SJonas Devlieghere bool SBCommandInterpreterRunOptions::GetStopOnError() const {
59*1755f5b1SJonas Devlieghere LLDB_INSTRUMENT_VA(this);
604b354039SJonas Devlieghere
614b354039SJonas Devlieghere return m_opaque_up->GetStopOnError();
624b354039SJonas Devlieghere }
634b354039SJonas Devlieghere
SetStopOnError(bool stop_on_error)644b354039SJonas Devlieghere void SBCommandInterpreterRunOptions::SetStopOnError(bool stop_on_error) {
65*1755f5b1SJonas Devlieghere LLDB_INSTRUMENT_VA(this, stop_on_error);
664b354039SJonas Devlieghere
674b354039SJonas Devlieghere m_opaque_up->SetStopOnError(stop_on_error);
684b354039SJonas Devlieghere }
694b354039SJonas Devlieghere
GetStopOnCrash() const704b354039SJonas Devlieghere bool SBCommandInterpreterRunOptions::GetStopOnCrash() const {
71*1755f5b1SJonas Devlieghere LLDB_INSTRUMENT_VA(this);
724b354039SJonas Devlieghere
734b354039SJonas Devlieghere return m_opaque_up->GetStopOnCrash();
744b354039SJonas Devlieghere }
754b354039SJonas Devlieghere
SetStopOnCrash(bool stop_on_crash)764b354039SJonas Devlieghere void SBCommandInterpreterRunOptions::SetStopOnCrash(bool stop_on_crash) {
77*1755f5b1SJonas Devlieghere LLDB_INSTRUMENT_VA(this, stop_on_crash);
784b354039SJonas Devlieghere
794b354039SJonas Devlieghere m_opaque_up->SetStopOnCrash(stop_on_crash);
804b354039SJonas Devlieghere }
814b354039SJonas Devlieghere
GetEchoCommands() const824b354039SJonas Devlieghere bool SBCommandInterpreterRunOptions::GetEchoCommands() const {
83*1755f5b1SJonas Devlieghere LLDB_INSTRUMENT_VA(this);
844b354039SJonas Devlieghere
854b354039SJonas Devlieghere return m_opaque_up->GetEchoCommands();
864b354039SJonas Devlieghere }
874b354039SJonas Devlieghere
SetEchoCommands(bool echo_commands)884b354039SJonas Devlieghere void SBCommandInterpreterRunOptions::SetEchoCommands(bool echo_commands) {
89*1755f5b1SJonas Devlieghere LLDB_INSTRUMENT_VA(this, echo_commands);
904b354039SJonas Devlieghere
914b354039SJonas Devlieghere m_opaque_up->SetEchoCommands(echo_commands);
924b354039SJonas Devlieghere }
934b354039SJonas Devlieghere
GetEchoCommentCommands() const944b354039SJonas Devlieghere bool SBCommandInterpreterRunOptions::GetEchoCommentCommands() const {
95*1755f5b1SJonas Devlieghere LLDB_INSTRUMENT_VA(this);
964b354039SJonas Devlieghere
974b354039SJonas Devlieghere return m_opaque_up->GetEchoCommentCommands();
984b354039SJonas Devlieghere }
994b354039SJonas Devlieghere
SetEchoCommentCommands(bool echo)1004b354039SJonas Devlieghere void SBCommandInterpreterRunOptions::SetEchoCommentCommands(bool echo) {
101*1755f5b1SJonas Devlieghere LLDB_INSTRUMENT_VA(this, echo);
1024b354039SJonas Devlieghere
1034b354039SJonas Devlieghere m_opaque_up->SetEchoCommentCommands(echo);
1044b354039SJonas Devlieghere }
1054b354039SJonas Devlieghere
GetPrintResults() const1064b354039SJonas Devlieghere bool SBCommandInterpreterRunOptions::GetPrintResults() const {
107*1755f5b1SJonas Devlieghere LLDB_INSTRUMENT_VA(this);
1084b354039SJonas Devlieghere
1094b354039SJonas Devlieghere return m_opaque_up->GetPrintResults();
1104b354039SJonas Devlieghere }
1114b354039SJonas Devlieghere
SetPrintResults(bool print_results)1124b354039SJonas Devlieghere void SBCommandInterpreterRunOptions::SetPrintResults(bool print_results) {
113*1755f5b1SJonas Devlieghere LLDB_INSTRUMENT_VA(this, print_results);
1144b354039SJonas Devlieghere
1154b354039SJonas Devlieghere m_opaque_up->SetPrintResults(print_results);
1164b354039SJonas Devlieghere }
1174b354039SJonas Devlieghere
GetPrintErrors() const118c9647419SMed Ismail Bennani bool SBCommandInterpreterRunOptions::GetPrintErrors() const {
119*1755f5b1SJonas Devlieghere LLDB_INSTRUMENT_VA(this);
120c9647419SMed Ismail Bennani
121c9647419SMed Ismail Bennani return m_opaque_up->GetPrintErrors();
122c9647419SMed Ismail Bennani }
123c9647419SMed Ismail Bennani
SetPrintErrors(bool print_errors)124c9647419SMed Ismail Bennani void SBCommandInterpreterRunOptions::SetPrintErrors(bool print_errors) {
125*1755f5b1SJonas Devlieghere LLDB_INSTRUMENT_VA(this, print_errors);
126c9647419SMed Ismail Bennani
127c9647419SMed Ismail Bennani m_opaque_up->SetPrintErrors(print_errors);
128c9647419SMed Ismail Bennani }
129c9647419SMed Ismail Bennani
GetAddToHistory() const1304b354039SJonas Devlieghere bool SBCommandInterpreterRunOptions::GetAddToHistory() const {
131*1755f5b1SJonas Devlieghere LLDB_INSTRUMENT_VA(this);
1324b354039SJonas Devlieghere
1334b354039SJonas Devlieghere return m_opaque_up->GetAddToHistory();
1344b354039SJonas Devlieghere }
1354b354039SJonas Devlieghere
SetAddToHistory(bool add_to_history)1364b354039SJonas Devlieghere void SBCommandInterpreterRunOptions::SetAddToHistory(bool add_to_history) {
137*1755f5b1SJonas Devlieghere LLDB_INSTRUMENT_VA(this, add_to_history);
1384b354039SJonas Devlieghere
1394b354039SJonas Devlieghere m_opaque_up->SetAddToHistory(add_to_history);
1404b354039SJonas Devlieghere }
1414b354039SJonas Devlieghere
GetAutoHandleEvents() const1424b354039SJonas Devlieghere bool SBCommandInterpreterRunOptions::GetAutoHandleEvents() const {
143*1755f5b1SJonas Devlieghere LLDB_INSTRUMENT_VA(this);
1444b354039SJonas Devlieghere
1454b354039SJonas Devlieghere return m_opaque_up->GetAutoHandleEvents();
1464b354039SJonas Devlieghere }
1474b354039SJonas Devlieghere
SetAutoHandleEvents(bool auto_handle_events)1484b354039SJonas Devlieghere void SBCommandInterpreterRunOptions::SetAutoHandleEvents(
1494b354039SJonas Devlieghere bool auto_handle_events) {
150*1755f5b1SJonas Devlieghere LLDB_INSTRUMENT_VA(this, auto_handle_events);
1514b354039SJonas Devlieghere
1524b354039SJonas Devlieghere m_opaque_up->SetAutoHandleEvents(auto_handle_events);
1534b354039SJonas Devlieghere }
1544b354039SJonas Devlieghere
GetSpawnThread() const1554b354039SJonas Devlieghere bool SBCommandInterpreterRunOptions::GetSpawnThread() const {
156*1755f5b1SJonas Devlieghere LLDB_INSTRUMENT_VA(this);
1574b354039SJonas Devlieghere
1584b354039SJonas Devlieghere return m_opaque_up->GetSpawnThread();
1594b354039SJonas Devlieghere }
1604b354039SJonas Devlieghere
SetSpawnThread(bool spawn_thread)1614b354039SJonas Devlieghere void SBCommandInterpreterRunOptions::SetSpawnThread(bool spawn_thread) {
162*1755f5b1SJonas Devlieghere LLDB_INSTRUMENT_VA(this, spawn_thread);
1634b354039SJonas Devlieghere
1644b354039SJonas Devlieghere m_opaque_up->SetSpawnThread(spawn_thread);
1654b354039SJonas Devlieghere }
1664b354039SJonas Devlieghere
1674b354039SJonas Devlieghere lldb_private::CommandInterpreterRunOptions *
get() const1684b354039SJonas Devlieghere SBCommandInterpreterRunOptions::get() const {
1694b354039SJonas Devlieghere return m_opaque_up.get();
1704b354039SJonas Devlieghere }
1714b354039SJonas Devlieghere
1724b354039SJonas Devlieghere lldb_private::CommandInterpreterRunOptions &
ref() const1734b354039SJonas Devlieghere SBCommandInterpreterRunOptions::ref() const {
1744b354039SJonas Devlieghere return *m_opaque_up;
1754b354039SJonas Devlieghere }
1764b354039SJonas Devlieghere
SBCommandInterpreterRunResult()1774c67b119SJonas Devlieghere SBCommandInterpreterRunResult::SBCommandInterpreterRunResult()
1784c67b119SJonas Devlieghere : m_opaque_up(new CommandInterpreterRunResult())
1794c67b119SJonas Devlieghere
1804c67b119SJonas Devlieghere {
181*1755f5b1SJonas Devlieghere LLDB_INSTRUMENT_VA(this);
1824c67b119SJonas Devlieghere }
1834c67b119SJonas Devlieghere
SBCommandInterpreterRunResult(const SBCommandInterpreterRunResult & rhs)1844c67b119SJonas Devlieghere SBCommandInterpreterRunResult::SBCommandInterpreterRunResult(
1854c67b119SJonas Devlieghere const SBCommandInterpreterRunResult &rhs)
1864c67b119SJonas Devlieghere : m_opaque_up(new CommandInterpreterRunResult()) {
187*1755f5b1SJonas Devlieghere LLDB_INSTRUMENT_VA(this, rhs);
1884c67b119SJonas Devlieghere
1894c67b119SJonas Devlieghere *m_opaque_up = *rhs.m_opaque_up;
1904c67b119SJonas Devlieghere }
1914c67b119SJonas Devlieghere
SBCommandInterpreterRunResult(const CommandInterpreterRunResult & rhs)1924c67b119SJonas Devlieghere SBCommandInterpreterRunResult::SBCommandInterpreterRunResult(
193a3436f73SKazu Hirata const CommandInterpreterRunResult &rhs) {
1941c0bbe43SJonas Devlieghere m_opaque_up = std::make_unique<CommandInterpreterRunResult>(rhs);
1954c67b119SJonas Devlieghere }
1964c67b119SJonas Devlieghere
1974c67b119SJonas Devlieghere SBCommandInterpreterRunResult::~SBCommandInterpreterRunResult() = default;
1984c67b119SJonas Devlieghere
operator =(const SBCommandInterpreterRunResult & rhs)1994c67b119SJonas Devlieghere SBCommandInterpreterRunResult &SBCommandInterpreterRunResult::operator=(
2004c67b119SJonas Devlieghere const SBCommandInterpreterRunResult &rhs) {
201*1755f5b1SJonas Devlieghere LLDB_INSTRUMENT_VA(this, rhs);
2024c67b119SJonas Devlieghere
2034c67b119SJonas Devlieghere if (this == &rhs)
204d232abc3SJonas Devlieghere return *this;
2054c67b119SJonas Devlieghere *m_opaque_up = *rhs.m_opaque_up;
206d232abc3SJonas Devlieghere return *this;
2074c67b119SJonas Devlieghere }
2084c67b119SJonas Devlieghere
GetNumberOfErrors() const2094c67b119SJonas Devlieghere int SBCommandInterpreterRunResult::GetNumberOfErrors() const {
210*1755f5b1SJonas Devlieghere LLDB_INSTRUMENT_VA(this);
2114c67b119SJonas Devlieghere
2124c67b119SJonas Devlieghere return m_opaque_up->GetNumErrors();
2134c67b119SJonas Devlieghere }
2144c67b119SJonas Devlieghere
2154c67b119SJonas Devlieghere lldb::CommandInterpreterResult
GetResult() const2164c67b119SJonas Devlieghere SBCommandInterpreterRunResult::GetResult() const {
217*1755f5b1SJonas Devlieghere LLDB_INSTRUMENT_VA(this);
2184c67b119SJonas Devlieghere
2194c67b119SJonas Devlieghere return m_opaque_up->GetResult();
2204c67b119SJonas Devlieghere }
221