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() = 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 SBCommandInterpreterRunResult::SBCommandInterpreterRunResult() 167 : m_opaque_up(new CommandInterpreterRunResult()) 168 169 { 170 LLDB_RECORD_CONSTRUCTOR_NO_ARGS(SBCommandInterpreterRunResult); 171 } 172 173 SBCommandInterpreterRunResult::SBCommandInterpreterRunResult( 174 const SBCommandInterpreterRunResult &rhs) 175 : m_opaque_up(new CommandInterpreterRunResult()) { 176 LLDB_RECORD_CONSTRUCTOR(SBCommandInterpreterRunResult, 177 (const lldb::SBCommandInterpreterRunResult &), rhs); 178 179 *m_opaque_up = *rhs.m_opaque_up; 180 } 181 182 SBCommandInterpreterRunResult::SBCommandInterpreterRunResult( 183 const CommandInterpreterRunResult &rhs) 184 : m_opaque_up() { 185 m_opaque_up = std::make_unique<CommandInterpreterRunResult>(rhs); 186 } 187 188 SBCommandInterpreterRunResult::~SBCommandInterpreterRunResult() = default; 189 190 SBCommandInterpreterRunResult &SBCommandInterpreterRunResult::operator=( 191 const SBCommandInterpreterRunResult &rhs) { 192 LLDB_RECORD_METHOD(lldb::SBCommandInterpreterRunResult &, 193 SBCommandInterpreterRunResult, 194 operator=,(const lldb::SBCommandInterpreterRunResult &), 195 rhs); 196 197 if (this == &rhs) 198 return *this; 199 *m_opaque_up = *rhs.m_opaque_up; 200 return LLDB_RECORD_RESULT(*this); 201 } 202 203 int SBCommandInterpreterRunResult::GetNumberOfErrors() const { 204 LLDB_RECORD_METHOD_CONST_NO_ARGS(int, SBCommandInterpreterRunResult, 205 GetNumberOfErrors); 206 207 return m_opaque_up->GetNumErrors(); 208 } 209 210 lldb::CommandInterpreterResult 211 SBCommandInterpreterRunResult::GetResult() const { 212 LLDB_RECORD_METHOD_CONST_NO_ARGS(lldb::CommandInterpreterResult, 213 SBCommandInterpreterRunResult, GetResult); 214 215 return m_opaque_up->GetResult(); 216 } 217 218 namespace lldb_private { 219 namespace repro { 220 221 template <> void RegisterMethods<SBCommandInterpreterRunOptions>(Registry &R) { 222 LLDB_REGISTER_CONSTRUCTOR(SBCommandInterpreterRunOptions, ()); 223 LLDB_REGISTER_METHOD_CONST(bool, SBCommandInterpreterRunOptions, 224 GetStopOnContinue, ()); 225 LLDB_REGISTER_METHOD(void, SBCommandInterpreterRunOptions, SetStopOnContinue, 226 (bool)); 227 LLDB_REGISTER_METHOD_CONST(bool, SBCommandInterpreterRunOptions, 228 GetStopOnError, ()); 229 LLDB_REGISTER_METHOD(void, SBCommandInterpreterRunOptions, SetStopOnError, 230 (bool)); 231 LLDB_REGISTER_METHOD_CONST(bool, SBCommandInterpreterRunOptions, 232 GetStopOnCrash, ()); 233 LLDB_REGISTER_METHOD(void, SBCommandInterpreterRunOptions, SetStopOnCrash, 234 (bool)); 235 LLDB_REGISTER_METHOD_CONST(bool, SBCommandInterpreterRunOptions, 236 GetEchoCommands, ()); 237 LLDB_REGISTER_METHOD(void, SBCommandInterpreterRunOptions, SetEchoCommands, 238 (bool)); 239 LLDB_REGISTER_METHOD_CONST(bool, SBCommandInterpreterRunOptions, 240 GetEchoCommentCommands, ()); 241 LLDB_REGISTER_METHOD(void, SBCommandInterpreterRunOptions, 242 SetEchoCommentCommands, (bool)); 243 LLDB_REGISTER_METHOD_CONST(bool, SBCommandInterpreterRunOptions, 244 GetPrintResults, ()); 245 LLDB_REGISTER_METHOD(void, SBCommandInterpreterRunOptions, SetPrintResults, 246 (bool)); 247 LLDB_REGISTER_METHOD_CONST(bool, SBCommandInterpreterRunOptions, 248 GetAddToHistory, ()); 249 LLDB_REGISTER_METHOD(void, SBCommandInterpreterRunOptions, SetAddToHistory, 250 (bool)); 251 LLDB_REGISTER_METHOD_CONST(bool, SBCommandInterpreterRunOptions, 252 GetAutoHandleEvents, ()); 253 LLDB_REGISTER_METHOD(void, SBCommandInterpreterRunOptions, 254 SetAutoHandleEvents, (bool)); 255 LLDB_REGISTER_METHOD_CONST(bool, SBCommandInterpreterRunOptions, 256 GetSpawnThread, ()); 257 LLDB_REGISTER_METHOD(void, SBCommandInterpreterRunOptions, SetSpawnThread, 258 (bool)); 259 LLDB_REGISTER_CONSTRUCTOR(SBCommandInterpreterRunResult, ()); 260 LLDB_REGISTER_CONSTRUCTOR(SBCommandInterpreterRunResult, 261 (const lldb::SBCommandInterpreterRunResult &)); 262 LLDB_REGISTER_METHOD(lldb::SBCommandInterpreterRunResult &, 263 SBCommandInterpreterRunResult, 264 operator=,(const lldb::SBCommandInterpreterRunResult &)); 265 LLDB_REGISTER_METHOD_CONST(int, SBCommandInterpreterRunResult, 266 GetNumberOfErrors, ()); 267 LLDB_REGISTER_METHOD_CONST(lldb::CommandInterpreterResult, 268 SBCommandInterpreterRunResult, GetResult, ()); 269 } 270 271 } // namespace repro 272 } // namespace lldb_private 273