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