1 //===-- SBDebugger.cpp ----------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
9 #include "SBReproducerPrivate.h"
10 #include "SystemInitializerFull.h"
12 #include "lldb/API/SBDebugger.h"
14 #include "lldb/lldb-private.h"
16 #include "lldb/API/SBBroadcaster.h"
17 #include "lldb/API/SBCommandInterpreter.h"
18 #include "lldb/API/SBCommandInterpreterRunOptions.h"
19 #include "lldb/API/SBCommandReturnObject.h"
20 #include "lldb/API/SBError.h"
21 #include "lldb/API/SBEvent.h"
22 #include "lldb/API/SBFile.h"
23 #include "lldb/API/SBFrame.h"
24 #include "lldb/API/SBListener.h"
25 #include "lldb/API/SBProcess.h"
26 #include "lldb/API/SBSourceManager.h"
27 #include "lldb/API/SBStream.h"
28 #include "lldb/API/SBStringList.h"
29 #include "lldb/API/SBStructuredData.h"
30 #include "lldb/API/SBTarget.h"
31 #include "lldb/API/SBThread.h"
32 #include "lldb/API/SBTypeCategory.h"
33 #include "lldb/API/SBTypeFilter.h"
34 #include "lldb/API/SBTypeFormat.h"
35 #include "lldb/API/SBTypeNameSpecifier.h"
36 #include "lldb/API/SBTypeSummary.h"
37 #include "lldb/API/SBTypeSynthetic.h"
39 #include "lldb/Core/Debugger.h"
40 #include "lldb/Core/PluginManager.h"
41 #include "lldb/Core/StreamFile.h"
42 #include "lldb/Core/StructuredDataImpl.h"
43 #include "lldb/DataFormatters/DataVisualization.h"
44 #include "lldb/Host/Config.h"
45 #include "lldb/Host/XML.h"
46 #include "lldb/Initialization/SystemLifetimeManager.h"
47 #include "lldb/Interpreter/CommandInterpreter.h"
48 #include "lldb/Interpreter/OptionArgParser.h"
49 #include "lldb/Interpreter/OptionGroupPlatform.h"
50 #include "lldb/Target/Process.h"
51 #include "lldb/Target/TargetList.h"
52 #include "lldb/Utility/Args.h"
53 #include "lldb/Utility/State.h"
55 #include "llvm/ADT/STLExtras.h"
56 #include "llvm/ADT/StringRef.h"
57 #include "llvm/Support/DynamicLibrary.h"
58 #include "llvm/Support/ManagedStatic.h"
61 using namespace lldb_private;
63 static llvm::sys::DynamicLibrary LoadPlugin(const lldb::DebuggerSP &debugger_sp,
66 llvm::sys::DynamicLibrary dynlib =
67 llvm::sys::DynamicLibrary::getPermanentLibrary(spec.GetPath().c_str());
68 if (dynlib.isValid()) {
69 typedef bool (*LLDBCommandPluginInit)(lldb::SBDebugger & debugger);
71 lldb::SBDebugger debugger_sb(debugger_sp);
72 // This calls the bool lldb::PluginInitialize(lldb::SBDebugger debugger)
74 // TODO: mangle this differently for your system - on OSX, the first
75 // underscore needs to be removed and the second one stays
76 LLDBCommandPluginInit init_func =
77 (LLDBCommandPluginInit)(uintptr_t)dynlib.getAddressOfSymbol(
78 "_ZN4lldb16PluginInitializeENS_10SBDebuggerE");
80 if (init_func(debugger_sb))
83 error.SetErrorString("plug-in refused to load "
84 "(lldb::PluginInitialize(lldb::SBDebugger) "
87 error.SetErrorString("plug-in is missing the required initialization: "
88 "lldb::PluginInitialize(lldb::SBDebugger)");
91 if (FileSystem::Instance().Exists(spec))
92 error.SetErrorString("this file does not represent a loadable dylib");
94 error.SetErrorString("no such file");
96 return llvm::sys::DynamicLibrary();
99 static llvm::ManagedStatic<SystemLifetimeManager> g_debugger_lifetime;
101 SBError SBInputReader::Initialize(
102 lldb::SBDebugger &sb_debugger,
103 unsigned long (*callback)(void *, lldb::SBInputReader *,
104 lldb::InputReaderAction, char const *,
106 void *a, lldb::InputReaderGranularity b, char const *c, char const *d,
109 lldb::SBError, SBInputReader, Initialize,
111 unsigned long (*)(void *, lldb::SBInputReader *, lldb::InputReaderAction,
112 const char *, unsigned long),
113 void *, lldb::InputReaderGranularity, const char *, const char *, bool),
114 sb_debugger, callback, a, b, c, d, e);
119 void SBInputReader::SetIsDone(bool b) {
120 LLDB_RECORD_METHOD(void, SBInputReader, SetIsDone, (bool), b);
123 bool SBInputReader::IsActive() const {
124 LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBInputReader, IsActive);
129 SBDebugger::SBDebugger() { LLDB_RECORD_CONSTRUCTOR_NO_ARGS(SBDebugger); }
131 SBDebugger::SBDebugger(const lldb::DebuggerSP &debugger_sp)
132 : m_opaque_sp(debugger_sp) {
133 LLDB_RECORD_CONSTRUCTOR(SBDebugger, (const lldb::DebuggerSP &), debugger_sp);
136 SBDebugger::SBDebugger(const SBDebugger &rhs) : m_opaque_sp(rhs.m_opaque_sp) {
137 LLDB_RECORD_CONSTRUCTOR(SBDebugger, (const lldb::SBDebugger &), rhs);
140 SBDebugger::~SBDebugger() = default;
142 SBDebugger &SBDebugger::operator=(const SBDebugger &rhs) {
143 LLDB_RECORD_METHOD(lldb::SBDebugger &,
144 SBDebugger, operator=,(const lldb::SBDebugger &), rhs);
147 m_opaque_sp = rhs.m_opaque_sp;
149 return LLDB_RECORD_RESULT(*this);
152 void SBDebugger::Initialize() {
153 LLDB_RECORD_STATIC_METHOD_NO_ARGS(void, SBDebugger, Initialize);
154 SBError ignored = SBDebugger::InitializeWithErrorHandling();
157 lldb::SBError SBDebugger::InitializeWithErrorHandling() {
158 LLDB_RECORD_STATIC_METHOD_NO_ARGS(lldb::SBError, SBDebugger,
159 InitializeWithErrorHandling);
162 if (auto e = g_debugger_lifetime->Initialize(
163 std::make_unique<SystemInitializerFull>(), LoadPlugin)) {
164 error.SetError(Status(std::move(e)));
166 return LLDB_RECORD_RESULT(error);
169 void SBDebugger::Terminate() {
170 LLDB_RECORD_STATIC_METHOD_NO_ARGS(void, SBDebugger, Terminate);
172 g_debugger_lifetime->Terminate();
175 void SBDebugger::Clear() {
176 LLDB_RECORD_METHOD_NO_ARGS(void, SBDebugger, Clear);
179 m_opaque_sp->ClearIOHandlers();
184 SBDebugger SBDebugger::Create() {
185 LLDB_RECORD_STATIC_METHOD_NO_ARGS(lldb::SBDebugger, SBDebugger, Create);
187 return LLDB_RECORD_RESULT(SBDebugger::Create(false, nullptr, nullptr));
190 SBDebugger SBDebugger::Create(bool source_init_files) {
191 LLDB_RECORD_STATIC_METHOD(lldb::SBDebugger, SBDebugger, Create, (bool),
194 return LLDB_RECORD_RESULT(
195 SBDebugger::Create(source_init_files, nullptr, nullptr));
198 SBDebugger SBDebugger::Create(bool source_init_files,
199 lldb::LogOutputCallback callback, void *baton)
202 LLDB_RECORD_DUMMY(lldb::SBDebugger, SBDebugger, Create,
203 (bool, lldb::LogOutputCallback, void *), source_init_files,
208 // Currently we have issues if this function is called simultaneously on two
209 // different threads. The issues mainly revolve around the fact that the
210 // lldb_private::FormatManager uses global collections and having two threads
211 // parsing the .lldbinit files can cause mayhem. So to get around this for
212 // now we need to use a mutex to prevent bad things from happening.
213 static std::recursive_mutex g_mutex;
214 std::lock_guard<std::recursive_mutex> guard(g_mutex);
216 debugger.reset(Debugger::CreateInstance(callback, baton));
218 SBCommandInterpreter interp = debugger.GetCommandInterpreter();
219 if (source_init_files) {
220 interp.get()->SkipLLDBInitFiles(false);
221 interp.get()->SkipAppInitFiles(false);
222 SBCommandReturnObject result;
223 interp.SourceInitFileInHomeDirectory(result);
225 interp.get()->SkipLLDBInitFiles(true);
226 interp.get()->SkipAppInitFiles(true);
231 void SBDebugger::Destroy(SBDebugger &debugger) {
232 LLDB_RECORD_STATIC_METHOD(void, SBDebugger, Destroy, (lldb::SBDebugger &),
235 Debugger::Destroy(debugger.m_opaque_sp);
237 if (debugger.m_opaque_sp.get() != nullptr)
238 debugger.m_opaque_sp.reset();
241 void SBDebugger::MemoryPressureDetected() {
242 LLDB_RECORD_STATIC_METHOD_NO_ARGS(void, SBDebugger, MemoryPressureDetected);
244 // Since this function can be call asynchronously, we allow it to be non-
245 // mandatory. We have seen deadlocks with this function when called so we
246 // need to safeguard against this until we can determine what is causing the
249 const bool mandatory = false;
251 ModuleList::RemoveOrphanSharedModules(mandatory);
254 bool SBDebugger::IsValid() const {
255 LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBDebugger, IsValid);
256 return this->operator bool();
258 SBDebugger::operator bool() const {
259 LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBDebugger, operator bool);
261 return m_opaque_sp.get() != nullptr;
264 void SBDebugger::SetAsync(bool b) {
265 LLDB_RECORD_METHOD(void, SBDebugger, SetAsync, (bool), b);
268 m_opaque_sp->SetAsyncExecution(b);
271 bool SBDebugger::GetAsync() {
272 LLDB_RECORD_METHOD_NO_ARGS(bool, SBDebugger, GetAsync);
274 return (m_opaque_sp ? m_opaque_sp->GetAsyncExecution() : false);
277 void SBDebugger::SkipLLDBInitFiles(bool b) {
278 LLDB_RECORD_METHOD(void, SBDebugger, SkipLLDBInitFiles, (bool), b);
281 m_opaque_sp->GetCommandInterpreter().SkipLLDBInitFiles(b);
284 void SBDebugger::SkipAppInitFiles(bool b) {
285 LLDB_RECORD_METHOD(void, SBDebugger, SkipAppInitFiles, (bool), b);
288 m_opaque_sp->GetCommandInterpreter().SkipAppInitFiles(b);
291 void SBDebugger::SetInputFileHandle(FILE *fh, bool transfer_ownership) {
292 LLDB_RECORD_METHOD(void, SBDebugger, SetInputFileHandle, (FILE *, bool), fh,
294 SetInputFile((FileSP)std::make_shared<NativeFile>(fh, transfer_ownership));
297 SBError SBDebugger::SetInputFile(FileSP file_sp) {
298 LLDB_RECORD_METHOD(SBError, SBDebugger, SetInputFile, (FileSP), file_sp);
299 return LLDB_RECORD_RESULT(SetInputFile(SBFile(file_sp)));
302 // Shouldn't really be settable after initialization as this could cause lots
303 // of problems; don't want users trying to switch modes in the middle of a
304 // debugging session.
305 SBError SBDebugger::SetInputFile(SBFile file) {
306 LLDB_RECORD_METHOD(SBError, SBDebugger, SetInputFile, (SBFile), file);
310 error.ref().SetErrorString("invalid debugger");
311 return LLDB_RECORD_RESULT(error);
314 repro::DataRecorder *recorder = nullptr;
315 if (repro::Generator *g = repro::Reproducer::Instance().GetGenerator())
316 recorder = g->GetOrCreate<repro::CommandProvider>().GetNewRecorder();
318 FileSP file_sp = file.m_opaque_sp;
320 static std::unique_ptr<repro::MultiLoader<repro::CommandProvider>> loader =
321 repro::MultiLoader<repro::CommandProvider>::Create(
322 repro::Reproducer::Instance().GetLoader());
324 llvm::Optional<std::string> nextfile = loader->GetNextFile();
325 FILE *fh = nextfile ? FileSystem::Instance().Fopen(nextfile->c_str(), "r")
327 // FIXME Jonas Devlieghere: shouldn't this error be propagated out to the
328 // reproducer somehow if fh is NULL?
330 file_sp = std::make_shared<NativeFile>(fh, true);
334 if (!file_sp || !file_sp->IsValid()) {
335 error.ref().SetErrorString("invalid file");
336 return LLDB_RECORD_RESULT(error);
339 m_opaque_sp->SetInputFile(file_sp, recorder);
340 return LLDB_RECORD_RESULT(error);
343 SBError SBDebugger::SetOutputFile(FileSP file_sp) {
344 LLDB_RECORD_METHOD(SBError, SBDebugger, SetOutputFile, (FileSP), file_sp);
345 return LLDB_RECORD_RESULT(SetOutputFile(SBFile(file_sp)));
348 void SBDebugger::SetOutputFileHandle(FILE *fh, bool transfer_ownership) {
349 LLDB_RECORD_METHOD(void, SBDebugger, SetOutputFileHandle, (FILE *, bool), fh,
351 SetOutputFile((FileSP)std::make_shared<NativeFile>(fh, transfer_ownership));
354 SBError SBDebugger::SetOutputFile(SBFile file) {
355 LLDB_RECORD_METHOD(SBError, SBDebugger, SetOutputFile, (SBFile file), file);
358 error.ref().SetErrorString("invalid debugger");
359 return LLDB_RECORD_RESULT(error);
362 error.ref().SetErrorString("invalid file");
363 return LLDB_RECORD_RESULT(error);
365 m_opaque_sp->SetOutputFile(file.m_opaque_sp);
366 return LLDB_RECORD_RESULT(error);
369 void SBDebugger::SetErrorFileHandle(FILE *fh, bool transfer_ownership) {
370 LLDB_RECORD_METHOD(void, SBDebugger, SetErrorFileHandle, (FILE *, bool), fh,
372 SetErrorFile((FileSP)std::make_shared<NativeFile>(fh, transfer_ownership));
375 SBError SBDebugger::SetErrorFile(FileSP file_sp) {
376 LLDB_RECORD_METHOD(SBError, SBDebugger, SetErrorFile, (FileSP), file_sp);
377 return LLDB_RECORD_RESULT(SetErrorFile(SBFile(file_sp)));
380 SBError SBDebugger::SetErrorFile(SBFile file) {
381 LLDB_RECORD_METHOD(SBError, SBDebugger, SetErrorFile, (SBFile file), file);
384 error.ref().SetErrorString("invalid debugger");
385 return LLDB_RECORD_RESULT(error);
388 error.ref().SetErrorString("invalid file");
389 return LLDB_RECORD_RESULT(error);
391 m_opaque_sp->SetErrorFile(file.m_opaque_sp);
392 return LLDB_RECORD_RESULT(error);
395 FILE *SBDebugger::GetInputFileHandle() {
396 LLDB_RECORD_METHOD_NO_ARGS(FILE *, SBDebugger, GetInputFileHandle);
398 File &file_sp = m_opaque_sp->GetInputFile();
399 return LLDB_RECORD_RESULT(file_sp.GetStream());
401 return LLDB_RECORD_RESULT(nullptr);
404 SBFile SBDebugger::GetInputFile() {
405 LLDB_RECORD_METHOD_NO_ARGS(SBFile, SBDebugger, GetInputFile);
407 return LLDB_RECORD_RESULT(SBFile(m_opaque_sp->GetInputFileSP()));
409 return LLDB_RECORD_RESULT(SBFile());
412 FILE *SBDebugger::GetOutputFileHandle() {
413 LLDB_RECORD_METHOD_NO_ARGS(FILE *, SBDebugger, GetOutputFileHandle);
415 StreamFile &stream_file = m_opaque_sp->GetOutputStream();
416 return LLDB_RECORD_RESULT(stream_file.GetFile().GetStream());
418 return LLDB_RECORD_RESULT(nullptr);
421 SBFile SBDebugger::GetOutputFile() {
422 LLDB_RECORD_METHOD_NO_ARGS(SBFile, SBDebugger, GetOutputFile);
424 SBFile file(m_opaque_sp->GetOutputStream().GetFileSP());
425 return LLDB_RECORD_RESULT(file);
427 return LLDB_RECORD_RESULT(SBFile());
430 FILE *SBDebugger::GetErrorFileHandle() {
431 LLDB_RECORD_METHOD_NO_ARGS(FILE *, SBDebugger, GetErrorFileHandle);
434 StreamFile &stream_file = m_opaque_sp->GetErrorStream();
435 return LLDB_RECORD_RESULT(stream_file.GetFile().GetStream());
437 return LLDB_RECORD_RESULT(nullptr);
440 SBFile SBDebugger::GetErrorFile() {
441 LLDB_RECORD_METHOD_NO_ARGS(SBFile, SBDebugger, GetErrorFile);
444 SBFile file(m_opaque_sp->GetErrorStream().GetFileSP());
445 return LLDB_RECORD_RESULT(file);
447 return LLDB_RECORD_RESULT(SBFile());
450 void SBDebugger::SaveInputTerminalState() {
451 LLDB_RECORD_DUMMY_NO_ARGS(void, SBDebugger, SaveInputTerminalState);
454 m_opaque_sp->SaveInputTerminalState();
457 void SBDebugger::RestoreInputTerminalState() {
458 LLDB_RECORD_DUMMY_NO_ARGS(void, SBDebugger, RestoreInputTerminalState);
461 m_opaque_sp->RestoreInputTerminalState();
463 SBCommandInterpreter SBDebugger::GetCommandInterpreter() {
464 LLDB_RECORD_METHOD_NO_ARGS(lldb::SBCommandInterpreter, SBDebugger,
465 GetCommandInterpreter);
467 SBCommandInterpreter sb_interpreter;
469 sb_interpreter.reset(&m_opaque_sp->GetCommandInterpreter());
471 return LLDB_RECORD_RESULT(sb_interpreter);
474 void SBDebugger::HandleCommand(const char *command) {
475 LLDB_RECORD_METHOD(void, SBDebugger, HandleCommand, (const char *), command);
478 TargetSP target_sp(m_opaque_sp->GetSelectedTarget());
479 std::unique_lock<std::recursive_mutex> lock;
481 lock = std::unique_lock<std::recursive_mutex>(target_sp->GetAPIMutex());
483 SBCommandInterpreter sb_interpreter(GetCommandInterpreter());
484 SBCommandReturnObject result;
486 sb_interpreter.HandleCommand(command, result, false);
488 result.PutError(m_opaque_sp->GetErrorStream().GetFileSP());
489 result.PutOutput(m_opaque_sp->GetOutputStream().GetFileSP());
491 if (!m_opaque_sp->GetAsyncExecution()) {
492 SBProcess process(GetCommandInterpreter().GetProcess());
493 ProcessSP process_sp(process.GetSP());
496 ListenerSP lldb_listener_sp = m_opaque_sp->GetListener();
497 while (lldb_listener_sp->GetEventForBroadcaster(
498 process_sp.get(), event_sp, std::chrono::seconds(0))) {
499 SBEvent event(event_sp);
500 HandleProcessEvent(process, event, GetOutputFile(), GetErrorFile());
507 SBListener SBDebugger::GetListener() {
508 LLDB_RECORD_METHOD_NO_ARGS(lldb::SBListener, SBDebugger, GetListener);
510 SBListener sb_listener;
512 sb_listener.reset(m_opaque_sp->GetListener());
514 return LLDB_RECORD_RESULT(sb_listener);
517 void SBDebugger::HandleProcessEvent(const SBProcess &process,
518 const SBEvent &event, SBFile out,
521 void, SBDebugger, HandleProcessEvent,
522 (const lldb::SBProcess &, const lldb::SBEvent &, SBFile, SBFile), process,
525 return HandleProcessEvent(process, event, out.m_opaque_sp, err.m_opaque_sp);
528 void SBDebugger::HandleProcessEvent(const SBProcess &process,
529 const SBEvent &event, FILE *out,
532 void, SBDebugger, HandleProcessEvent,
533 (const lldb::SBProcess &, const lldb::SBEvent &, FILE *, FILE *), process,
536 FileSP outfile = std::make_shared<NativeFile>(out, false);
537 FileSP errfile = std::make_shared<NativeFile>(err, false);
538 return HandleProcessEvent(process, event, outfile, errfile);
541 void SBDebugger::HandleProcessEvent(const SBProcess &process,
542 const SBEvent &event, FileSP out_sp,
546 void, SBDebugger, HandleProcessEvent,
547 (const lldb::SBProcess &, const lldb::SBEvent &, FileSP, FileSP), process,
548 event, out_sp, err_sp);
550 if (!process.IsValid())
553 TargetSP target_sp(process.GetTarget().GetSP());
557 const uint32_t event_type = event.GetType();
558 char stdio_buffer[1024];
561 std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
564 (Process::eBroadcastBitSTDOUT | Process::eBroadcastBitStateChanged)) {
565 // Drain stdout when we stop just in case we have any bytes
566 while ((len = process.GetSTDOUT(stdio_buffer, sizeof(stdio_buffer))) > 0)
568 out_sp->Write(stdio_buffer, len);
572 (Process::eBroadcastBitSTDERR | Process::eBroadcastBitStateChanged)) {
573 // Drain stderr when we stop just in case we have any bytes
574 while ((len = process.GetSTDERR(stdio_buffer, sizeof(stdio_buffer))) > 0)
576 err_sp->Write(stdio_buffer, len);
579 if (event_type & Process::eBroadcastBitStateChanged) {
580 StateType event_state = SBProcess::GetStateFromEvent(event);
582 if (event_state == eStateInvalid)
585 bool is_stopped = StateIsStoppedState(event_state);
587 process.ReportEventState(event, out_sp);
591 SBSourceManager SBDebugger::GetSourceManager() {
592 LLDB_RECORD_METHOD_NO_ARGS(lldb::SBSourceManager, SBDebugger,
595 SBSourceManager sb_source_manager(*this);
596 return LLDB_RECORD_RESULT(sb_source_manager);
599 bool SBDebugger::GetDefaultArchitecture(char *arch_name, size_t arch_name_len) {
600 LLDB_RECORD_CHAR_PTR_STATIC_METHOD(bool, SBDebugger, GetDefaultArchitecture,
601 (char *, size_t), arch_name, "",
604 if (arch_name && arch_name_len) {
605 ArchSpec default_arch = Target::GetDefaultArchitecture();
607 if (default_arch.IsValid()) {
608 const std::string &triple_str = default_arch.GetTriple().str();
609 if (!triple_str.empty())
610 ::snprintf(arch_name, arch_name_len, "%s", triple_str.c_str());
612 ::snprintf(arch_name, arch_name_len, "%s",
613 default_arch.GetArchitectureName());
617 if (arch_name && arch_name_len)
622 bool SBDebugger::SetDefaultArchitecture(const char *arch_name) {
623 LLDB_RECORD_STATIC_METHOD(bool, SBDebugger, SetDefaultArchitecture,
624 (const char *), arch_name);
627 ArchSpec arch(arch_name);
628 if (arch.IsValid()) {
629 Target::SetDefaultArchitecture(arch);
637 SBDebugger::GetScriptingLanguage(const char *script_language_name) {
638 LLDB_RECORD_METHOD(lldb::ScriptLanguage, SBDebugger, GetScriptingLanguage,
639 (const char *), script_language_name);
641 if (!script_language_name)
642 return eScriptLanguageDefault;
643 return OptionArgParser::ToScriptLanguage(
644 llvm::StringRef(script_language_name), eScriptLanguageDefault, nullptr);
647 const char *SBDebugger::GetVersionString() {
648 LLDB_RECORD_STATIC_METHOD_NO_ARGS(const char *, SBDebugger, GetVersionString);
650 return lldb_private::GetVersion();
653 const char *SBDebugger::StateAsCString(StateType state) {
654 LLDB_RECORD_STATIC_METHOD(const char *, SBDebugger, StateAsCString,
655 (lldb::StateType), state);
657 return lldb_private::StateAsCString(state);
660 static void AddBoolConfigEntry(StructuredData::Dictionary &dict,
661 llvm::StringRef name, bool value,
662 llvm::StringRef description) {
663 auto entry_up = std::make_unique<StructuredData::Dictionary>();
664 entry_up->AddBooleanItem("value", value);
665 entry_up->AddStringItem("description", description);
666 dict.AddItem(name, std::move(entry_up));
669 static void AddLLVMTargets(StructuredData::Dictionary &dict) {
670 auto array_up = std::make_unique<StructuredData::Array>();
671 #define LLVM_TARGET(target) \
672 array_up->AddItem(std::make_unique<StructuredData::String>(#target));
673 #include "llvm/Config/Targets.def"
674 auto entry_up = std::make_unique<StructuredData::Dictionary>();
675 entry_up->AddItem("value", std::move(array_up));
676 entry_up->AddStringItem("description", "A list of configured LLVM targets.");
677 dict.AddItem("targets", std::move(entry_up));
680 SBStructuredData SBDebugger::GetBuildConfiguration() {
681 LLDB_RECORD_STATIC_METHOD_NO_ARGS(lldb::SBStructuredData, SBDebugger,
682 GetBuildConfiguration);
684 auto config_up = std::make_unique<StructuredData::Dictionary>();
686 *config_up, "xml", XMLDocument::XMLEnabled(),
687 "A boolean value that indicates if XML support is enabled in LLDB");
689 *config_up, "curses", LLDB_ENABLE_CURSES,
690 "A boolean value that indicates if curses support is enabled in LLDB");
692 *config_up, "editline", LLDB_ENABLE_LIBEDIT,
693 "A boolean value that indicates if editline support is enabled in LLDB");
695 *config_up, "lzma", LLDB_ENABLE_LZMA,
696 "A boolean value that indicates if lzma support is enabled in LLDB");
698 *config_up, "python", LLDB_ENABLE_PYTHON,
699 "A boolean value that indicates if python support is enabled in LLDB");
701 *config_up, "lua", LLDB_ENABLE_LUA,
702 "A boolean value that indicates if lua support is enabled in LLDB");
703 AddLLVMTargets(*config_up);
705 SBStructuredData data;
706 data.m_impl_up->SetObjectSP(std::move(config_up));
707 return LLDB_RECORD_RESULT(data);
710 bool SBDebugger::StateIsRunningState(StateType state) {
711 LLDB_RECORD_STATIC_METHOD(bool, SBDebugger, StateIsRunningState,
712 (lldb::StateType), state);
714 const bool result = lldb_private::StateIsRunningState(state);
719 bool SBDebugger::StateIsStoppedState(StateType state) {
720 LLDB_RECORD_STATIC_METHOD(bool, SBDebugger, StateIsStoppedState,
721 (lldb::StateType), state);
723 const bool result = lldb_private::StateIsStoppedState(state, false);
728 lldb::SBTarget SBDebugger::CreateTarget(const char *filename,
729 const char *target_triple,
730 const char *platform_name,
731 bool add_dependent_modules,
732 lldb::SBError &sb_error) {
734 lldb::SBTarget, SBDebugger, CreateTarget,
735 (const char *, const char *, const char *, bool, lldb::SBError &),
736 filename, target_triple, platform_name, add_dependent_modules, sb_error);
742 OptionGroupPlatform platform_options(false);
743 platform_options.SetPlatformName(platform_name);
745 sb_error.ref() = m_opaque_sp->GetTargetList().CreateTarget(
746 *m_opaque_sp, filename, target_triple,
747 add_dependent_modules ? eLoadDependentsYes : eLoadDependentsNo,
748 &platform_options, target_sp);
750 if (sb_error.Success())
751 sb_target.SetSP(target_sp);
753 sb_error.SetErrorString("invalid debugger");
756 Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
758 "SBDebugger(%p)::CreateTarget (filename=\"%s\", triple=%s, "
759 "platform_name=%s, add_dependent_modules=%u, error=%s) => "
761 static_cast<void *>(m_opaque_sp.get()), filename, target_triple,
762 platform_name, add_dependent_modules, sb_error.GetCString(),
763 static_cast<void *>(target_sp.get()));
765 return LLDB_RECORD_RESULT(sb_target);
769 SBDebugger::CreateTargetWithFileAndTargetTriple(const char *filename,
770 const char *target_triple) {
771 LLDB_RECORD_METHOD(lldb::SBTarget, SBDebugger,
772 CreateTargetWithFileAndTargetTriple,
773 (const char *, const char *), filename, target_triple);
778 const bool add_dependent_modules = true;
779 Status error(m_opaque_sp->GetTargetList().CreateTarget(
780 *m_opaque_sp, filename, target_triple,
781 add_dependent_modules ? eLoadDependentsYes : eLoadDependentsNo, nullptr,
783 sb_target.SetSP(target_sp);
786 Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
788 "SBDebugger(%p)::CreateTargetWithFileAndTargetTriple "
789 "(filename=\"%s\", triple=%s) => SBTarget(%p)",
790 static_cast<void *>(m_opaque_sp.get()), filename, target_triple,
791 static_cast<void *>(target_sp.get()));
793 return LLDB_RECORD_RESULT(sb_target);
796 SBTarget SBDebugger::CreateTargetWithFileAndArch(const char *filename,
797 const char *arch_cstr) {
798 LLDB_RECORD_METHOD(lldb::SBTarget, SBDebugger, CreateTargetWithFileAndArch,
799 (const char *, const char *), filename, arch_cstr);
801 Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
807 const bool add_dependent_modules = true;
809 error = m_opaque_sp->GetTargetList().CreateTarget(
810 *m_opaque_sp, filename, arch_cstr,
811 add_dependent_modules ? eLoadDependentsYes : eLoadDependentsNo, nullptr,
814 if (error.Success()) {
815 m_opaque_sp->GetTargetList().SetSelectedTarget(target_sp.get());
816 sb_target.SetSP(target_sp);
821 "SBDebugger(%p)::CreateTargetWithFileAndArch (filename=\"%s\", "
822 "arch=%s) => SBTarget(%p)",
823 static_cast<void *>(m_opaque_sp.get()), filename, arch_cstr,
824 static_cast<void *>(target_sp.get()));
826 return LLDB_RECORD_RESULT(sb_target);
829 SBTarget SBDebugger::CreateTarget(const char *filename) {
830 LLDB_RECORD_METHOD(lldb::SBTarget, SBDebugger, CreateTarget, (const char *),
837 const bool add_dependent_modules = true;
838 error = m_opaque_sp->GetTargetList().CreateTarget(
839 *m_opaque_sp, filename, "",
840 add_dependent_modules ? eLoadDependentsYes : eLoadDependentsNo, nullptr,
843 if (error.Success()) {
844 m_opaque_sp->GetTargetList().SetSelectedTarget(target_sp.get());
845 sb_target.SetSP(target_sp);
848 Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
850 "SBDebugger(%p)::CreateTarget (filename=\"%s\") => SBTarget(%p)",
851 static_cast<void *>(m_opaque_sp.get()), filename,
852 static_cast<void *>(target_sp.get()));
853 return LLDB_RECORD_RESULT(sb_target);
856 SBTarget SBDebugger::GetDummyTarget() {
857 LLDB_RECORD_METHOD_NO_ARGS(lldb::SBTarget, SBDebugger, GetDummyTarget);
861 sb_target.SetSP(m_opaque_sp->GetDummyTarget()->shared_from_this());
863 Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
864 LLDB_LOGF(log, "SBDebugger(%p)::GetDummyTarget() => SBTarget(%p)",
865 static_cast<void *>(m_opaque_sp.get()),
866 static_cast<void *>(sb_target.GetSP().get()));
867 return LLDB_RECORD_RESULT(sb_target);
870 bool SBDebugger::DeleteTarget(lldb::SBTarget &target) {
871 LLDB_RECORD_METHOD(bool, SBDebugger, DeleteTarget, (lldb::SBTarget &),
876 TargetSP target_sp(target.GetSP());
878 // No need to lock, the target list is thread safe
879 result = m_opaque_sp->GetTargetList().DeleteTarget(target_sp);
880 target_sp->Destroy();
882 const bool mandatory = true;
883 ModuleList::RemoveOrphanSharedModules(mandatory);
887 Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
888 LLDB_LOGF(log, "SBDebugger(%p)::DeleteTarget (SBTarget(%p)) => %i",
889 static_cast<void *>(m_opaque_sp.get()),
890 static_cast<void *>(target.m_opaque_sp.get()), result);
895 SBTarget SBDebugger::GetTargetAtIndex(uint32_t idx) {
896 LLDB_RECORD_METHOD(lldb::SBTarget, SBDebugger, GetTargetAtIndex, (uint32_t),
901 // No need to lock, the target list is thread safe
902 sb_target.SetSP(m_opaque_sp->GetTargetList().GetTargetAtIndex(idx));
904 return LLDB_RECORD_RESULT(sb_target);
907 uint32_t SBDebugger::GetIndexOfTarget(lldb::SBTarget target) {
908 LLDB_RECORD_METHOD(uint32_t, SBDebugger, GetIndexOfTarget, (lldb::SBTarget),
911 lldb::TargetSP target_sp = target.GetSP();
918 return m_opaque_sp->GetTargetList().GetIndexOfTarget(target.GetSP());
921 SBTarget SBDebugger::FindTargetWithProcessID(lldb::pid_t pid) {
922 LLDB_RECORD_METHOD(lldb::SBTarget, SBDebugger, FindTargetWithProcessID,
927 // No need to lock, the target list is thread safe
928 sb_target.SetSP(m_opaque_sp->GetTargetList().FindTargetWithProcessID(pid));
930 return LLDB_RECORD_RESULT(sb_target);
933 SBTarget SBDebugger::FindTargetWithFileAndArch(const char *filename,
934 const char *arch_name) {
935 LLDB_RECORD_METHOD(lldb::SBTarget, SBDebugger, FindTargetWithFileAndArch,
936 (const char *, const char *), filename, arch_name);
939 if (m_opaque_sp && filename && filename[0]) {
940 // No need to lock, the target list is thread safe
941 ArchSpec arch = Platform::GetAugmentedArchSpec(
942 m_opaque_sp->GetPlatformList().GetSelectedPlatform().get(), arch_name);
944 m_opaque_sp->GetTargetList().FindTargetWithExecutableAndArchitecture(
945 FileSpec(filename), arch_name ? &arch : nullptr));
946 sb_target.SetSP(target_sp);
948 return LLDB_RECORD_RESULT(sb_target);
951 SBTarget SBDebugger::FindTargetWithLLDBProcess(const ProcessSP &process_sp) {
954 // No need to lock, the target list is thread safe
956 m_opaque_sp->GetTargetList().FindTargetWithProcess(process_sp.get()));
961 uint32_t SBDebugger::GetNumTargets() {
962 LLDB_RECORD_METHOD_NO_ARGS(uint32_t, SBDebugger, GetNumTargets);
965 // No need to lock, the target list is thread safe
966 return m_opaque_sp->GetTargetList().GetNumTargets();
971 SBTarget SBDebugger::GetSelectedTarget() {
972 LLDB_RECORD_METHOD_NO_ARGS(lldb::SBTarget, SBDebugger, GetSelectedTarget);
974 Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
979 // No need to lock, the target list is thread safe
980 target_sp = m_opaque_sp->GetTargetList().GetSelectedTarget();
981 sb_target.SetSP(target_sp);
986 sb_target.GetDescription(sstr, eDescriptionLevelBrief);
987 LLDB_LOGF(log, "SBDebugger(%p)::GetSelectedTarget () => SBTarget(%p): %s",
988 static_cast<void *>(m_opaque_sp.get()),
989 static_cast<void *>(target_sp.get()), sstr.GetData());
992 return LLDB_RECORD_RESULT(sb_target);
995 void SBDebugger::SetSelectedTarget(SBTarget &sb_target) {
996 LLDB_RECORD_METHOD(void, SBDebugger, SetSelectedTarget, (lldb::SBTarget &),
999 Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
1001 TargetSP target_sp(sb_target.GetSP());
1003 m_opaque_sp->GetTargetList().SetSelectedTarget(target_sp.get());
1007 sb_target.GetDescription(sstr, eDescriptionLevelBrief);
1008 LLDB_LOGF(log, "SBDebugger(%p)::SetSelectedTarget () => SBTarget(%p): %s",
1009 static_cast<void *>(m_opaque_sp.get()),
1010 static_cast<void *>(target_sp.get()), sstr.GetData());
1014 SBPlatform SBDebugger::GetSelectedPlatform() {
1015 LLDB_RECORD_METHOD_NO_ARGS(lldb::SBPlatform, SBDebugger, GetSelectedPlatform);
1017 Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
1019 SBPlatform sb_platform;
1020 DebuggerSP debugger_sp(m_opaque_sp);
1022 sb_platform.SetSP(debugger_sp->GetPlatformList().GetSelectedPlatform());
1024 LLDB_LOGF(log, "SBDebugger(%p)::GetSelectedPlatform () => SBPlatform(%p): %s",
1025 static_cast<void *>(m_opaque_sp.get()),
1026 static_cast<void *>(sb_platform.GetSP().get()),
1027 sb_platform.GetName());
1028 return LLDB_RECORD_RESULT(sb_platform);
1031 void SBDebugger::SetSelectedPlatform(SBPlatform &sb_platform) {
1032 LLDB_RECORD_METHOD(void, SBDebugger, SetSelectedPlatform,
1033 (lldb::SBPlatform &), sb_platform);
1035 Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
1037 DebuggerSP debugger_sp(m_opaque_sp);
1039 debugger_sp->GetPlatformList().SetSelectedPlatform(sb_platform.GetSP());
1042 LLDB_LOGF(log, "SBDebugger(%p)::SetSelectedPlatform (SBPlatform(%p) %s)",
1043 static_cast<void *>(m_opaque_sp.get()),
1044 static_cast<void *>(sb_platform.GetSP().get()),
1045 sb_platform.GetName());
1048 uint32_t SBDebugger::GetNumPlatforms() {
1049 LLDB_RECORD_METHOD_NO_ARGS(uint32_t, SBDebugger, GetNumPlatforms);
1052 // No need to lock, the platform list is thread safe
1053 return m_opaque_sp->GetPlatformList().GetSize();
1058 SBPlatform SBDebugger::GetPlatformAtIndex(uint32_t idx) {
1059 LLDB_RECORD_METHOD(lldb::SBPlatform, SBDebugger, GetPlatformAtIndex,
1062 SBPlatform sb_platform;
1064 // No need to lock, the platform list is thread safe
1065 sb_platform.SetSP(m_opaque_sp->GetPlatformList().GetAtIndex(idx));
1067 return LLDB_RECORD_RESULT(sb_platform);
1070 uint32_t SBDebugger::GetNumAvailablePlatforms() {
1071 LLDB_RECORD_METHOD_NO_ARGS(uint32_t, SBDebugger, GetNumAvailablePlatforms);
1075 if (!PluginManager::GetPlatformPluginNameAtIndex(idx)) {
1080 // +1 for the host platform, which should always appear first in the list.
1084 SBStructuredData SBDebugger::GetAvailablePlatformInfoAtIndex(uint32_t idx) {
1085 LLDB_RECORD_METHOD(lldb::SBStructuredData, SBDebugger,
1086 GetAvailablePlatformInfoAtIndex, (uint32_t), idx);
1088 SBStructuredData data;
1089 auto platform_dict = std::make_unique<StructuredData::Dictionary>();
1090 llvm::StringRef name_str("name"), desc_str("description");
1093 PlatformSP host_platform_sp(Platform::GetHostPlatform());
1094 platform_dict->AddStringItem(
1095 name_str, host_platform_sp->GetPluginName().GetStringRef());
1096 platform_dict->AddStringItem(
1097 desc_str, llvm::StringRef(host_platform_sp->GetDescription()));
1098 } else if (idx > 0) {
1099 const char *plugin_name =
1100 PluginManager::GetPlatformPluginNameAtIndex(idx - 1);
1102 return LLDB_RECORD_RESULT(data);
1104 platform_dict->AddStringItem(name_str, llvm::StringRef(plugin_name));
1106 const char *plugin_desc =
1107 PluginManager::GetPlatformPluginDescriptionAtIndex(idx - 1);
1109 return LLDB_RECORD_RESULT(data);
1111 platform_dict->AddStringItem(desc_str, llvm::StringRef(plugin_desc));
1114 data.m_impl_up->SetObjectSP(
1115 StructuredData::ObjectSP(platform_dict.release()));
1116 return LLDB_RECORD_RESULT(data);
1119 void SBDebugger::DispatchInput(void *baton, const void *data, size_t data_len) {
1120 LLDB_RECORD_DUMMY(void, SBDebugger, DispatchInput,
1121 (void *, const void *, size_t), baton, data, data_len);
1123 DispatchInput(data, data_len);
1126 void SBDebugger::DispatchInput(const void *data, size_t data_len) {
1127 LLDB_RECORD_DUMMY(void, SBDebugger, DispatchInput, (const void *, size_t),
1130 // Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
1133 // LLDB_LOGF(log, "SBDebugger(%p)::DispatchInput (data=\"%.*s\",
1134 // size_t=%" PRIu64 ")",
1135 // m_opaque_sp.get(),
1137 // (const char *) data,
1138 // (uint64_t)data_len);
1141 // m_opaque_sp->DispatchInput ((const char *) data, data_len);
1144 void SBDebugger::DispatchInputInterrupt() {
1145 LLDB_RECORD_DUMMY_NO_ARGS(void, SBDebugger, DispatchInputInterrupt);
1148 m_opaque_sp->DispatchInputInterrupt();
1151 void SBDebugger::DispatchInputEndOfFile() {
1152 LLDB_RECORD_METHOD_NO_ARGS(void, SBDebugger, DispatchInputEndOfFile);
1155 m_opaque_sp->DispatchInputEndOfFile();
1158 void SBDebugger::PushInputReader(SBInputReader &reader) {
1159 LLDB_RECORD_METHOD(void, SBDebugger, PushInputReader, (lldb::SBInputReader &),
1163 void SBDebugger::RunCommandInterpreter(bool auto_handle_events,
1164 bool spawn_thread) {
1165 LLDB_RECORD_METHOD(void, SBDebugger, RunCommandInterpreter, (bool, bool),
1166 auto_handle_events, spawn_thread);
1169 CommandInterpreterRunOptions options;
1170 options.SetAutoHandleEvents(auto_handle_events);
1171 options.SetSpawnThread(spawn_thread);
1172 m_opaque_sp->GetCommandInterpreter().RunCommandInterpreter(options);
1176 void SBDebugger::RunCommandInterpreter(bool auto_handle_events,
1178 SBCommandInterpreterRunOptions &options,
1179 int &num_errors, bool &quit_requested,
1180 bool &stopped_for_crash)
1183 LLDB_RECORD_METHOD(void, SBDebugger, RunCommandInterpreter,
1184 (bool, bool, lldb::SBCommandInterpreterRunOptions &, int &,
1186 auto_handle_events, spawn_thread, options, num_errors,
1187 quit_requested, stopped_for_crash);
1190 options.SetAutoHandleEvents(auto_handle_events);
1191 options.SetSpawnThread(spawn_thread);
1192 CommandInterpreter &interp = m_opaque_sp->GetCommandInterpreter();
1193 CommandInterpreterRunResult result =
1194 interp.RunCommandInterpreter(options.ref());
1195 num_errors = result.GetNumErrors();
1197 result.IsResult(lldb::eCommandInterpreterResultQuitRequested);
1199 result.IsResult(lldb::eCommandInterpreterResultInferiorCrash);
1203 SBCommandInterpreterRunResult SBDebugger::RunCommandInterpreter(
1204 const SBCommandInterpreterRunOptions &options) {
1205 LLDB_RECORD_METHOD(lldb::SBCommandInterpreterRunResult, SBDebugger,
1206 RunCommandInterpreter,
1207 (const lldb::SBCommandInterpreterRunOptions &), options);
1210 return LLDB_RECORD_RESULT(SBCommandInterpreterRunResult());
1212 CommandInterpreter &interp = m_opaque_sp->GetCommandInterpreter();
1213 CommandInterpreterRunResult result =
1214 interp.RunCommandInterpreter(options.ref());
1216 return LLDB_RECORD_RESULT(SBCommandInterpreterRunResult(result));
1219 SBError SBDebugger::RunREPL(lldb::LanguageType language,
1220 const char *repl_options) {
1221 LLDB_RECORD_METHOD(lldb::SBError, SBDebugger, RunREPL,
1222 (lldb::LanguageType, const char *), language,
1227 error.ref() = m_opaque_sp->RunREPL(language, repl_options);
1229 error.SetErrorString("invalid debugger");
1230 return LLDB_RECORD_RESULT(error);
1233 void SBDebugger::reset(const DebuggerSP &debugger_sp) {
1234 m_opaque_sp = debugger_sp;
1237 Debugger *SBDebugger::get() const { return m_opaque_sp.get(); }
1239 Debugger &SBDebugger::ref() const {
1240 assert(m_opaque_sp.get());
1241 return *m_opaque_sp;
1244 const lldb::DebuggerSP &SBDebugger::get_sp() const { return m_opaque_sp; }
1246 SBDebugger SBDebugger::FindDebuggerWithID(int id) {
1247 LLDB_RECORD_STATIC_METHOD(lldb::SBDebugger, SBDebugger, FindDebuggerWithID,
1250 // No need to lock, the debugger list is thread safe
1251 SBDebugger sb_debugger;
1252 DebuggerSP debugger_sp = Debugger::FindDebuggerWithID(id);
1254 sb_debugger.reset(debugger_sp);
1255 return LLDB_RECORD_RESULT(sb_debugger);
1258 const char *SBDebugger::GetInstanceName() {
1259 LLDB_RECORD_METHOD_NO_ARGS(const char *, SBDebugger, GetInstanceName);
1261 return (m_opaque_sp ? m_opaque_sp->GetInstanceName().AsCString() : nullptr);
1264 SBError SBDebugger::SetInternalVariable(const char *var_name, const char *value,
1265 const char *debugger_instance_name) {
1266 LLDB_RECORD_STATIC_METHOD(lldb::SBError, SBDebugger, SetInternalVariable,
1267 (const char *, const char *, const char *),
1268 var_name, value, debugger_instance_name);
1271 DebuggerSP debugger_sp(Debugger::FindDebuggerWithInstanceName(
1272 ConstString(debugger_instance_name)));
1275 ExecutionContext exe_ctx(
1276 debugger_sp->GetCommandInterpreter().GetExecutionContext());
1277 error = debugger_sp->SetPropertyValue(&exe_ctx, eVarSetOperationAssign,
1280 error.SetErrorStringWithFormat("invalid debugger instance name '%s'",
1281 debugger_instance_name);
1284 sb_error.SetError(error);
1285 return LLDB_RECORD_RESULT(sb_error);
1289 SBDebugger::GetInternalVariableValue(const char *var_name,
1290 const char *debugger_instance_name) {
1291 LLDB_RECORD_STATIC_METHOD(
1292 lldb::SBStringList, SBDebugger, GetInternalVariableValue,
1293 (const char *, const char *), var_name, debugger_instance_name);
1295 SBStringList ret_value;
1296 DebuggerSP debugger_sp(Debugger::FindDebuggerWithInstanceName(
1297 ConstString(debugger_instance_name)));
1300 ExecutionContext exe_ctx(
1301 debugger_sp->GetCommandInterpreter().GetExecutionContext());
1302 lldb::OptionValueSP value_sp(
1303 debugger_sp->GetPropertyValue(&exe_ctx, var_name, false, error));
1305 StreamString value_strm;
1306 value_sp->DumpValue(&exe_ctx, value_strm, OptionValue::eDumpOptionValue);
1307 const std::string &value_str = std::string(value_strm.GetString());
1308 if (!value_str.empty()) {
1309 StringList string_list;
1310 string_list.SplitIntoLines(value_str);
1311 return LLDB_RECORD_RESULT(SBStringList(&string_list));
1315 return LLDB_RECORD_RESULT(SBStringList());
1318 uint32_t SBDebugger::GetTerminalWidth() const {
1319 LLDB_RECORD_METHOD_CONST_NO_ARGS(uint32_t, SBDebugger, GetTerminalWidth);
1321 return (m_opaque_sp ? m_opaque_sp->GetTerminalWidth() : 0);
1324 void SBDebugger::SetTerminalWidth(uint32_t term_width) {
1325 LLDB_RECORD_DUMMY(void, SBDebugger, SetTerminalWidth, (uint32_t), term_width);
1328 m_opaque_sp->SetTerminalWidth(term_width);
1331 const char *SBDebugger::GetPrompt() const {
1332 LLDB_RECORD_METHOD_CONST_NO_ARGS(const char *, SBDebugger, GetPrompt);
1334 Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
1336 LLDB_LOGF(log, "SBDebugger(%p)::GetPrompt () => \"%s\"",
1337 static_cast<void *>(m_opaque_sp.get()),
1338 (m_opaque_sp ? m_opaque_sp->GetPrompt().str().c_str() : ""));
1340 return (m_opaque_sp ? ConstString(m_opaque_sp->GetPrompt()).GetCString()
1344 void SBDebugger::SetPrompt(const char *prompt) {
1345 LLDB_RECORD_METHOD(void, SBDebugger, SetPrompt, (const char *), prompt);
1348 m_opaque_sp->SetPrompt(llvm::StringRef::withNullAsEmpty(prompt));
1351 const char *SBDebugger::GetReproducerPath() const {
1352 LLDB_RECORD_METHOD_CONST_NO_ARGS(const char *, SBDebugger, GetReproducerPath);
1355 ? ConstString(m_opaque_sp->GetReproducerPath()).GetCString()
1359 ScriptLanguage SBDebugger::GetScriptLanguage() const {
1360 LLDB_RECORD_METHOD_CONST_NO_ARGS(lldb::ScriptLanguage, SBDebugger,
1363 return (m_opaque_sp ? m_opaque_sp->GetScriptLanguage() : eScriptLanguageNone);
1366 void SBDebugger::SetScriptLanguage(ScriptLanguage script_lang) {
1367 LLDB_RECORD_METHOD(void, SBDebugger, SetScriptLanguage,
1368 (lldb::ScriptLanguage), script_lang);
1371 m_opaque_sp->SetScriptLanguage(script_lang);
1375 bool SBDebugger::SetUseExternalEditor(bool value) {
1376 LLDB_RECORD_METHOD(bool, SBDebugger, SetUseExternalEditor, (bool), value);
1378 return (m_opaque_sp ? m_opaque_sp->SetUseExternalEditor(value) : false);
1381 bool SBDebugger::GetUseExternalEditor() {
1382 LLDB_RECORD_METHOD_NO_ARGS(bool, SBDebugger, GetUseExternalEditor);
1384 return (m_opaque_sp ? m_opaque_sp->GetUseExternalEditor() : false);
1387 bool SBDebugger::SetUseColor(bool value) {
1388 LLDB_RECORD_METHOD(bool, SBDebugger, SetUseColor, (bool), value);
1390 return (m_opaque_sp ? m_opaque_sp->SetUseColor(value) : false);
1393 bool SBDebugger::GetUseColor() const {
1394 LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBDebugger, GetUseColor);
1396 return (m_opaque_sp ? m_opaque_sp->GetUseColor() : false);
1399 bool SBDebugger::SetUseSourceCache(bool value) {
1400 LLDB_RECORD_METHOD(bool, SBDebugger, SetUseSourceCache, (bool), value);
1402 return (m_opaque_sp ? m_opaque_sp->SetUseSourceCache(value) : false);
1405 bool SBDebugger::GetUseSourceCache() const {
1406 LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBDebugger, GetUseSourceCache);
1408 return (m_opaque_sp ? m_opaque_sp->GetUseSourceCache() : false);
1411 bool SBDebugger::GetDescription(SBStream &description) {
1412 LLDB_RECORD_METHOD(bool, SBDebugger, GetDescription, (lldb::SBStream &),
1415 Stream &strm = description.ref();
1418 const char *name = m_opaque_sp->GetInstanceName().AsCString();
1419 user_id_t id = m_opaque_sp->GetID();
1420 strm.Printf("Debugger (instance: \"%s\", id: %" PRIu64 ")", name, id);
1422 strm.PutCString("No value");
1427 user_id_t SBDebugger::GetID() {
1428 LLDB_RECORD_METHOD_NO_ARGS(lldb::user_id_t, SBDebugger, GetID);
1430 return (m_opaque_sp ? m_opaque_sp->GetID() : LLDB_INVALID_UID);
1433 SBError SBDebugger::SetCurrentPlatform(const char *platform_name_cstr) {
1434 LLDB_RECORD_METHOD(lldb::SBError, SBDebugger, SetCurrentPlatform,
1435 (const char *), platform_name_cstr);
1439 if (platform_name_cstr && platform_name_cstr[0]) {
1440 ConstString platform_name(platform_name_cstr);
1441 PlatformSP platform_sp(Platform::Find(platform_name));
1444 // Already have a platform with this name, just select it
1445 m_opaque_sp->GetPlatformList().SetSelectedPlatform(platform_sp);
1447 // We don't have a platform by this name yet, create one
1448 platform_sp = Platform::Create(platform_name, sb_error.ref());
1450 // We created the platform, now append and select it
1451 bool make_selected = true;
1452 m_opaque_sp->GetPlatformList().Append(platform_sp, make_selected);
1456 sb_error.ref().SetErrorString("invalid platform name");
1459 sb_error.ref().SetErrorString("invalid debugger");
1461 return LLDB_RECORD_RESULT(sb_error);
1464 bool SBDebugger::SetCurrentPlatformSDKRoot(const char *sysroot) {
1465 LLDB_RECORD_METHOD(bool, SBDebugger, SetCurrentPlatformSDKRoot,
1466 (const char *), sysroot);
1468 Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
1470 PlatformSP platform_sp(
1471 m_opaque_sp->GetPlatformList().GetSelectedPlatform());
1475 LLDB_LOGF(log, "SBDebugger::SetCurrentPlatformSDKRoot (\"%s\")",
1477 platform_sp->SetSDKRootDirectory(ConstString(sysroot));
1484 bool SBDebugger::GetCloseInputOnEOF() const {
1485 LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBDebugger, GetCloseInputOnEOF);
1487 return (m_opaque_sp ? m_opaque_sp->GetCloseInputOnEOF() : false);
1490 void SBDebugger::SetCloseInputOnEOF(bool b) {
1491 LLDB_RECORD_METHOD(void, SBDebugger, SetCloseInputOnEOF, (bool), b);
1494 m_opaque_sp->SetCloseInputOnEOF(b);
1497 SBTypeCategory SBDebugger::GetCategory(const char *category_name) {
1498 LLDB_RECORD_METHOD(lldb::SBTypeCategory, SBDebugger, GetCategory,
1499 (const char *), category_name);
1501 if (!category_name || *category_name == 0)
1502 return LLDB_RECORD_RESULT(SBTypeCategory());
1504 TypeCategoryImplSP category_sp;
1506 if (DataVisualization::Categories::GetCategory(ConstString(category_name),
1507 category_sp, false)) {
1508 return LLDB_RECORD_RESULT(SBTypeCategory(category_sp));
1510 return LLDB_RECORD_RESULT(SBTypeCategory());
1514 SBTypeCategory SBDebugger::GetCategory(lldb::LanguageType lang_type) {
1515 LLDB_RECORD_METHOD(lldb::SBTypeCategory, SBDebugger, GetCategory,
1516 (lldb::LanguageType), lang_type);
1518 TypeCategoryImplSP category_sp;
1519 if (DataVisualization::Categories::GetCategory(lang_type, category_sp)) {
1520 return LLDB_RECORD_RESULT(SBTypeCategory(category_sp));
1522 return LLDB_RECORD_RESULT(SBTypeCategory());
1526 SBTypeCategory SBDebugger::CreateCategory(const char *category_name) {
1527 LLDB_RECORD_METHOD(lldb::SBTypeCategory, SBDebugger, CreateCategory,
1528 (const char *), category_name);
1530 if (!category_name || *category_name == 0)
1531 return LLDB_RECORD_RESULT(SBTypeCategory());
1533 TypeCategoryImplSP category_sp;
1535 if (DataVisualization::Categories::GetCategory(ConstString(category_name),
1536 category_sp, true)) {
1537 return LLDB_RECORD_RESULT(SBTypeCategory(category_sp));
1539 return LLDB_RECORD_RESULT(SBTypeCategory());
1543 bool SBDebugger::DeleteCategory(const char *category_name) {
1544 LLDB_RECORD_METHOD(bool, SBDebugger, DeleteCategory, (const char *),
1547 if (!category_name || *category_name == 0)
1550 return DataVisualization::Categories::Delete(ConstString(category_name));
1553 uint32_t SBDebugger::GetNumCategories() {
1554 LLDB_RECORD_METHOD_NO_ARGS(uint32_t, SBDebugger, GetNumCategories);
1556 return DataVisualization::Categories::GetCount();
1559 SBTypeCategory SBDebugger::GetCategoryAtIndex(uint32_t index) {
1560 LLDB_RECORD_METHOD(lldb::SBTypeCategory, SBDebugger, GetCategoryAtIndex,
1563 return LLDB_RECORD_RESULT(
1564 SBTypeCategory(DataVisualization::Categories::GetCategoryAtIndex(index)));
1567 SBTypeCategory SBDebugger::GetDefaultCategory() {
1568 LLDB_RECORD_METHOD_NO_ARGS(lldb::SBTypeCategory, SBDebugger,
1569 GetDefaultCategory);
1571 return LLDB_RECORD_RESULT(GetCategory("default"));
1574 SBTypeFormat SBDebugger::GetFormatForType(SBTypeNameSpecifier type_name) {
1575 LLDB_RECORD_METHOD(lldb::SBTypeFormat, SBDebugger, GetFormatForType,
1576 (lldb::SBTypeNameSpecifier), type_name);
1578 SBTypeCategory default_category_sb = GetDefaultCategory();
1579 if (default_category_sb.GetEnabled())
1580 return LLDB_RECORD_RESULT(default_category_sb.GetFormatForType(type_name));
1581 return LLDB_RECORD_RESULT(SBTypeFormat());
1584 SBTypeSummary SBDebugger::GetSummaryForType(SBTypeNameSpecifier type_name) {
1585 LLDB_RECORD_METHOD(lldb::SBTypeSummary, SBDebugger, GetSummaryForType,
1586 (lldb::SBTypeNameSpecifier), type_name);
1588 if (!type_name.IsValid())
1589 return LLDB_RECORD_RESULT(SBTypeSummary());
1590 return LLDB_RECORD_RESULT(
1591 SBTypeSummary(DataVisualization::GetSummaryForType(type_name.GetSP())));
1594 SBTypeFilter SBDebugger::GetFilterForType(SBTypeNameSpecifier type_name) {
1595 LLDB_RECORD_METHOD(lldb::SBTypeFilter, SBDebugger, GetFilterForType,
1596 (lldb::SBTypeNameSpecifier), type_name);
1598 if (!type_name.IsValid())
1599 return LLDB_RECORD_RESULT(SBTypeFilter());
1600 return LLDB_RECORD_RESULT(
1601 SBTypeFilter(DataVisualization::GetFilterForType(type_name.GetSP())));
1604 SBTypeSynthetic SBDebugger::GetSyntheticForType(SBTypeNameSpecifier type_name) {
1605 LLDB_RECORD_METHOD(lldb::SBTypeSynthetic, SBDebugger, GetSyntheticForType,
1606 (lldb::SBTypeNameSpecifier), type_name);
1608 if (!type_name.IsValid())
1609 return LLDB_RECORD_RESULT(SBTypeSynthetic());
1610 return LLDB_RECORD_RESULT(SBTypeSynthetic(
1611 DataVisualization::GetSyntheticForType(type_name.GetSP())));
1614 static llvm::ArrayRef<const char *> GetCategoryArray(const char **categories) {
1615 if (categories == nullptr)
1618 while (categories[len] != nullptr)
1620 return llvm::makeArrayRef(categories, len);
1623 bool SBDebugger::EnableLog(const char *channel, const char **categories) {
1624 LLDB_RECORD_METHOD(bool, SBDebugger, EnableLog, (const char *, const char **),
1625 channel, categories);
1628 uint32_t log_options =
1629 LLDB_LOG_OPTION_PREPEND_TIMESTAMP | LLDB_LOG_OPTION_PREPEND_THREAD_NAME;
1631 llvm::raw_string_ostream error_stream(error);
1632 return m_opaque_sp->EnableLog(channel, GetCategoryArray(categories), "",
1633 log_options, error_stream);
1638 void SBDebugger::SetLoggingCallback(lldb::LogOutputCallback log_callback,
1640 LLDB_RECORD_DUMMY(void, SBDebugger, SetLoggingCallback,
1641 (lldb::LogOutputCallback, void *), log_callback, baton);
1644 return m_opaque_sp->SetLoggingCallback(log_callback, baton);
1648 namespace lldb_private {
1651 template <> void RegisterMethods<SBInputReader>(Registry &R) {
1652 LLDB_REGISTER_METHOD(void, SBInputReader, SetIsDone, (bool));
1653 LLDB_REGISTER_METHOD_CONST(bool, SBInputReader, IsActive, ());
1656 static void SetFileHandleRedirect(SBDebugger *, FILE *, bool) {
1660 static SBError SetFileRedirect(SBDebugger *, SBFile file) { return SBError(); }
1662 static SBError SetFileRedirect(SBDebugger *, FileSP file) { return SBError(); }
1664 template <> void RegisterMethods<SBDebugger>(Registry &R) {
1665 // Custom implementation.
1666 R.Register(&invoke<void (SBDebugger::*)(FILE *, bool)>::method<
1667 &SBDebugger::SetErrorFileHandle>::record,
1668 &SetFileHandleRedirect);
1669 R.Register(&invoke<void (SBDebugger::*)(FILE *, bool)>::method<
1670 &SBDebugger::SetOutputFileHandle>::record,
1671 &SetFileHandleRedirect);
1673 R.Register(&invoke<SBError (SBDebugger::*)(
1674 SBFile)>::method<&SBDebugger::SetInputFile>::record,
1676 R.Register(&invoke<SBError (SBDebugger::*)(
1677 SBFile)>::method<&SBDebugger::SetOutputFile>::record,
1679 R.Register(&invoke<SBError (SBDebugger::*)(
1680 SBFile)>::method<&SBDebugger::SetErrorFile>::record,
1683 R.Register(&invoke<SBError (SBDebugger::*)(
1684 FileSP)>::method<&SBDebugger::SetInputFile>::record,
1686 R.Register(&invoke<SBError (SBDebugger::*)(
1687 FileSP)>::method<&SBDebugger::SetOutputFile>::record,
1689 R.Register(&invoke<SBError (SBDebugger::*)(
1690 FileSP)>::method<&SBDebugger::SetErrorFile>::record,
1693 LLDB_REGISTER_CHAR_PTR_METHOD_STATIC(bool, SBDebugger,
1694 GetDefaultArchitecture);
1696 LLDB_REGISTER_CONSTRUCTOR(SBDebugger, ());
1697 LLDB_REGISTER_CONSTRUCTOR(SBDebugger, (const lldb::DebuggerSP &));
1698 LLDB_REGISTER_CONSTRUCTOR(SBDebugger, (const lldb::SBDebugger &));
1699 LLDB_REGISTER_METHOD(lldb::SBDebugger &,
1700 SBDebugger, operator=,(const lldb::SBDebugger &));
1701 LLDB_REGISTER_STATIC_METHOD(void, SBDebugger, Initialize, ());
1702 LLDB_REGISTER_STATIC_METHOD(lldb::SBError, SBDebugger,
1703 InitializeWithErrorHandling, ());
1704 LLDB_REGISTER_STATIC_METHOD(void, SBDebugger, Terminate, ());
1705 LLDB_REGISTER_METHOD(void, SBDebugger, Clear, ());
1706 LLDB_REGISTER_STATIC_METHOD(lldb::SBDebugger, SBDebugger, Create, ());
1707 LLDB_REGISTER_STATIC_METHOD(lldb::SBDebugger, SBDebugger, Create, (bool));
1708 LLDB_REGISTER_STATIC_METHOD(void, SBDebugger, Destroy, (lldb::SBDebugger &));
1709 LLDB_REGISTER_STATIC_METHOD(void, SBDebugger, MemoryPressureDetected, ());
1710 LLDB_REGISTER_METHOD_CONST(bool, SBDebugger, IsValid, ());
1711 LLDB_REGISTER_METHOD_CONST(bool, SBDebugger, operator bool,());
1712 LLDB_REGISTER_METHOD(void, SBDebugger, SetAsync, (bool));
1713 LLDB_REGISTER_METHOD(bool, SBDebugger, GetAsync, ());
1714 LLDB_REGISTER_METHOD(void, SBDebugger, SkipLLDBInitFiles, (bool));
1715 LLDB_REGISTER_METHOD(void, SBDebugger, SkipAppInitFiles, (bool));
1716 LLDB_REGISTER_METHOD(void, SBDebugger, SetInputFileHandle, (FILE *, bool));
1717 LLDB_REGISTER_METHOD(FILE *, SBDebugger, GetInputFileHandle, ());
1718 LLDB_REGISTER_METHOD(FILE *, SBDebugger, GetOutputFileHandle, ());
1719 LLDB_REGISTER_METHOD(FILE *, SBDebugger, GetErrorFileHandle, ());
1720 LLDB_REGISTER_METHOD(SBFile, SBDebugger, GetInputFile, ());
1721 LLDB_REGISTER_METHOD(SBFile, SBDebugger, GetOutputFile, ());
1722 LLDB_REGISTER_METHOD(SBFile, SBDebugger, GetErrorFile, ());
1723 LLDB_REGISTER_METHOD(void, SBDebugger, SaveInputTerminalState, ());
1724 LLDB_REGISTER_METHOD(void, SBDebugger, RestoreInputTerminalState, ());
1725 LLDB_REGISTER_METHOD(lldb::SBCommandInterpreter, SBDebugger,
1726 GetCommandInterpreter, ());
1727 LLDB_REGISTER_METHOD(void, SBDebugger, HandleCommand, (const char *));
1728 LLDB_REGISTER_METHOD(lldb::SBListener, SBDebugger, GetListener, ());
1729 LLDB_REGISTER_METHOD(
1730 void, SBDebugger, HandleProcessEvent,
1731 (const lldb::SBProcess &, const lldb::SBEvent &, FILE *, FILE *));
1732 LLDB_REGISTER_METHOD(
1733 void, SBDebugger, HandleProcessEvent,
1734 (const lldb::SBProcess &, const lldb::SBEvent &, SBFile, SBFile));
1735 LLDB_REGISTER_METHOD(
1736 void, SBDebugger, HandleProcessEvent,
1737 (const lldb::SBProcess &, const lldb::SBEvent &, FileSP, FileSP));
1738 LLDB_REGISTER_METHOD(lldb::SBSourceManager, SBDebugger, GetSourceManager, ());
1739 LLDB_REGISTER_STATIC_METHOD(bool, SBDebugger, SetDefaultArchitecture,
1741 LLDB_REGISTER_METHOD(lldb::ScriptLanguage, SBDebugger, GetScriptingLanguage,
1743 LLDB_REGISTER_STATIC_METHOD(const char *, SBDebugger, GetVersionString, ());
1744 LLDB_REGISTER_STATIC_METHOD(const char *, SBDebugger, StateAsCString,
1746 LLDB_REGISTER_STATIC_METHOD(lldb::SBStructuredData, SBDebugger,
1747 GetBuildConfiguration, ());
1748 LLDB_REGISTER_STATIC_METHOD(bool, SBDebugger, StateIsRunningState,
1750 LLDB_REGISTER_STATIC_METHOD(bool, SBDebugger, StateIsStoppedState,
1752 LLDB_REGISTER_METHOD(
1753 lldb::SBTarget, SBDebugger, CreateTarget,
1754 (const char *, const char *, const char *, bool, lldb::SBError &));
1755 LLDB_REGISTER_METHOD(lldb::SBTarget, SBDebugger,
1756 CreateTargetWithFileAndTargetTriple,
1757 (const char *, const char *));
1758 LLDB_REGISTER_METHOD(lldb::SBTarget, SBDebugger, CreateTargetWithFileAndArch,
1759 (const char *, const char *));
1760 LLDB_REGISTER_METHOD(lldb::SBTarget, SBDebugger, CreateTarget,
1762 LLDB_REGISTER_METHOD(lldb::SBTarget, SBDebugger, GetDummyTarget, ());
1763 LLDB_REGISTER_METHOD(bool, SBDebugger, DeleteTarget, (lldb::SBTarget &));
1764 LLDB_REGISTER_METHOD(lldb::SBTarget, SBDebugger, GetTargetAtIndex,
1766 LLDB_REGISTER_METHOD(uint32_t, SBDebugger, GetIndexOfTarget,
1768 LLDB_REGISTER_METHOD(lldb::SBTarget, SBDebugger, FindTargetWithProcessID,
1770 LLDB_REGISTER_METHOD(lldb::SBTarget, SBDebugger, FindTargetWithFileAndArch,
1771 (const char *, const char *));
1772 LLDB_REGISTER_METHOD(uint32_t, SBDebugger, GetNumTargets, ());
1773 LLDB_REGISTER_METHOD(lldb::SBTarget, SBDebugger, GetSelectedTarget, ());
1774 LLDB_REGISTER_METHOD(void, SBDebugger, SetSelectedTarget, (lldb::SBTarget &));
1775 LLDB_REGISTER_METHOD(lldb::SBPlatform, SBDebugger, GetSelectedPlatform, ());
1776 LLDB_REGISTER_METHOD(void, SBDebugger, SetSelectedPlatform,
1777 (lldb::SBPlatform &));
1778 LLDB_REGISTER_METHOD(uint32_t, SBDebugger, GetNumPlatforms, ());
1779 LLDB_REGISTER_METHOD(lldb::SBPlatform, SBDebugger, GetPlatformAtIndex,
1781 LLDB_REGISTER_METHOD(uint32_t, SBDebugger, GetNumAvailablePlatforms, ());
1782 LLDB_REGISTER_METHOD(lldb::SBStructuredData, SBDebugger,
1783 GetAvailablePlatformInfoAtIndex, (uint32_t));
1784 LLDB_REGISTER_METHOD(void, SBDebugger, DispatchInputInterrupt, ());
1785 LLDB_REGISTER_METHOD(void, SBDebugger, DispatchInputEndOfFile, ());
1786 LLDB_REGISTER_METHOD(void, SBDebugger, PushInputReader,
1787 (lldb::SBInputReader &));
1788 LLDB_REGISTER_METHOD(void, SBDebugger, RunCommandInterpreter, (bool, bool));
1789 LLDB_REGISTER_METHOD(void, SBDebugger, RunCommandInterpreter,
1790 (bool, bool, lldb::SBCommandInterpreterRunOptions &,
1791 int &, bool &, bool &));
1792 LLDB_REGISTER_METHOD(lldb::SBError, SBDebugger, RunREPL,
1793 (lldb::LanguageType, const char *));
1794 LLDB_REGISTER_STATIC_METHOD(lldb::SBDebugger, SBDebugger, FindDebuggerWithID,
1796 LLDB_REGISTER_METHOD(const char *, SBDebugger, GetInstanceName, ());
1797 LLDB_REGISTER_STATIC_METHOD(lldb::SBError, SBDebugger, SetInternalVariable,
1798 (const char *, const char *, const char *));
1799 LLDB_REGISTER_STATIC_METHOD(lldb::SBStringList, SBDebugger,
1800 GetInternalVariableValue,
1801 (const char *, const char *));
1802 LLDB_REGISTER_METHOD_CONST(uint32_t, SBDebugger, GetTerminalWidth, ());
1803 LLDB_REGISTER_METHOD(void, SBDebugger, SetTerminalWidth, (uint32_t));
1804 LLDB_REGISTER_METHOD_CONST(const char *, SBDebugger, GetPrompt, ());
1805 LLDB_REGISTER_METHOD(void, SBDebugger, SetPrompt, (const char *));
1806 LLDB_REGISTER_METHOD_CONST(const char *, SBDebugger, GetReproducerPath, ());
1807 LLDB_REGISTER_METHOD_CONST(lldb::ScriptLanguage, SBDebugger,
1808 GetScriptLanguage, ());
1809 LLDB_REGISTER_METHOD(void, SBDebugger, SetScriptLanguage,
1810 (lldb::ScriptLanguage));
1811 LLDB_REGISTER_METHOD(bool, SBDebugger, SetUseExternalEditor, (bool));
1812 LLDB_REGISTER_METHOD(bool, SBDebugger, GetUseExternalEditor, ());
1813 LLDB_REGISTER_METHOD(bool, SBDebugger, SetUseColor, (bool));
1814 LLDB_REGISTER_METHOD_CONST(bool, SBDebugger, GetUseColor, ());
1815 LLDB_REGISTER_METHOD(bool, SBDebugger, GetDescription, (lldb::SBStream &));
1816 LLDB_REGISTER_METHOD(lldb::user_id_t, SBDebugger, GetID, ());
1817 LLDB_REGISTER_METHOD(lldb::SBError, SBDebugger, SetCurrentPlatform,
1819 LLDB_REGISTER_METHOD(bool, SBDebugger, SetCurrentPlatformSDKRoot,
1821 LLDB_REGISTER_METHOD_CONST(bool, SBDebugger, GetCloseInputOnEOF, ());
1822 LLDB_REGISTER_METHOD(void, SBDebugger, SetCloseInputOnEOF, (bool));
1823 LLDB_REGISTER_METHOD(lldb::SBTypeCategory, SBDebugger, GetCategory,
1825 LLDB_REGISTER_METHOD(lldb::SBTypeCategory, SBDebugger, GetCategory,
1826 (lldb::LanguageType));
1827 LLDB_REGISTER_METHOD(lldb::SBTypeCategory, SBDebugger, CreateCategory,
1829 LLDB_REGISTER_METHOD(bool, SBDebugger, DeleteCategory, (const char *));
1830 LLDB_REGISTER_METHOD(uint32_t, SBDebugger, GetNumCategories, ());
1831 LLDB_REGISTER_METHOD(lldb::SBTypeCategory, SBDebugger, GetCategoryAtIndex,
1833 LLDB_REGISTER_METHOD(lldb::SBTypeCategory, SBDebugger, GetDefaultCategory,
1835 LLDB_REGISTER_METHOD(lldb::SBTypeFormat, SBDebugger, GetFormatForType,
1836 (lldb::SBTypeNameSpecifier));
1837 LLDB_REGISTER_METHOD(lldb::SBTypeSummary, SBDebugger, GetSummaryForType,
1838 (lldb::SBTypeNameSpecifier));
1839 LLDB_REGISTER_METHOD(lldb::SBTypeSynthetic, SBDebugger, GetSyntheticForType,
1840 (lldb::SBTypeNameSpecifier));
1841 LLDB_REGISTER_METHOD(lldb::SBTypeFilter, SBDebugger, GetFilterForType,
1842 (lldb::SBTypeNameSpecifier));
1843 LLDB_REGISTER_METHOD(bool, SBDebugger, EnableLog,
1844 (const char *, const char **));
1845 LLDB_REGISTER_METHOD(lldb::SBCommandInterpreterRunResult, SBDebugger,
1846 RunCommandInterpreter,
1847 (const lldb::SBCommandInterpreterRunOptions &));
1850 } // namespace repro
1851 } // namespace lldb_private