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 = std::make_unique<CommandInterpreterRunOptions>(); 25 } 26 27 SBCommandInterpreterRunOptions::SBCommandInterpreterRunOptions( 28 const SBCommandInterpreterRunOptions &rhs) { 29 LLDB_RECORD_CONSTRUCTOR(SBCommandInterpreterRunOptions, 30 (const lldb::SBCommandInterpreterRunOptions &), rhs); 31 32 m_opaque_up = std::make_unique<CommandInterpreterRunOptions>(rhs.ref()); 33 } 34 35 SBCommandInterpreterRunOptions::~SBCommandInterpreterRunOptions() = default; 36 37 SBCommandInterpreterRunOptions &SBCommandInterpreterRunOptions::operator=( 38 const SBCommandInterpreterRunOptions &rhs) { 39 LLDB_RECORD_METHOD(lldb::SBCommandInterpreterRunOptions &, 40 SBCommandInterpreterRunOptions, operator=, 41 (const lldb::SBCommandInterpreterRunOptions &), rhs); 42 43 if (this == &rhs) 44 return LLDB_RECORD_RESULT(*this); 45 *m_opaque_up = *rhs.m_opaque_up; 46 return LLDB_RECORD_RESULT(*this); 47 } 48 49 bool SBCommandInterpreterRunOptions::GetStopOnContinue() const { 50 LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBCommandInterpreterRunOptions, 51 GetStopOnContinue); 52 53 return m_opaque_up->GetStopOnContinue(); 54 } 55 56 void SBCommandInterpreterRunOptions::SetStopOnContinue(bool stop_on_continue) { 57 LLDB_RECORD_METHOD(void, SBCommandInterpreterRunOptions, SetStopOnContinue, 58 (bool), stop_on_continue); 59 60 m_opaque_up->SetStopOnContinue(stop_on_continue); 61 } 62 63 bool SBCommandInterpreterRunOptions::GetStopOnError() const { 64 LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBCommandInterpreterRunOptions, 65 GetStopOnError); 66 67 return m_opaque_up->GetStopOnError(); 68 } 69 70 void SBCommandInterpreterRunOptions::SetStopOnError(bool stop_on_error) { 71 LLDB_RECORD_METHOD(void, SBCommandInterpreterRunOptions, SetStopOnError, 72 (bool), stop_on_error); 73 74 m_opaque_up->SetStopOnError(stop_on_error); 75 } 76 77 bool SBCommandInterpreterRunOptions::GetStopOnCrash() const { 78 LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBCommandInterpreterRunOptions, 79 GetStopOnCrash); 80 81 return m_opaque_up->GetStopOnCrash(); 82 } 83 84 void SBCommandInterpreterRunOptions::SetStopOnCrash(bool stop_on_crash) { 85 LLDB_RECORD_METHOD(void, SBCommandInterpreterRunOptions, SetStopOnCrash, 86 (bool), stop_on_crash); 87 88 m_opaque_up->SetStopOnCrash(stop_on_crash); 89 } 90 91 bool SBCommandInterpreterRunOptions::GetEchoCommands() const { 92 LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBCommandInterpreterRunOptions, 93 GetEchoCommands); 94 95 return m_opaque_up->GetEchoCommands(); 96 } 97 98 void SBCommandInterpreterRunOptions::SetEchoCommands(bool echo_commands) { 99 LLDB_RECORD_METHOD(void, SBCommandInterpreterRunOptions, SetEchoCommands, 100 (bool), echo_commands); 101 102 m_opaque_up->SetEchoCommands(echo_commands); 103 } 104 105 bool SBCommandInterpreterRunOptions::GetEchoCommentCommands() const { 106 LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBCommandInterpreterRunOptions, 107 GetEchoCommentCommands); 108 109 return m_opaque_up->GetEchoCommentCommands(); 110 } 111 112 void SBCommandInterpreterRunOptions::SetEchoCommentCommands(bool echo) { 113 LLDB_RECORD_METHOD(void, SBCommandInterpreterRunOptions, 114 SetEchoCommentCommands, (bool), echo); 115 116 m_opaque_up->SetEchoCommentCommands(echo); 117 } 118 119 bool SBCommandInterpreterRunOptions::GetPrintResults() const { 120 LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBCommandInterpreterRunOptions, 121 GetPrintResults); 122 123 return m_opaque_up->GetPrintResults(); 124 } 125 126 void SBCommandInterpreterRunOptions::SetPrintResults(bool print_results) { 127 LLDB_RECORD_METHOD(void, SBCommandInterpreterRunOptions, SetPrintResults, 128 (bool), print_results); 129 130 m_opaque_up->SetPrintResults(print_results); 131 } 132 133 bool SBCommandInterpreterRunOptions::GetPrintErrors() const { 134 LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBCommandInterpreterRunOptions, 135 GetPrintErrors); 136 137 return m_opaque_up->GetPrintErrors(); 138 } 139 140 void SBCommandInterpreterRunOptions::SetPrintErrors(bool print_errors) { 141 LLDB_RECORD_METHOD(void, SBCommandInterpreterRunOptions, SetPrintErrors, 142 (bool), print_errors); 143 144 m_opaque_up->SetPrintErrors(print_errors); 145 } 146 147 bool SBCommandInterpreterRunOptions::GetAddToHistory() const { 148 LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBCommandInterpreterRunOptions, 149 GetAddToHistory); 150 151 return m_opaque_up->GetAddToHistory(); 152 } 153 154 void SBCommandInterpreterRunOptions::SetAddToHistory(bool add_to_history) { 155 LLDB_RECORD_METHOD(void, SBCommandInterpreterRunOptions, SetAddToHistory, 156 (bool), add_to_history); 157 158 m_opaque_up->SetAddToHistory(add_to_history); 159 } 160 161 bool SBCommandInterpreterRunOptions::GetAutoHandleEvents() const { 162 LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBCommandInterpreterRunOptions, 163 GetAutoHandleEvents); 164 165 return m_opaque_up->GetAutoHandleEvents(); 166 } 167 168 void SBCommandInterpreterRunOptions::SetAutoHandleEvents( 169 bool auto_handle_events) { 170 LLDB_RECORD_METHOD(void, SBCommandInterpreterRunOptions, SetAutoHandleEvents, 171 (bool), auto_handle_events); 172 173 m_opaque_up->SetAutoHandleEvents(auto_handle_events); 174 } 175 176 bool SBCommandInterpreterRunOptions::GetSpawnThread() const { 177 LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBCommandInterpreterRunOptions, 178 GetSpawnThread); 179 180 return m_opaque_up->GetSpawnThread(); 181 } 182 183 void SBCommandInterpreterRunOptions::SetSpawnThread(bool spawn_thread) { 184 LLDB_RECORD_METHOD(void, SBCommandInterpreterRunOptions, SetSpawnThread, 185 (bool), spawn_thread); 186 187 m_opaque_up->SetSpawnThread(spawn_thread); 188 } 189 190 lldb_private::CommandInterpreterRunOptions * 191 SBCommandInterpreterRunOptions::get() const { 192 return m_opaque_up.get(); 193 } 194 195 lldb_private::CommandInterpreterRunOptions & 196 SBCommandInterpreterRunOptions::ref() const { 197 return *m_opaque_up; 198 } 199 200 SBCommandInterpreterRunResult::SBCommandInterpreterRunResult() 201 : m_opaque_up(new CommandInterpreterRunResult()) 202 203 { 204 LLDB_RECORD_CONSTRUCTOR_NO_ARGS(SBCommandInterpreterRunResult); 205 } 206 207 SBCommandInterpreterRunResult::SBCommandInterpreterRunResult( 208 const SBCommandInterpreterRunResult &rhs) 209 : m_opaque_up(new CommandInterpreterRunResult()) { 210 LLDB_RECORD_CONSTRUCTOR(SBCommandInterpreterRunResult, 211 (const lldb::SBCommandInterpreterRunResult &), rhs); 212 213 *m_opaque_up = *rhs.m_opaque_up; 214 } 215 216 SBCommandInterpreterRunResult::SBCommandInterpreterRunResult( 217 const CommandInterpreterRunResult &rhs) { 218 m_opaque_up = std::make_unique<CommandInterpreterRunResult>(rhs); 219 } 220 221 SBCommandInterpreterRunResult::~SBCommandInterpreterRunResult() = default; 222 223 SBCommandInterpreterRunResult &SBCommandInterpreterRunResult::operator=( 224 const SBCommandInterpreterRunResult &rhs) { 225 LLDB_RECORD_METHOD(lldb::SBCommandInterpreterRunResult &, 226 SBCommandInterpreterRunResult, operator=, 227 (const lldb::SBCommandInterpreterRunResult &), rhs); 228 229 if (this == &rhs) 230 return LLDB_RECORD_RESULT(*this); 231 *m_opaque_up = *rhs.m_opaque_up; 232 return LLDB_RECORD_RESULT(*this); 233 } 234 235 int SBCommandInterpreterRunResult::GetNumberOfErrors() const { 236 LLDB_RECORD_METHOD_CONST_NO_ARGS(int, SBCommandInterpreterRunResult, 237 GetNumberOfErrors); 238 239 return m_opaque_up->GetNumErrors(); 240 } 241 242 lldb::CommandInterpreterResult 243 SBCommandInterpreterRunResult::GetResult() const { 244 LLDB_RECORD_METHOD_CONST_NO_ARGS(lldb::CommandInterpreterResult, 245 SBCommandInterpreterRunResult, GetResult); 246 247 return m_opaque_up->GetResult(); 248 } 249 250 namespace lldb_private { 251 namespace repro { 252 253 template <> void RegisterMethods<SBCommandInterpreterRunOptions>(Registry &R) { 254 LLDB_REGISTER_CONSTRUCTOR(SBCommandInterpreterRunOptions, ()); 255 LLDB_REGISTER_CONSTRUCTOR(SBCommandInterpreterRunOptions, 256 (const lldb::SBCommandInterpreterRunOptions &)); 257 LLDB_REGISTER_METHOD(lldb::SBCommandInterpreterRunOptions &, 258 SBCommandInterpreterRunOptions, operator=, 259 (const lldb::SBCommandInterpreterRunOptions &)); 260 LLDB_REGISTER_METHOD_CONST(bool, SBCommandInterpreterRunOptions, 261 GetStopOnContinue, ()); 262 LLDB_REGISTER_METHOD(void, SBCommandInterpreterRunOptions, SetStopOnContinue, 263 (bool)); 264 LLDB_REGISTER_METHOD_CONST(bool, SBCommandInterpreterRunOptions, 265 GetStopOnError, ()); 266 LLDB_REGISTER_METHOD(void, SBCommandInterpreterRunOptions, SetStopOnError, 267 (bool)); 268 LLDB_REGISTER_METHOD_CONST(bool, SBCommandInterpreterRunOptions, 269 GetStopOnCrash, ()); 270 LLDB_REGISTER_METHOD(void, SBCommandInterpreterRunOptions, SetStopOnCrash, 271 (bool)); 272 LLDB_REGISTER_METHOD_CONST(bool, SBCommandInterpreterRunOptions, 273 GetEchoCommands, ()); 274 LLDB_REGISTER_METHOD(void, SBCommandInterpreterRunOptions, SetEchoCommands, 275 (bool)); 276 LLDB_REGISTER_METHOD_CONST(bool, SBCommandInterpreterRunOptions, 277 GetEchoCommentCommands, ()); 278 LLDB_REGISTER_METHOD(void, SBCommandInterpreterRunOptions, 279 SetEchoCommentCommands, (bool)); 280 LLDB_REGISTER_METHOD_CONST(bool, SBCommandInterpreterRunOptions, 281 GetPrintResults, ()); 282 LLDB_REGISTER_METHOD(void, SBCommandInterpreterRunOptions, SetPrintResults, 283 (bool)); 284 LLDB_REGISTER_METHOD_CONST(bool, SBCommandInterpreterRunOptions, 285 GetPrintErrors, ()); 286 LLDB_REGISTER_METHOD(void, SBCommandInterpreterRunOptions, SetPrintErrors, 287 (bool)); 288 LLDB_REGISTER_METHOD_CONST(bool, SBCommandInterpreterRunOptions, 289 GetAddToHistory, ()); 290 LLDB_REGISTER_METHOD(void, SBCommandInterpreterRunOptions, SetAddToHistory, 291 (bool)); 292 LLDB_REGISTER_METHOD_CONST(bool, SBCommandInterpreterRunOptions, 293 GetAutoHandleEvents, ()); 294 LLDB_REGISTER_METHOD(void, SBCommandInterpreterRunOptions, 295 SetAutoHandleEvents, (bool)); 296 LLDB_REGISTER_METHOD_CONST(bool, SBCommandInterpreterRunOptions, 297 GetSpawnThread, ()); 298 LLDB_REGISTER_METHOD(void, SBCommandInterpreterRunOptions, SetSpawnThread, 299 (bool)); 300 LLDB_REGISTER_CONSTRUCTOR(SBCommandInterpreterRunResult, ()); 301 LLDB_REGISTER_CONSTRUCTOR(SBCommandInterpreterRunResult, 302 (const lldb::SBCommandInterpreterRunResult &)); 303 LLDB_REGISTER_METHOD(lldb::SBCommandInterpreterRunResult &, 304 SBCommandInterpreterRunResult, operator=, 305 (const lldb::SBCommandInterpreterRunResult &)); 306 LLDB_REGISTER_METHOD_CONST(int, SBCommandInterpreterRunResult, 307 GetNumberOfErrors, ()); 308 LLDB_REGISTER_METHOD_CONST(lldb::CommandInterpreterResult, 309 SBCommandInterpreterRunResult, GetResult, ()); 310 } 311 312 } // namespace repro 313 } // namespace lldb_private 314