1 //===-- SBCommandInterpreterRunOptions.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 
9 #include "lldb/lldb-types.h"
10 
11 #include "SBReproducerPrivate.h"
12 
13 #include "lldb/API/SBCommandInterpreterRunOptions.h"
14 #include "lldb/Interpreter/CommandInterpreter.h"
15 
16 #include <memory>
17 
18 using namespace lldb;
19 using namespace lldb_private;
20 
21 SBCommandInterpreterRunOptions::SBCommandInterpreterRunOptions() {
22   LLDB_RECORD_CONSTRUCTOR_NO_ARGS(SBCommandInterpreterRunOptions);
23 
24   m_opaque_up.reset(new CommandInterpreterRunOptions());
25 }
26 
27 SBCommandInterpreterRunOptions::~SBCommandInterpreterRunOptions() = default;
28 
29 bool SBCommandInterpreterRunOptions::GetStopOnContinue() const {
30   LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBCommandInterpreterRunOptions,
31                                    GetStopOnContinue);
32 
33   return m_opaque_up->GetStopOnContinue();
34 }
35 
36 void SBCommandInterpreterRunOptions::SetStopOnContinue(bool stop_on_continue) {
37   LLDB_RECORD_METHOD(void, SBCommandInterpreterRunOptions, SetStopOnContinue,
38                      (bool), stop_on_continue);
39 
40   m_opaque_up->SetStopOnContinue(stop_on_continue);
41 }
42 
43 bool SBCommandInterpreterRunOptions::GetStopOnError() const {
44   LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBCommandInterpreterRunOptions,
45                                    GetStopOnError);
46 
47   return m_opaque_up->GetStopOnError();
48 }
49 
50 void SBCommandInterpreterRunOptions::SetStopOnError(bool stop_on_error) {
51   LLDB_RECORD_METHOD(void, SBCommandInterpreterRunOptions, SetStopOnError,
52                      (bool), stop_on_error);
53 
54   m_opaque_up->SetStopOnError(stop_on_error);
55 }
56 
57 bool SBCommandInterpreterRunOptions::GetStopOnCrash() const {
58   LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBCommandInterpreterRunOptions,
59                                    GetStopOnCrash);
60 
61   return m_opaque_up->GetStopOnCrash();
62 }
63 
64 void SBCommandInterpreterRunOptions::SetStopOnCrash(bool stop_on_crash) {
65   LLDB_RECORD_METHOD(void, SBCommandInterpreterRunOptions, SetStopOnCrash,
66                      (bool), stop_on_crash);
67 
68   m_opaque_up->SetStopOnCrash(stop_on_crash);
69 }
70 
71 bool SBCommandInterpreterRunOptions::GetEchoCommands() const {
72   LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBCommandInterpreterRunOptions,
73                                    GetEchoCommands);
74 
75   return m_opaque_up->GetEchoCommands();
76 }
77 
78 void SBCommandInterpreterRunOptions::SetEchoCommands(bool echo_commands) {
79   LLDB_RECORD_METHOD(void, SBCommandInterpreterRunOptions, SetEchoCommands,
80                      (bool), echo_commands);
81 
82   m_opaque_up->SetEchoCommands(echo_commands);
83 }
84 
85 bool SBCommandInterpreterRunOptions::GetEchoCommentCommands() const {
86   LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBCommandInterpreterRunOptions,
87                                    GetEchoCommentCommands);
88 
89   return m_opaque_up->GetEchoCommentCommands();
90 }
91 
92 void SBCommandInterpreterRunOptions::SetEchoCommentCommands(bool echo) {
93   LLDB_RECORD_METHOD(void, SBCommandInterpreterRunOptions,
94                      SetEchoCommentCommands, (bool), echo);
95 
96   m_opaque_up->SetEchoCommentCommands(echo);
97 }
98 
99 bool SBCommandInterpreterRunOptions::GetPrintResults() const {
100   LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBCommandInterpreterRunOptions,
101                                    GetPrintResults);
102 
103   return m_opaque_up->GetPrintResults();
104 }
105 
106 void SBCommandInterpreterRunOptions::SetPrintResults(bool print_results) {
107   LLDB_RECORD_METHOD(void, SBCommandInterpreterRunOptions, SetPrintResults,
108                      (bool), print_results);
109 
110   m_opaque_up->SetPrintResults(print_results);
111 }
112 
113 bool SBCommandInterpreterRunOptions::GetAddToHistory() const {
114   LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBCommandInterpreterRunOptions,
115                                    GetAddToHistory);
116 
117   return m_opaque_up->GetAddToHistory();
118 }
119 
120 void SBCommandInterpreterRunOptions::SetAddToHistory(bool add_to_history) {
121   LLDB_RECORD_METHOD(void, SBCommandInterpreterRunOptions, SetAddToHistory,
122                      (bool), add_to_history);
123 
124   m_opaque_up->SetAddToHistory(add_to_history);
125 }
126 
127 bool SBCommandInterpreterRunOptions::GetAutoHandleEvents() const {
128   LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBCommandInterpreterRunOptions,
129                                    GetAutoHandleEvents);
130 
131   return m_opaque_up->GetAutoHandleEvents();
132 }
133 
134 void SBCommandInterpreterRunOptions::SetAutoHandleEvents(
135     bool auto_handle_events) {
136   LLDB_RECORD_METHOD(void, SBCommandInterpreterRunOptions, SetAutoHandleEvents,
137                      (bool), auto_handle_events);
138 
139   m_opaque_up->SetAutoHandleEvents(auto_handle_events);
140 }
141 
142 bool SBCommandInterpreterRunOptions::GetSpawnThread() const {
143   LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBCommandInterpreterRunOptions,
144                                    GetSpawnThread);
145 
146   return m_opaque_up->GetSpawnThread();
147 }
148 
149 void SBCommandInterpreterRunOptions::SetSpawnThread(bool spawn_thread) {
150   LLDB_RECORD_METHOD(void, SBCommandInterpreterRunOptions, SetSpawnThread,
151                      (bool), spawn_thread);
152 
153   m_opaque_up->SetSpawnThread(spawn_thread);
154 }
155 
156 lldb_private::CommandInterpreterRunOptions *
157 SBCommandInterpreterRunOptions::get() const {
158   return m_opaque_up.get();
159 }
160 
161 lldb_private::CommandInterpreterRunOptions &
162 SBCommandInterpreterRunOptions::ref() const {
163   return *m_opaque_up;
164 }
165 
166 namespace lldb_private {
167 namespace repro {
168 
169 template <> void RegisterMethods<SBCommandInterpreterRunOptions>(Registry &R) {
170   LLDB_REGISTER_CONSTRUCTOR(SBCommandInterpreterRunOptions, ());
171   LLDB_REGISTER_METHOD_CONST(bool, SBCommandInterpreterRunOptions,
172                              GetStopOnContinue, ());
173   LLDB_REGISTER_METHOD(void, SBCommandInterpreterRunOptions, SetStopOnContinue,
174                        (bool));
175   LLDB_REGISTER_METHOD_CONST(bool, SBCommandInterpreterRunOptions,
176                              GetStopOnError, ());
177   LLDB_REGISTER_METHOD(void, SBCommandInterpreterRunOptions, SetStopOnError,
178                        (bool));
179   LLDB_REGISTER_METHOD_CONST(bool, SBCommandInterpreterRunOptions,
180                              GetStopOnCrash, ());
181   LLDB_REGISTER_METHOD(void, SBCommandInterpreterRunOptions, SetStopOnCrash,
182                        (bool));
183   LLDB_REGISTER_METHOD_CONST(bool, SBCommandInterpreterRunOptions,
184                              GetEchoCommands, ());
185   LLDB_REGISTER_METHOD(void, SBCommandInterpreterRunOptions, SetEchoCommands,
186                        (bool));
187   LLDB_REGISTER_METHOD_CONST(bool, SBCommandInterpreterRunOptions,
188                              GetEchoCommentCommands, ());
189   LLDB_REGISTER_METHOD(void, SBCommandInterpreterRunOptions,
190                        SetEchoCommentCommands, (bool));
191   LLDB_REGISTER_METHOD_CONST(bool, SBCommandInterpreterRunOptions,
192                              GetPrintResults, ());
193   LLDB_REGISTER_METHOD(void, SBCommandInterpreterRunOptions, SetPrintResults,
194                        (bool));
195   LLDB_REGISTER_METHOD_CONST(bool, SBCommandInterpreterRunOptions,
196                              GetAddToHistory, ());
197   LLDB_REGISTER_METHOD(void, SBCommandInterpreterRunOptions, SetAddToHistory,
198                        (bool));
199   LLDB_REGISTER_METHOD_CONST(bool, SBCommandInterpreterRunOptions,
200                              GetAutoHandleEvents, ());
201   LLDB_REGISTER_METHOD(void, SBCommandInterpreterRunOptions,
202                        SetAutoHandleEvents, (bool));
203   LLDB_REGISTER_METHOD_CONST(bool, SBCommandInterpreterRunOptions,
204                              GetSpawnThread, ());
205   LLDB_REGISTER_METHOD(void, SBCommandInterpreterRunOptions, SetSpawnThread,
206                        (bool));
207 }
208 
209 } // namespace repro
210 } // namespace lldb_private
211