1 //===-- SBDebugger.cpp ------------------------------------------*- C++ -*-===//
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/SBCommandReturnObject.h"
19 #include "lldb/API/SBError.h"
20 #include "lldb/API/SBEvent.h"
21 #include "lldb/API/SBFile.h"
22 #include "lldb/API/SBFrame.h"
23 #include "lldb/API/SBListener.h"
24 #include "lldb/API/SBProcess.h"
25 #include "lldb/API/SBSourceManager.h"
26 #include "lldb/API/SBStream.h"
27 #include "lldb/API/SBStringList.h"
28 #include "lldb/API/SBStructuredData.h"
29 #include "lldb/API/SBTarget.h"
30 #include "lldb/API/SBThread.h"
31 #include "lldb/API/SBTypeCategory.h"
32 #include "lldb/API/SBTypeFilter.h"
33 #include "lldb/API/SBTypeFormat.h"
34 #include "lldb/API/SBTypeNameSpecifier.h"
35 #include "lldb/API/SBTypeSummary.h"
36 #include "lldb/API/SBTypeSynthetic.h"
38 #include "lldb/Core/Debugger.h"
39 #include "lldb/Core/PluginManager.h"
40 #include "lldb/Core/StreamFile.h"
41 #include "lldb/Core/StructuredDataImpl.h"
42 #include "lldb/DataFormatters/DataVisualization.h"
43 #include "lldb/Host/Config.h"
44 #include "lldb/Host/XML.h"
45 #include "lldb/Initialization/SystemLifetimeManager.h"
46 #include "lldb/Interpreter/CommandInterpreter.h"
47 #include "lldb/Interpreter/OptionArgParser.h"
48 #include "lldb/Interpreter/OptionGroupPlatform.h"
49 #include "lldb/Target/Process.h"
50 #include "lldb/Target/TargetList.h"
51 #include "lldb/Utility/Args.h"
52 #include "lldb/Utility/State.h"
54 #include "llvm/ADT/STLExtras.h"
55 #include "llvm/ADT/StringRef.h"
56 #include "llvm/Support/DynamicLibrary.h"
57 #include "llvm/Support/ManagedStatic.h"
60 using namespace lldb_private
;
62 static llvm::sys::DynamicLibrary
LoadPlugin(const lldb::DebuggerSP
&debugger_sp
,
65 llvm::sys::DynamicLibrary dynlib
=
66 llvm::sys::DynamicLibrary::getPermanentLibrary(spec
.GetPath().c_str());
67 if (dynlib
.isValid()) {
68 typedef bool (*LLDBCommandPluginInit
)(lldb::SBDebugger
& debugger
);
70 lldb::SBDebugger
debugger_sb(debugger_sp
);
71 // This calls the bool lldb::PluginInitialize(lldb::SBDebugger debugger)
73 // TODO: mangle this differently for your system - on OSX, the first
74 // underscore needs to be removed and the second one stays
75 LLDBCommandPluginInit init_func
=
76 (LLDBCommandPluginInit
)(uintptr_t)dynlib
.getAddressOfSymbol(
77 "_ZN4lldb16PluginInitializeENS_10SBDebuggerE");
79 if (init_func(debugger_sb
))
82 error
.SetErrorString("plug-in refused to load "
83 "(lldb::PluginInitialize(lldb::SBDebugger) "
86 error
.SetErrorString("plug-in is missing the required initialization: "
87 "lldb::PluginInitialize(lldb::SBDebugger)");
90 if (FileSystem::Instance().Exists(spec
))
91 error
.SetErrorString("this file does not represent a loadable dylib");
93 error
.SetErrorString("no such file");
95 return llvm::sys::DynamicLibrary();
98 static llvm::ManagedStatic
<SystemLifetimeManager
> g_debugger_lifetime
;
100 SBError
SBInputReader::Initialize(
101 lldb::SBDebugger
&sb_debugger
,
102 unsigned long (*callback
)(void *, lldb::SBInputReader
*,
103 lldb::InputReaderAction
, char const *,
105 void *a
, lldb::InputReaderGranularity b
, char const *c
, char const *d
,
108 lldb::SBError
, SBInputReader
, Initialize
,
110 unsigned long (*)(void *, lldb::SBInputReader
*, lldb::InputReaderAction
,
111 const char *, unsigned long),
112 void *, lldb::InputReaderGranularity
, const char *, const char *, bool),
113 sb_debugger
, callback
, a
, b
, c
, d
, e
);
118 void SBInputReader::SetIsDone(bool b
) {
119 LLDB_RECORD_METHOD(void, SBInputReader
, SetIsDone
, (bool), b
);
122 bool SBInputReader::IsActive() const {
123 LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBInputReader
, IsActive
);
128 SBDebugger::SBDebugger() { LLDB_RECORD_CONSTRUCTOR_NO_ARGS(SBDebugger
); }
130 SBDebugger::SBDebugger(const lldb::DebuggerSP
&debugger_sp
)
131 : m_opaque_sp(debugger_sp
) {
132 LLDB_RECORD_CONSTRUCTOR(SBDebugger
, (const lldb::DebuggerSP
&), debugger_sp
);
135 SBDebugger::SBDebugger(const SBDebugger
&rhs
) : m_opaque_sp(rhs
.m_opaque_sp
) {
136 LLDB_RECORD_CONSTRUCTOR(SBDebugger
, (const lldb::SBDebugger
&), rhs
);
139 SBDebugger::~SBDebugger() = default;
141 SBDebugger
&SBDebugger::operator=(const SBDebugger
&rhs
) {
142 LLDB_RECORD_METHOD(lldb::SBDebugger
&,
143 SBDebugger
, operator=,(const lldb::SBDebugger
&), rhs
);
146 m_opaque_sp
= rhs
.m_opaque_sp
;
148 return LLDB_RECORD_RESULT(*this);
151 void SBDebugger::Initialize() {
152 LLDB_RECORD_STATIC_METHOD_NO_ARGS(void, SBDebugger
, Initialize
);
153 SBError ignored
= SBDebugger::InitializeWithErrorHandling();
156 lldb::SBError
SBDebugger::InitializeWithErrorHandling() {
157 LLDB_RECORD_STATIC_METHOD_NO_ARGS(lldb::SBError
, SBDebugger
,
158 InitializeWithErrorHandling
);
161 if (auto e
= g_debugger_lifetime
->Initialize(
162 std::make_unique
<SystemInitializerFull
>(), LoadPlugin
)) {
163 error
.SetError(Status(std::move(e
)));
165 return LLDB_RECORD_RESULT(error
);
168 void SBDebugger::Terminate() {
169 LLDB_RECORD_STATIC_METHOD_NO_ARGS(void, SBDebugger
, Terminate
);
171 g_debugger_lifetime
->Terminate();
174 void SBDebugger::Clear() {
175 LLDB_RECORD_METHOD_NO_ARGS(void, SBDebugger
, Clear
);
178 m_opaque_sp
->ClearIOHandlers();
183 SBDebugger
SBDebugger::Create() {
184 LLDB_RECORD_STATIC_METHOD_NO_ARGS(lldb::SBDebugger
, SBDebugger
, Create
);
186 return LLDB_RECORD_RESULT(SBDebugger::Create(false, nullptr, nullptr));
189 SBDebugger
SBDebugger::Create(bool source_init_files
) {
190 LLDB_RECORD_STATIC_METHOD(lldb::SBDebugger
, SBDebugger
, Create
, (bool),
193 return LLDB_RECORD_RESULT(
194 SBDebugger::Create(source_init_files
, nullptr, nullptr));
197 SBDebugger
SBDebugger::Create(bool source_init_files
,
198 lldb::LogOutputCallback callback
, void *baton
)
201 LLDB_RECORD_DUMMY(lldb::SBDebugger
, SBDebugger
, Create
,
202 (bool, lldb::LogOutputCallback
, void *), source_init_files
,
207 // Currently we have issues if this function is called simultaneously on two
208 // different threads. The issues mainly revolve around the fact that the
209 // lldb_private::FormatManager uses global collections and having two threads
210 // parsing the .lldbinit files can cause mayhem. So to get around this for
211 // now we need to use a mutex to prevent bad things from happening.
212 static std::recursive_mutex g_mutex
;
213 std::lock_guard
<std::recursive_mutex
> guard(g_mutex
);
215 debugger
.reset(Debugger::CreateInstance(callback
, baton
));
217 SBCommandInterpreter interp
= debugger
.GetCommandInterpreter();
218 if (source_init_files
) {
219 interp
.get()->SkipLLDBInitFiles(false);
220 interp
.get()->SkipAppInitFiles(false);
221 SBCommandReturnObject result
;
222 interp
.SourceInitFileInHomeDirectory(result
);
224 interp
.get()->SkipLLDBInitFiles(true);
225 interp
.get()->SkipAppInitFiles(true);
230 void SBDebugger::Destroy(SBDebugger
&debugger
) {
231 LLDB_RECORD_STATIC_METHOD(void, SBDebugger
, Destroy
, (lldb::SBDebugger
&),
234 Debugger::Destroy(debugger
.m_opaque_sp
);
236 if (debugger
.m_opaque_sp
.get() != nullptr)
237 debugger
.m_opaque_sp
.reset();
240 void SBDebugger::MemoryPressureDetected() {
241 LLDB_RECORD_STATIC_METHOD_NO_ARGS(void, SBDebugger
, MemoryPressureDetected
);
243 // Since this function can be call asynchronously, we allow it to be non-
244 // mandatory. We have seen deadlocks with this function when called so we
245 // need to safeguard against this until we can determine what is causing the
248 const bool mandatory
= false;
250 ModuleList::RemoveOrphanSharedModules(mandatory
);
253 bool SBDebugger::IsValid() const {
254 LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBDebugger
, IsValid
);
255 return this->operator bool();
257 SBDebugger::operator bool() const {
258 LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBDebugger
, operator bool);
260 return m_opaque_sp
.get() != nullptr;
263 void SBDebugger::SetAsync(bool b
) {
264 LLDB_RECORD_METHOD(void, SBDebugger
, SetAsync
, (bool), b
);
267 m_opaque_sp
->SetAsyncExecution(b
);
270 bool SBDebugger::GetAsync() {
271 LLDB_RECORD_METHOD_NO_ARGS(bool, SBDebugger
, GetAsync
);
273 return (m_opaque_sp
? m_opaque_sp
->GetAsyncExecution() : false);
276 void SBDebugger::SkipLLDBInitFiles(bool b
) {
277 LLDB_RECORD_METHOD(void, SBDebugger
, SkipLLDBInitFiles
, (bool), b
);
280 m_opaque_sp
->GetCommandInterpreter().SkipLLDBInitFiles(b
);
283 void SBDebugger::SkipAppInitFiles(bool b
) {
284 LLDB_RECORD_METHOD(void, SBDebugger
, SkipAppInitFiles
, (bool), b
);
287 m_opaque_sp
->GetCommandInterpreter().SkipAppInitFiles(b
);
290 void SBDebugger::SetInputFileHandle(FILE *fh
, bool transfer_ownership
) {
291 LLDB_RECORD_METHOD(void, SBDebugger
, SetInputFileHandle
, (FILE *, bool), fh
,
293 SetInputFile((FileSP
)std::make_shared
<NativeFile
>(fh
, transfer_ownership
));
296 SBError
SBDebugger::SetInputFile(FileSP file_sp
) {
297 LLDB_RECORD_METHOD(SBError
, SBDebugger
, SetInputFile
, (FileSP
), file_sp
);
298 return LLDB_RECORD_RESULT(SetInputFile(SBFile(file_sp
)));
301 // Shouldn't really be settable after initialization as this could cause lots
302 // of problems; don't want users trying to switch modes in the middle of a
303 // debugging session.
304 SBError
SBDebugger::SetInputFile(SBFile file
) {
305 LLDB_RECORD_METHOD(SBError
, SBDebugger
, SetInputFile
, (SBFile
), file
);
309 error
.ref().SetErrorString("invalid debugger");
310 return LLDB_RECORD_RESULT(error
);
313 repro::DataRecorder
*recorder
= nullptr;
314 if (repro::Generator
*g
= repro::Reproducer::Instance().GetGenerator())
315 recorder
= g
->GetOrCreate
<repro::CommandProvider
>().GetNewDataRecorder();
317 FileSP file_sp
= file
.m_opaque_sp
;
319 static std::unique_ptr
<repro::MultiLoader
<repro::CommandProvider
>> loader
=
320 repro::MultiLoader
<repro::CommandProvider
>::Create(
321 repro::Reproducer::Instance().GetLoader());
323 llvm::Optional
<std::string
> nextfile
= loader
->GetNextFile();
324 FILE *fh
= nextfile
? FileSystem::Instance().Fopen(nextfile
->c_str(), "r")
326 // FIXME Jonas Devlieghere: shouldn't this error be propagated out to the
327 // reproducer somehow if fh is NULL?
329 file_sp
= std::make_shared
<NativeFile
>(fh
, true);
333 if (!file_sp
|| !file_sp
->IsValid()) {
334 error
.ref().SetErrorString("invalid file");
335 return LLDB_RECORD_RESULT(error
);
338 m_opaque_sp
->SetInputFile(file_sp
, recorder
);
339 return LLDB_RECORD_RESULT(error
);
342 SBError
SBDebugger::SetOutputFile(FileSP file_sp
) {
343 LLDB_RECORD_METHOD(SBError
, SBDebugger
, SetOutputFile
, (FileSP
), file_sp
);
344 return LLDB_RECORD_RESULT(SetOutputFile(SBFile(file_sp
)));
347 void SBDebugger::SetOutputFileHandle(FILE *fh
, bool transfer_ownership
) {
348 LLDB_RECORD_METHOD(void, SBDebugger
, SetOutputFileHandle
, (FILE *, bool), fh
,
350 SetOutputFile((FileSP
)std::make_shared
<NativeFile
>(fh
, transfer_ownership
));
353 SBError
SBDebugger::SetOutputFile(SBFile file
) {
354 LLDB_RECORD_METHOD(SBError
, SBDebugger
, SetOutputFile
, (SBFile file
), file
);
357 error
.ref().SetErrorString("invalid debugger");
358 return LLDB_RECORD_RESULT(error
);
361 error
.ref().SetErrorString("invalid file");
362 return LLDB_RECORD_RESULT(error
);
364 m_opaque_sp
->SetOutputFile(file
.m_opaque_sp
);
365 return LLDB_RECORD_RESULT(error
);
368 void SBDebugger::SetErrorFileHandle(FILE *fh
, bool transfer_ownership
) {
369 LLDB_RECORD_METHOD(void, SBDebugger
, SetErrorFileHandle
, (FILE *, bool), fh
,
371 SetErrorFile((FileSP
)std::make_shared
<NativeFile
>(fh
, transfer_ownership
));
374 SBError
SBDebugger::SetErrorFile(FileSP file_sp
) {
375 LLDB_RECORD_METHOD(SBError
, SBDebugger
, SetErrorFile
, (FileSP
), file_sp
);
376 return LLDB_RECORD_RESULT(SetErrorFile(SBFile(file_sp
)));
379 SBError
SBDebugger::SetErrorFile(SBFile file
) {
380 LLDB_RECORD_METHOD(SBError
, SBDebugger
, SetErrorFile
, (SBFile file
), file
);
383 error
.ref().SetErrorString("invalid debugger");
384 return LLDB_RECORD_RESULT(error
);
387 error
.ref().SetErrorString("invalid file");
388 return LLDB_RECORD_RESULT(error
);
390 m_opaque_sp
->SetErrorFile(file
.m_opaque_sp
);
391 return LLDB_RECORD_RESULT(error
);
394 FILE *SBDebugger::GetInputFileHandle() {
395 LLDB_RECORD_METHOD_NO_ARGS(FILE *, SBDebugger
, GetInputFileHandle
);
397 File
&file_sp
= m_opaque_sp
->GetInputFile();
398 return LLDB_RECORD_RESULT(file_sp
.GetStream());
400 return LLDB_RECORD_RESULT(nullptr);
403 SBFile
SBDebugger::GetInputFile() {
404 LLDB_RECORD_METHOD_NO_ARGS(SBFile
, SBDebugger
, GetInputFile
);
406 return LLDB_RECORD_RESULT(SBFile(m_opaque_sp
->GetInputFileSP()));
408 return LLDB_RECORD_RESULT(SBFile());
411 FILE *SBDebugger::GetOutputFileHandle() {
412 LLDB_RECORD_METHOD_NO_ARGS(FILE *, SBDebugger
, GetOutputFileHandle
);
414 StreamFile
&stream_file
= m_opaque_sp
->GetOutputStream();
415 return LLDB_RECORD_RESULT(stream_file
.GetFile().GetStream());
417 return LLDB_RECORD_RESULT(nullptr);
420 SBFile
SBDebugger::GetOutputFile() {
421 LLDB_RECORD_METHOD_NO_ARGS(SBFile
, SBDebugger
, GetOutputFile
);
423 SBFile
file(m_opaque_sp
->GetOutputStream().GetFileSP());
424 return LLDB_RECORD_RESULT(file
);
426 return LLDB_RECORD_RESULT(SBFile());
429 FILE *SBDebugger::GetErrorFileHandle() {
430 LLDB_RECORD_METHOD_NO_ARGS(FILE *, SBDebugger
, GetErrorFileHandle
);
433 StreamFile
&stream_file
= m_opaque_sp
->GetErrorStream();
434 return LLDB_RECORD_RESULT(stream_file
.GetFile().GetStream());
436 return LLDB_RECORD_RESULT(nullptr);
439 SBFile
SBDebugger::GetErrorFile() {
440 LLDB_RECORD_METHOD_NO_ARGS(SBFile
, SBDebugger
, GetErrorFile
);
443 SBFile
file(m_opaque_sp
->GetErrorStream().GetFileSP());
444 return LLDB_RECORD_RESULT(file
);
446 return LLDB_RECORD_RESULT(SBFile());
449 void SBDebugger::SaveInputTerminalState() {
450 LLDB_RECORD_DUMMY_NO_ARGS(void, SBDebugger
, SaveInputTerminalState
);
453 m_opaque_sp
->SaveInputTerminalState();
456 void SBDebugger::RestoreInputTerminalState() {
457 LLDB_RECORD_DUMMY_NO_ARGS(void, SBDebugger
, RestoreInputTerminalState
);
460 m_opaque_sp
->RestoreInputTerminalState();
462 SBCommandInterpreter
SBDebugger::GetCommandInterpreter() {
463 LLDB_RECORD_METHOD_NO_ARGS(lldb::SBCommandInterpreter
, SBDebugger
,
464 GetCommandInterpreter
);
466 SBCommandInterpreter sb_interpreter
;
468 sb_interpreter
.reset(&m_opaque_sp
->GetCommandInterpreter());
470 return LLDB_RECORD_RESULT(sb_interpreter
);
473 void SBDebugger::HandleCommand(const char *command
) {
474 LLDB_RECORD_METHOD(void, SBDebugger
, HandleCommand
, (const char *), command
);
477 TargetSP
target_sp(m_opaque_sp
->GetSelectedTarget());
478 std::unique_lock
<std::recursive_mutex
> lock
;
480 lock
= std::unique_lock
<std::recursive_mutex
>(target_sp
->GetAPIMutex());
482 SBCommandInterpreter
sb_interpreter(GetCommandInterpreter());
483 SBCommandReturnObject result
;
485 sb_interpreter
.HandleCommand(command
, result
, false);
487 result
.PutError(m_opaque_sp
->GetErrorStream().GetFileSP());
488 result
.PutOutput(m_opaque_sp
->GetOutputStream().GetFileSP());
490 if (!m_opaque_sp
->GetAsyncExecution()) {
491 SBProcess
process(GetCommandInterpreter().GetProcess());
492 ProcessSP
process_sp(process
.GetSP());
495 ListenerSP lldb_listener_sp
= m_opaque_sp
->GetListener();
496 while (lldb_listener_sp
->GetEventForBroadcaster(
497 process_sp
.get(), event_sp
, std::chrono::seconds(0))) {
498 SBEvent
event(event_sp
);
499 HandleProcessEvent(process
, event
, GetOutputFile(), GetErrorFile());
506 SBListener
SBDebugger::GetListener() {
507 LLDB_RECORD_METHOD_NO_ARGS(lldb::SBListener
, SBDebugger
, GetListener
);
509 SBListener sb_listener
;
511 sb_listener
.reset(m_opaque_sp
->GetListener());
513 return LLDB_RECORD_RESULT(sb_listener
);
516 void SBDebugger::HandleProcessEvent(const SBProcess
&process
,
517 const SBEvent
&event
, SBFile out
,
520 void, SBDebugger
, HandleProcessEvent
,
521 (const lldb::SBProcess
&, const lldb::SBEvent
&, SBFile
, SBFile
), process
,
524 return HandleProcessEvent(process
, event
, out
.m_opaque_sp
, err
.m_opaque_sp
);
527 void SBDebugger::HandleProcessEvent(const SBProcess
&process
,
528 const SBEvent
&event
, FILE *out
,
531 void, SBDebugger
, HandleProcessEvent
,
532 (const lldb::SBProcess
&, const lldb::SBEvent
&, FILE *, FILE *), process
,
535 FileSP outfile
= std::make_shared
<NativeFile
>(out
, false);
536 FileSP errfile
= std::make_shared
<NativeFile
>(err
, false);
537 return HandleProcessEvent(process
, event
, outfile
, errfile
);
540 void SBDebugger::HandleProcessEvent(const SBProcess
&process
,
541 const SBEvent
&event
, FileSP out_sp
,
545 void, SBDebugger
, HandleProcessEvent
,
546 (const lldb::SBProcess
&, const lldb::SBEvent
&, FileSP
, FileSP
), process
,
547 event
, out_sp
, err_sp
);
549 if (!process
.IsValid())
552 TargetSP
target_sp(process
.GetTarget().GetSP());
556 const uint32_t event_type
= event
.GetType();
557 char stdio_buffer
[1024];
560 std::lock_guard
<std::recursive_mutex
> guard(target_sp
->GetAPIMutex());
563 (Process::eBroadcastBitSTDOUT
| Process::eBroadcastBitStateChanged
)) {
564 // Drain stdout when we stop just in case we have any bytes
565 while ((len
= process
.GetSTDOUT(stdio_buffer
, sizeof(stdio_buffer
))) > 0)
567 out_sp
->Write(stdio_buffer
, len
);
571 (Process::eBroadcastBitSTDERR
| Process::eBroadcastBitStateChanged
)) {
572 // Drain stderr when we stop just in case we have any bytes
573 while ((len
= process
.GetSTDERR(stdio_buffer
, sizeof(stdio_buffer
))) > 0)
575 err_sp
->Write(stdio_buffer
, len
);
578 if (event_type
& Process::eBroadcastBitStateChanged
) {
579 StateType event_state
= SBProcess::GetStateFromEvent(event
);
581 if (event_state
== eStateInvalid
)
584 bool is_stopped
= StateIsStoppedState(event_state
);
586 process
.ReportEventState(event
, out_sp
);
590 SBSourceManager
SBDebugger::GetSourceManager() {
591 LLDB_RECORD_METHOD_NO_ARGS(lldb::SBSourceManager
, SBDebugger
,
594 SBSourceManager
sb_source_manager(*this);
595 return LLDB_RECORD_RESULT(sb_source_manager
);
598 bool SBDebugger::GetDefaultArchitecture(char *arch_name
, size_t arch_name_len
) {
599 LLDB_RECORD_STATIC_METHOD(bool, SBDebugger
, GetDefaultArchitecture
,
600 (char *, size_t), "", arch_name_len
);
602 if (arch_name
&& arch_name_len
) {
603 ArchSpec default_arch
= Target::GetDefaultArchitecture();
605 if (default_arch
.IsValid()) {
606 const std::string
&triple_str
= default_arch
.GetTriple().str();
607 if (!triple_str
.empty())
608 ::snprintf(arch_name
, arch_name_len
, "%s", triple_str
.c_str());
610 ::snprintf(arch_name
, arch_name_len
, "%s",
611 default_arch
.GetArchitectureName());
615 if (arch_name
&& arch_name_len
)
620 bool SBDebugger::SetDefaultArchitecture(const char *arch_name
) {
621 LLDB_RECORD_STATIC_METHOD(bool, SBDebugger
, SetDefaultArchitecture
,
622 (const char *), arch_name
);
625 ArchSpec
arch(arch_name
);
626 if (arch
.IsValid()) {
627 Target::SetDefaultArchitecture(arch
);
635 SBDebugger::GetScriptingLanguage(const char *script_language_name
) {
636 LLDB_RECORD_METHOD(lldb::ScriptLanguage
, SBDebugger
, GetScriptingLanguage
,
637 (const char *), script_language_name
);
639 if (!script_language_name
)
640 return eScriptLanguageDefault
;
641 return OptionArgParser::ToScriptLanguage(
642 llvm::StringRef(script_language_name
), eScriptLanguageDefault
, nullptr);
645 const char *SBDebugger::GetVersionString() {
646 LLDB_RECORD_STATIC_METHOD_NO_ARGS(const char *, SBDebugger
, GetVersionString
);
648 return lldb_private::GetVersion();
651 const char *SBDebugger::StateAsCString(StateType state
) {
652 LLDB_RECORD_STATIC_METHOD(const char *, SBDebugger
, StateAsCString
,
653 (lldb::StateType
), state
);
655 return lldb_private::StateAsCString(state
);
658 static void AddBoolConfigEntry(StructuredData::Dictionary
&dict
,
659 llvm::StringRef name
, bool value
,
660 llvm::StringRef description
) {
661 auto entry_up
= std::make_unique
<StructuredData::Dictionary
>();
662 entry_up
->AddBooleanItem("value", value
);
663 entry_up
->AddStringItem("description", description
);
664 dict
.AddItem(name
, std::move(entry_up
));
667 static void AddLLVMTargets(StructuredData::Dictionary
&dict
) {
668 auto array_up
= std::make_unique
<StructuredData::Array
>();
669 #define LLVM_TARGET(target) \
670 array_up->AddItem(std::make_unique<StructuredData::String>(#target));
671 #include "llvm/Config/Targets.def"
672 auto entry_up
= std::make_unique
<StructuredData::Dictionary
>();
673 entry_up
->AddItem("value", std::move(array_up
));
674 entry_up
->AddStringItem("description", "A list of configured LLVM targets.");
675 dict
.AddItem("targets", std::move(entry_up
));
678 SBStructuredData
SBDebugger::GetBuildConfiguration() {
679 LLDB_RECORD_STATIC_METHOD_NO_ARGS(lldb::SBStructuredData
, SBDebugger
,
680 GetBuildConfiguration
);
682 auto config_up
= std::make_unique
<StructuredData::Dictionary
>();
684 *config_up
, "xml", XMLDocument::XMLEnabled(),
685 "A boolean value that indicates if XML support is enabled in LLDB");
687 *config_up
, "curses", LLDB_ENABLE_CURSES
,
688 "A boolean value that indicates if curses support is enabled in LLDB");
690 *config_up
, "editline", LLDB_ENABLE_LIBEDIT
,
691 "A boolean value that indicates if editline support is enabled in LLDB");
693 *config_up
, "lzma", LLDB_ENABLE_LZMA
,
694 "A boolean value that indicates if lzma support is enabled in LLDB");
696 *config_up
, "python", LLDB_ENABLE_PYTHON
,
697 "A boolean value that indicates if python support is enabled in LLDB");
699 *config_up
, "lua", LLDB_ENABLE_LUA
,
700 "A boolean value that indicates if lua support is enabled in LLDB");
701 AddLLVMTargets(*config_up
);
703 SBStructuredData data
;
704 data
.m_impl_up
->SetObjectSP(std::move(config_up
));
705 return LLDB_RECORD_RESULT(data
);
708 bool SBDebugger::StateIsRunningState(StateType state
) {
709 LLDB_RECORD_STATIC_METHOD(bool, SBDebugger
, StateIsRunningState
,
710 (lldb::StateType
), state
);
712 const bool result
= lldb_private::StateIsRunningState(state
);
717 bool SBDebugger::StateIsStoppedState(StateType state
) {
718 LLDB_RECORD_STATIC_METHOD(bool, SBDebugger
, StateIsStoppedState
,
719 (lldb::StateType
), state
);
721 const bool result
= lldb_private::StateIsStoppedState(state
, false);
726 lldb::SBTarget
SBDebugger::CreateTarget(const char *filename
,
727 const char *target_triple
,
728 const char *platform_name
,
729 bool add_dependent_modules
,
730 lldb::SBError
&sb_error
) {
732 lldb::SBTarget
, SBDebugger
, CreateTarget
,
733 (const char *, const char *, const char *, bool, lldb::SBError
&),
734 filename
, target_triple
, platform_name
, add_dependent_modules
, sb_error
);
740 OptionGroupPlatform
platform_options(false);
741 platform_options
.SetPlatformName(platform_name
);
743 sb_error
.ref() = m_opaque_sp
->GetTargetList().CreateTarget(
744 *m_opaque_sp
, filename
, target_triple
,
745 add_dependent_modules
? eLoadDependentsYes
: eLoadDependentsNo
,
746 &platform_options
, target_sp
);
748 if (sb_error
.Success())
749 sb_target
.SetSP(target_sp
);
751 sb_error
.SetErrorString("invalid debugger");
754 Log
*log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API
));
756 "SBDebugger(%p)::CreateTarget (filename=\"%s\", triple=%s, "
757 "platform_name=%s, add_dependent_modules=%u, error=%s) => "
759 static_cast<void *>(m_opaque_sp
.get()), filename
, target_triple
,
760 platform_name
, add_dependent_modules
, sb_error
.GetCString(),
761 static_cast<void *>(target_sp
.get()));
763 return LLDB_RECORD_RESULT(sb_target
);
767 SBDebugger::CreateTargetWithFileAndTargetTriple(const char *filename
,
768 const char *target_triple
) {
769 LLDB_RECORD_METHOD(lldb::SBTarget
, SBDebugger
,
770 CreateTargetWithFileAndTargetTriple
,
771 (const char *, const char *), filename
, target_triple
);
776 const bool add_dependent_modules
= true;
777 Status
error(m_opaque_sp
->GetTargetList().CreateTarget(
778 *m_opaque_sp
, filename
, target_triple
,
779 add_dependent_modules
? eLoadDependentsYes
: eLoadDependentsNo
, nullptr,
781 sb_target
.SetSP(target_sp
);
784 Log
*log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API
));
786 "SBDebugger(%p)::CreateTargetWithFileAndTargetTriple "
787 "(filename=\"%s\", triple=%s) => SBTarget(%p)",
788 static_cast<void *>(m_opaque_sp
.get()), filename
, target_triple
,
789 static_cast<void *>(target_sp
.get()));
791 return LLDB_RECORD_RESULT(sb_target
);
794 SBTarget
SBDebugger::CreateTargetWithFileAndArch(const char *filename
,
795 const char *arch_cstr
) {
796 LLDB_RECORD_METHOD(lldb::SBTarget
, SBDebugger
, CreateTargetWithFileAndArch
,
797 (const char *, const char *), filename
, arch_cstr
);
799 Log
*log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API
));
805 const bool add_dependent_modules
= true;
807 error
= m_opaque_sp
->GetTargetList().CreateTarget(
808 *m_opaque_sp
, filename
, arch_cstr
,
809 add_dependent_modules
? eLoadDependentsYes
: eLoadDependentsNo
, nullptr,
812 if (error
.Success()) {
813 m_opaque_sp
->GetTargetList().SetSelectedTarget(target_sp
.get());
814 sb_target
.SetSP(target_sp
);
819 "SBDebugger(%p)::CreateTargetWithFileAndArch (filename=\"%s\", "
820 "arch=%s) => SBTarget(%p)",
821 static_cast<void *>(m_opaque_sp
.get()), filename
, arch_cstr
,
822 static_cast<void *>(target_sp
.get()));
824 return LLDB_RECORD_RESULT(sb_target
);
827 SBTarget
SBDebugger::CreateTarget(const char *filename
) {
828 LLDB_RECORD_METHOD(lldb::SBTarget
, SBDebugger
, CreateTarget
, (const char *),
835 const bool add_dependent_modules
= true;
836 error
= m_opaque_sp
->GetTargetList().CreateTarget(
837 *m_opaque_sp
, filename
, "",
838 add_dependent_modules
? eLoadDependentsYes
: eLoadDependentsNo
, nullptr,
841 if (error
.Success()) {
842 m_opaque_sp
->GetTargetList().SetSelectedTarget(target_sp
.get());
843 sb_target
.SetSP(target_sp
);
846 Log
*log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API
));
848 "SBDebugger(%p)::CreateTarget (filename=\"%s\") => SBTarget(%p)",
849 static_cast<void *>(m_opaque_sp
.get()), filename
,
850 static_cast<void *>(target_sp
.get()));
851 return LLDB_RECORD_RESULT(sb_target
);
854 SBTarget
SBDebugger::GetDummyTarget() {
855 LLDB_RECORD_METHOD_NO_ARGS(lldb::SBTarget
, SBDebugger
, GetDummyTarget
);
859 sb_target
.SetSP(m_opaque_sp
->GetDummyTarget()->shared_from_this());
861 Log
*log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API
));
862 LLDB_LOGF(log
, "SBDebugger(%p)::GetDummyTarget() => SBTarget(%p)",
863 static_cast<void *>(m_opaque_sp
.get()),
864 static_cast<void *>(sb_target
.GetSP().get()));
865 return LLDB_RECORD_RESULT(sb_target
);
868 bool SBDebugger::DeleteTarget(lldb::SBTarget
&target
) {
869 LLDB_RECORD_METHOD(bool, SBDebugger
, DeleteTarget
, (lldb::SBTarget
&),
874 TargetSP
target_sp(target
.GetSP());
876 // No need to lock, the target list is thread safe
877 result
= m_opaque_sp
->GetTargetList().DeleteTarget(target_sp
);
878 target_sp
->Destroy();
880 const bool mandatory
= true;
881 ModuleList::RemoveOrphanSharedModules(mandatory
);
885 Log
*log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API
));
886 LLDB_LOGF(log
, "SBDebugger(%p)::DeleteTarget (SBTarget(%p)) => %i",
887 static_cast<void *>(m_opaque_sp
.get()),
888 static_cast<void *>(target
.m_opaque_sp
.get()), result
);
893 SBTarget
SBDebugger::GetTargetAtIndex(uint32_t idx
) {
894 LLDB_RECORD_METHOD(lldb::SBTarget
, SBDebugger
, GetTargetAtIndex
, (uint32_t),
899 // No need to lock, the target list is thread safe
900 sb_target
.SetSP(m_opaque_sp
->GetTargetList().GetTargetAtIndex(idx
));
902 return LLDB_RECORD_RESULT(sb_target
);
905 uint32_t SBDebugger::GetIndexOfTarget(lldb::SBTarget target
) {
906 LLDB_RECORD_METHOD(uint32_t, SBDebugger
, GetIndexOfTarget
, (lldb::SBTarget
),
909 lldb::TargetSP target_sp
= target
.GetSP();
916 return m_opaque_sp
->GetTargetList().GetIndexOfTarget(target
.GetSP());
919 SBTarget
SBDebugger::FindTargetWithProcessID(lldb::pid_t pid
) {
920 LLDB_RECORD_METHOD(lldb::SBTarget
, SBDebugger
, FindTargetWithProcessID
,
925 // No need to lock, the target list is thread safe
926 sb_target
.SetSP(m_opaque_sp
->GetTargetList().FindTargetWithProcessID(pid
));
928 return LLDB_RECORD_RESULT(sb_target
);
931 SBTarget
SBDebugger::FindTargetWithFileAndArch(const char *filename
,
932 const char *arch_name
) {
933 LLDB_RECORD_METHOD(lldb::SBTarget
, SBDebugger
, FindTargetWithFileAndArch
,
934 (const char *, const char *), filename
, arch_name
);
937 if (m_opaque_sp
&& filename
&& filename
[0]) {
938 // No need to lock, the target list is thread safe
939 ArchSpec arch
= Platform::GetAugmentedArchSpec(
940 m_opaque_sp
->GetPlatformList().GetSelectedPlatform().get(), arch_name
);
942 m_opaque_sp
->GetTargetList().FindTargetWithExecutableAndArchitecture(
943 FileSpec(filename
), arch_name
? &arch
: nullptr));
944 sb_target
.SetSP(target_sp
);
946 return LLDB_RECORD_RESULT(sb_target
);
949 SBTarget
SBDebugger::FindTargetWithLLDBProcess(const ProcessSP
&process_sp
) {
952 // No need to lock, the target list is thread safe
954 m_opaque_sp
->GetTargetList().FindTargetWithProcess(process_sp
.get()));
959 uint32_t SBDebugger::GetNumTargets() {
960 LLDB_RECORD_METHOD_NO_ARGS(uint32_t, SBDebugger
, GetNumTargets
);
963 // No need to lock, the target list is thread safe
964 return m_opaque_sp
->GetTargetList().GetNumTargets();
969 SBTarget
SBDebugger::GetSelectedTarget() {
970 LLDB_RECORD_METHOD_NO_ARGS(lldb::SBTarget
, SBDebugger
, GetSelectedTarget
);
972 Log
*log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API
));
977 // No need to lock, the target list is thread safe
978 target_sp
= m_opaque_sp
->GetTargetList().GetSelectedTarget();
979 sb_target
.SetSP(target_sp
);
984 sb_target
.GetDescription(sstr
, eDescriptionLevelBrief
);
985 LLDB_LOGF(log
, "SBDebugger(%p)::GetSelectedTarget () => SBTarget(%p): %s",
986 static_cast<void *>(m_opaque_sp
.get()),
987 static_cast<void *>(target_sp
.get()), sstr
.GetData());
990 return LLDB_RECORD_RESULT(sb_target
);
993 void SBDebugger::SetSelectedTarget(SBTarget
&sb_target
) {
994 LLDB_RECORD_METHOD(void, SBDebugger
, SetSelectedTarget
, (lldb::SBTarget
&),
997 Log
*log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API
));
999 TargetSP
target_sp(sb_target
.GetSP());
1001 m_opaque_sp
->GetTargetList().SetSelectedTarget(target_sp
.get());
1005 sb_target
.GetDescription(sstr
, eDescriptionLevelBrief
);
1006 LLDB_LOGF(log
, "SBDebugger(%p)::SetSelectedTarget () => SBTarget(%p): %s",
1007 static_cast<void *>(m_opaque_sp
.get()),
1008 static_cast<void *>(target_sp
.get()), sstr
.GetData());
1012 SBPlatform
SBDebugger::GetSelectedPlatform() {
1013 LLDB_RECORD_METHOD_NO_ARGS(lldb::SBPlatform
, SBDebugger
, GetSelectedPlatform
);
1015 Log
*log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API
));
1017 SBPlatform sb_platform
;
1018 DebuggerSP
debugger_sp(m_opaque_sp
);
1020 sb_platform
.SetSP(debugger_sp
->GetPlatformList().GetSelectedPlatform());
1022 LLDB_LOGF(log
, "SBDebugger(%p)::GetSelectedPlatform () => SBPlatform(%p): %s",
1023 static_cast<void *>(m_opaque_sp
.get()),
1024 static_cast<void *>(sb_platform
.GetSP().get()),
1025 sb_platform
.GetName());
1026 return LLDB_RECORD_RESULT(sb_platform
);
1029 void SBDebugger::SetSelectedPlatform(SBPlatform
&sb_platform
) {
1030 LLDB_RECORD_METHOD(void, SBDebugger
, SetSelectedPlatform
,
1031 (lldb::SBPlatform
&), sb_platform
);
1033 Log
*log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API
));
1035 DebuggerSP
debugger_sp(m_opaque_sp
);
1037 debugger_sp
->GetPlatformList().SetSelectedPlatform(sb_platform
.GetSP());
1040 LLDB_LOGF(log
, "SBDebugger(%p)::SetSelectedPlatform (SBPlatform(%p) %s)",
1041 static_cast<void *>(m_opaque_sp
.get()),
1042 static_cast<void *>(sb_platform
.GetSP().get()),
1043 sb_platform
.GetName());
1046 uint32_t SBDebugger::GetNumPlatforms() {
1047 LLDB_RECORD_METHOD_NO_ARGS(uint32_t, SBDebugger
, GetNumPlatforms
);
1050 // No need to lock, the platform list is thread safe
1051 return m_opaque_sp
->GetPlatformList().GetSize();
1056 SBPlatform
SBDebugger::GetPlatformAtIndex(uint32_t idx
) {
1057 LLDB_RECORD_METHOD(lldb::SBPlatform
, SBDebugger
, GetPlatformAtIndex
,
1060 SBPlatform sb_platform
;
1062 // No need to lock, the platform list is thread safe
1063 sb_platform
.SetSP(m_opaque_sp
->GetPlatformList().GetAtIndex(idx
));
1065 return LLDB_RECORD_RESULT(sb_platform
);
1068 uint32_t SBDebugger::GetNumAvailablePlatforms() {
1069 LLDB_RECORD_METHOD_NO_ARGS(uint32_t, SBDebugger
, GetNumAvailablePlatforms
);
1073 if (!PluginManager::GetPlatformPluginNameAtIndex(idx
)) {
1078 // +1 for the host platform, which should always appear first in the list.
1082 SBStructuredData
SBDebugger::GetAvailablePlatformInfoAtIndex(uint32_t idx
) {
1083 LLDB_RECORD_METHOD(lldb::SBStructuredData
, SBDebugger
,
1084 GetAvailablePlatformInfoAtIndex
, (uint32_t), idx
);
1086 SBStructuredData data
;
1087 auto platform_dict
= std::make_unique
<StructuredData::Dictionary
>();
1088 llvm::StringRef
name_str("name"), desc_str("description");
1091 PlatformSP
host_platform_sp(Platform::GetHostPlatform());
1092 platform_dict
->AddStringItem(
1093 name_str
, host_platform_sp
->GetPluginName().GetStringRef());
1094 platform_dict
->AddStringItem(
1095 desc_str
, llvm::StringRef(host_platform_sp
->GetDescription()));
1096 } else if (idx
> 0) {
1097 const char *plugin_name
=
1098 PluginManager::GetPlatformPluginNameAtIndex(idx
- 1);
1100 return LLDB_RECORD_RESULT(data
);
1102 platform_dict
->AddStringItem(name_str
, llvm::StringRef(plugin_name
));
1104 const char *plugin_desc
=
1105 PluginManager::GetPlatformPluginDescriptionAtIndex(idx
- 1);
1107 return LLDB_RECORD_RESULT(data
);
1109 platform_dict
->AddStringItem(desc_str
, llvm::StringRef(plugin_desc
));
1112 data
.m_impl_up
->SetObjectSP(
1113 StructuredData::ObjectSP(platform_dict
.release()));
1114 return LLDB_RECORD_RESULT(data
);
1117 void SBDebugger::DispatchInput(void *baton
, const void *data
, size_t data_len
) {
1118 LLDB_RECORD_DUMMY(void, SBDebugger
, DispatchInput
,
1119 (void *, const void *, size_t), baton
, data
, data_len
);
1121 DispatchInput(data
, data_len
);
1124 void SBDebugger::DispatchInput(const void *data
, size_t data_len
) {
1125 LLDB_RECORD_DUMMY(void, SBDebugger
, DispatchInput
, (const void *, size_t),
1128 // Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
1131 // LLDB_LOGF(log, "SBDebugger(%p)::DispatchInput (data=\"%.*s\",
1132 // size_t=%" PRIu64 ")",
1133 // m_opaque_sp.get(),
1135 // (const char *) data,
1136 // (uint64_t)data_len);
1139 // m_opaque_sp->DispatchInput ((const char *) data, data_len);
1142 void SBDebugger::DispatchInputInterrupt() {
1143 LLDB_RECORD_DUMMY_NO_ARGS(void, SBDebugger
, DispatchInputInterrupt
);
1146 m_opaque_sp
->DispatchInputInterrupt();
1149 void SBDebugger::DispatchInputEndOfFile() {
1150 LLDB_RECORD_METHOD_NO_ARGS(void, SBDebugger
, DispatchInputEndOfFile
);
1153 m_opaque_sp
->DispatchInputEndOfFile();
1156 void SBDebugger::PushInputReader(SBInputReader
&reader
) {
1157 LLDB_RECORD_METHOD(void, SBDebugger
, PushInputReader
, (lldb::SBInputReader
&),
1161 void SBDebugger::RunCommandInterpreter(bool auto_handle_events
,
1162 bool spawn_thread
) {
1163 LLDB_RECORD_METHOD(void, SBDebugger
, RunCommandInterpreter
, (bool, bool),
1164 auto_handle_events
, spawn_thread
);
1167 CommandInterpreterRunOptions options
;
1169 m_opaque_sp
->GetCommandInterpreter().RunCommandInterpreter(
1170 auto_handle_events
, spawn_thread
, options
);
1174 void SBDebugger::RunCommandInterpreter(bool auto_handle_events
,
1176 SBCommandInterpreterRunOptions
&options
,
1177 int &num_errors
, bool &quit_requested
,
1178 bool &stopped_for_crash
)
1181 LLDB_RECORD_METHOD(void, SBDebugger
, RunCommandInterpreter
,
1182 (bool, bool, lldb::SBCommandInterpreterRunOptions
&, int &,
1184 auto_handle_events
, spawn_thread
, options
, num_errors
,
1185 quit_requested
, stopped_for_crash
);
1188 CommandInterpreter
&interp
= m_opaque_sp
->GetCommandInterpreter();
1189 interp
.RunCommandInterpreter(auto_handle_events
, spawn_thread
,
1191 num_errors
= interp
.GetNumErrors();
1192 quit_requested
= interp
.GetQuitRequested();
1193 stopped_for_crash
= interp
.GetStoppedForCrash();
1197 SBError
SBDebugger::RunREPL(lldb::LanguageType language
,
1198 const char *repl_options
) {
1199 LLDB_RECORD_METHOD(lldb::SBError
, SBDebugger
, RunREPL
,
1200 (lldb::LanguageType
, const char *), language
,
1205 error
.ref() = m_opaque_sp
->RunREPL(language
, repl_options
);
1207 error
.SetErrorString("invalid debugger");
1208 return LLDB_RECORD_RESULT(error
);
1211 void SBDebugger::reset(const DebuggerSP
&debugger_sp
) {
1212 m_opaque_sp
= debugger_sp
;
1215 Debugger
*SBDebugger::get() const { return m_opaque_sp
.get(); }
1217 Debugger
&SBDebugger::ref() const {
1218 assert(m_opaque_sp
.get());
1219 return *m_opaque_sp
;
1222 const lldb::DebuggerSP
&SBDebugger::get_sp() const { return m_opaque_sp
; }
1224 SBDebugger
SBDebugger::FindDebuggerWithID(int id
) {
1225 LLDB_RECORD_STATIC_METHOD(lldb::SBDebugger
, SBDebugger
, FindDebuggerWithID
,
1228 // No need to lock, the debugger list is thread safe
1229 SBDebugger sb_debugger
;
1230 DebuggerSP debugger_sp
= Debugger::FindDebuggerWithID(id
);
1232 sb_debugger
.reset(debugger_sp
);
1233 return LLDB_RECORD_RESULT(sb_debugger
);
1236 const char *SBDebugger::GetInstanceName() {
1237 LLDB_RECORD_METHOD_NO_ARGS(const char *, SBDebugger
, GetInstanceName
);
1239 return (m_opaque_sp
? m_opaque_sp
->GetInstanceName().AsCString() : nullptr);
1242 SBError
SBDebugger::SetInternalVariable(const char *var_name
, const char *value
,
1243 const char *debugger_instance_name
) {
1244 LLDB_RECORD_STATIC_METHOD(lldb::SBError
, SBDebugger
, SetInternalVariable
,
1245 (const char *, const char *, const char *),
1246 var_name
, value
, debugger_instance_name
);
1249 DebuggerSP
debugger_sp(Debugger::FindDebuggerWithInstanceName(
1250 ConstString(debugger_instance_name
)));
1253 ExecutionContext
exe_ctx(
1254 debugger_sp
->GetCommandInterpreter().GetExecutionContext());
1255 error
= debugger_sp
->SetPropertyValue(&exe_ctx
, eVarSetOperationAssign
,
1258 error
.SetErrorStringWithFormat("invalid debugger instance name '%s'",
1259 debugger_instance_name
);
1262 sb_error
.SetError(error
);
1263 return LLDB_RECORD_RESULT(sb_error
);
1267 SBDebugger::GetInternalVariableValue(const char *var_name
,
1268 const char *debugger_instance_name
) {
1269 LLDB_RECORD_STATIC_METHOD(
1270 lldb::SBStringList
, SBDebugger
, GetInternalVariableValue
,
1271 (const char *, const char *), var_name
, debugger_instance_name
);
1273 SBStringList ret_value
;
1274 DebuggerSP
debugger_sp(Debugger::FindDebuggerWithInstanceName(
1275 ConstString(debugger_instance_name
)));
1278 ExecutionContext
exe_ctx(
1279 debugger_sp
->GetCommandInterpreter().GetExecutionContext());
1280 lldb::OptionValueSP
value_sp(
1281 debugger_sp
->GetPropertyValue(&exe_ctx
, var_name
, false, error
));
1283 StreamString value_strm
;
1284 value_sp
->DumpValue(&exe_ctx
, value_strm
, OptionValue::eDumpOptionValue
);
1285 const std::string
&value_str
= value_strm
.GetString();
1286 if (!value_str
.empty()) {
1287 StringList string_list
;
1288 string_list
.SplitIntoLines(value_str
);
1289 return LLDB_RECORD_RESULT(SBStringList(&string_list
));
1293 return LLDB_RECORD_RESULT(SBStringList());
1296 uint32_t SBDebugger::GetTerminalWidth() const {
1297 LLDB_RECORD_METHOD_CONST_NO_ARGS(uint32_t, SBDebugger
, GetTerminalWidth
);
1299 return (m_opaque_sp
? m_opaque_sp
->GetTerminalWidth() : 0);
1302 void SBDebugger::SetTerminalWidth(uint32_t term_width
) {
1303 LLDB_RECORD_DUMMY(void, SBDebugger
, SetTerminalWidth
, (uint32_t), term_width
);
1306 m_opaque_sp
->SetTerminalWidth(term_width
);
1309 const char *SBDebugger::GetPrompt() const {
1310 LLDB_RECORD_METHOD_CONST_NO_ARGS(const char *, SBDebugger
, GetPrompt
);
1312 Log
*log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API
));
1314 LLDB_LOGF(log
, "SBDebugger(%p)::GetPrompt () => \"%s\"",
1315 static_cast<void *>(m_opaque_sp
.get()),
1316 (m_opaque_sp
? m_opaque_sp
->GetPrompt().str().c_str() : ""));
1318 return (m_opaque_sp
? ConstString(m_opaque_sp
->GetPrompt()).GetCString()
1322 void SBDebugger::SetPrompt(const char *prompt
) {
1323 LLDB_RECORD_METHOD(void, SBDebugger
, SetPrompt
, (const char *), prompt
);
1326 m_opaque_sp
->SetPrompt(llvm::StringRef::withNullAsEmpty(prompt
));
1329 const char *SBDebugger::GetReproducerPath() const {
1330 LLDB_RECORD_METHOD_CONST_NO_ARGS(const char *, SBDebugger
, GetReproducerPath
);
1333 ? ConstString(m_opaque_sp
->GetReproducerPath()).GetCString()
1337 ScriptLanguage
SBDebugger::GetScriptLanguage() const {
1338 LLDB_RECORD_METHOD_CONST_NO_ARGS(lldb::ScriptLanguage
, SBDebugger
,
1341 return (m_opaque_sp
? m_opaque_sp
->GetScriptLanguage() : eScriptLanguageNone
);
1344 void SBDebugger::SetScriptLanguage(ScriptLanguage script_lang
) {
1345 LLDB_RECORD_METHOD(void, SBDebugger
, SetScriptLanguage
,
1346 (lldb::ScriptLanguage
), script_lang
);
1349 m_opaque_sp
->SetScriptLanguage(script_lang
);
1353 bool SBDebugger::SetUseExternalEditor(bool value
) {
1354 LLDB_RECORD_METHOD(bool, SBDebugger
, SetUseExternalEditor
, (bool), value
);
1356 return (m_opaque_sp
? m_opaque_sp
->SetUseExternalEditor(value
) : false);
1359 bool SBDebugger::GetUseExternalEditor() {
1360 LLDB_RECORD_METHOD_NO_ARGS(bool, SBDebugger
, GetUseExternalEditor
);
1362 return (m_opaque_sp
? m_opaque_sp
->GetUseExternalEditor() : false);
1365 bool SBDebugger::SetUseColor(bool value
) {
1366 LLDB_RECORD_METHOD(bool, SBDebugger
, SetUseColor
, (bool), value
);
1368 return (m_opaque_sp
? m_opaque_sp
->SetUseColor(value
) : false);
1371 bool SBDebugger::GetUseColor() const {
1372 LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBDebugger
, GetUseColor
);
1374 return (m_opaque_sp
? m_opaque_sp
->GetUseColor() : false);
1377 bool SBDebugger::GetDescription(SBStream
&description
) {
1378 LLDB_RECORD_METHOD(bool, SBDebugger
, GetDescription
, (lldb::SBStream
&),
1381 Stream
&strm
= description
.ref();
1384 const char *name
= m_opaque_sp
->GetInstanceName().AsCString();
1385 user_id_t id
= m_opaque_sp
->GetID();
1386 strm
.Printf("Debugger (instance: \"%s\", id: %" PRIu64
")", name
, id
);
1388 strm
.PutCString("No value");
1393 user_id_t
SBDebugger::GetID() {
1394 LLDB_RECORD_METHOD_NO_ARGS(lldb::user_id_t
, SBDebugger
, GetID
);
1396 return (m_opaque_sp
? m_opaque_sp
->GetID() : LLDB_INVALID_UID
);
1399 SBError
SBDebugger::SetCurrentPlatform(const char *platform_name_cstr
) {
1400 LLDB_RECORD_METHOD(lldb::SBError
, SBDebugger
, SetCurrentPlatform
,
1401 (const char *), platform_name_cstr
);
1405 if (platform_name_cstr
&& platform_name_cstr
[0]) {
1406 ConstString
platform_name(platform_name_cstr
);
1407 PlatformSP
platform_sp(Platform::Find(platform_name
));
1410 // Already have a platform with this name, just select it
1411 m_opaque_sp
->GetPlatformList().SetSelectedPlatform(platform_sp
);
1413 // We don't have a platform by this name yet, create one
1414 platform_sp
= Platform::Create(platform_name
, sb_error
.ref());
1416 // We created the platform, now append and select it
1417 bool make_selected
= true;
1418 m_opaque_sp
->GetPlatformList().Append(platform_sp
, make_selected
);
1422 sb_error
.ref().SetErrorString("invalid platform name");
1425 sb_error
.ref().SetErrorString("invalid debugger");
1427 return LLDB_RECORD_RESULT(sb_error
);
1430 bool SBDebugger::SetCurrentPlatformSDKRoot(const char *sysroot
) {
1431 LLDB_RECORD_METHOD(bool, SBDebugger
, SetCurrentPlatformSDKRoot
,
1432 (const char *), sysroot
);
1434 Log
*log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API
));
1436 PlatformSP
platform_sp(
1437 m_opaque_sp
->GetPlatformList().GetSelectedPlatform());
1441 LLDB_LOGF(log
, "SBDebugger::SetCurrentPlatformSDKRoot (\"%s\")",
1443 platform_sp
->SetSDKRootDirectory(ConstString(sysroot
));
1450 bool SBDebugger::GetCloseInputOnEOF() const {
1451 LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBDebugger
, GetCloseInputOnEOF
);
1453 return (m_opaque_sp
? m_opaque_sp
->GetCloseInputOnEOF() : false);
1456 void SBDebugger::SetCloseInputOnEOF(bool b
) {
1457 LLDB_RECORD_METHOD(void, SBDebugger
, SetCloseInputOnEOF
, (bool), b
);
1460 m_opaque_sp
->SetCloseInputOnEOF(b
);
1463 SBTypeCategory
SBDebugger::GetCategory(const char *category_name
) {
1464 LLDB_RECORD_METHOD(lldb::SBTypeCategory
, SBDebugger
, GetCategory
,
1465 (const char *), category_name
);
1467 if (!category_name
|| *category_name
== 0)
1468 return LLDB_RECORD_RESULT(SBTypeCategory());
1470 TypeCategoryImplSP category_sp
;
1472 if (DataVisualization::Categories::GetCategory(ConstString(category_name
),
1473 category_sp
, false)) {
1474 return LLDB_RECORD_RESULT(SBTypeCategory(category_sp
));
1476 return LLDB_RECORD_RESULT(SBTypeCategory());
1480 SBTypeCategory
SBDebugger::GetCategory(lldb::LanguageType lang_type
) {
1481 LLDB_RECORD_METHOD(lldb::SBTypeCategory
, SBDebugger
, GetCategory
,
1482 (lldb::LanguageType
), lang_type
);
1484 TypeCategoryImplSP category_sp
;
1485 if (DataVisualization::Categories::GetCategory(lang_type
, category_sp
)) {
1486 return LLDB_RECORD_RESULT(SBTypeCategory(category_sp
));
1488 return LLDB_RECORD_RESULT(SBTypeCategory());
1492 SBTypeCategory
SBDebugger::CreateCategory(const char *category_name
) {
1493 LLDB_RECORD_METHOD(lldb::SBTypeCategory
, SBDebugger
, CreateCategory
,
1494 (const char *), category_name
);
1496 if (!category_name
|| *category_name
== 0)
1497 return LLDB_RECORD_RESULT(SBTypeCategory());
1499 TypeCategoryImplSP category_sp
;
1501 if (DataVisualization::Categories::GetCategory(ConstString(category_name
),
1502 category_sp
, true)) {
1503 return LLDB_RECORD_RESULT(SBTypeCategory(category_sp
));
1505 return LLDB_RECORD_RESULT(SBTypeCategory());
1509 bool SBDebugger::DeleteCategory(const char *category_name
) {
1510 LLDB_RECORD_METHOD(bool, SBDebugger
, DeleteCategory
, (const char *),
1513 if (!category_name
|| *category_name
== 0)
1516 return DataVisualization::Categories::Delete(ConstString(category_name
));
1519 uint32_t SBDebugger::GetNumCategories() {
1520 LLDB_RECORD_METHOD_NO_ARGS(uint32_t, SBDebugger
, GetNumCategories
);
1522 return DataVisualization::Categories::GetCount();
1525 SBTypeCategory
SBDebugger::GetCategoryAtIndex(uint32_t index
) {
1526 LLDB_RECORD_METHOD(lldb::SBTypeCategory
, SBDebugger
, GetCategoryAtIndex
,
1529 return LLDB_RECORD_RESULT(
1530 SBTypeCategory(DataVisualization::Categories::GetCategoryAtIndex(index
)));
1533 SBTypeCategory
SBDebugger::GetDefaultCategory() {
1534 LLDB_RECORD_METHOD_NO_ARGS(lldb::SBTypeCategory
, SBDebugger
,
1535 GetDefaultCategory
);
1537 return LLDB_RECORD_RESULT(GetCategory("default"));
1540 SBTypeFormat
SBDebugger::GetFormatForType(SBTypeNameSpecifier type_name
) {
1541 LLDB_RECORD_METHOD(lldb::SBTypeFormat
, SBDebugger
, GetFormatForType
,
1542 (lldb::SBTypeNameSpecifier
), type_name
);
1544 SBTypeCategory default_category_sb
= GetDefaultCategory();
1545 if (default_category_sb
.GetEnabled())
1546 return LLDB_RECORD_RESULT(default_category_sb
.GetFormatForType(type_name
));
1547 return LLDB_RECORD_RESULT(SBTypeFormat());
1550 SBTypeSummary
SBDebugger::GetSummaryForType(SBTypeNameSpecifier type_name
) {
1551 LLDB_RECORD_METHOD(lldb::SBTypeSummary
, SBDebugger
, GetSummaryForType
,
1552 (lldb::SBTypeNameSpecifier
), type_name
);
1554 if (!type_name
.IsValid())
1555 return LLDB_RECORD_RESULT(SBTypeSummary());
1556 return LLDB_RECORD_RESULT(
1557 SBTypeSummary(DataVisualization::GetSummaryForType(type_name
.GetSP())));
1560 SBTypeFilter
SBDebugger::GetFilterForType(SBTypeNameSpecifier type_name
) {
1561 LLDB_RECORD_METHOD(lldb::SBTypeFilter
, SBDebugger
, GetFilterForType
,
1562 (lldb::SBTypeNameSpecifier
), type_name
);
1564 if (!type_name
.IsValid())
1565 return LLDB_RECORD_RESULT(SBTypeFilter());
1566 return LLDB_RECORD_RESULT(
1567 SBTypeFilter(DataVisualization::GetFilterForType(type_name
.GetSP())));
1570 SBTypeSynthetic
SBDebugger::GetSyntheticForType(SBTypeNameSpecifier type_name
) {
1571 LLDB_RECORD_METHOD(lldb::SBTypeSynthetic
, SBDebugger
, GetSyntheticForType
,
1572 (lldb::SBTypeNameSpecifier
), type_name
);
1574 if (!type_name
.IsValid())
1575 return LLDB_RECORD_RESULT(SBTypeSynthetic());
1576 return LLDB_RECORD_RESULT(SBTypeSynthetic(
1577 DataVisualization::GetSyntheticForType(type_name
.GetSP())));
1580 static llvm::ArrayRef
<const char *> GetCategoryArray(const char **categories
) {
1581 if (categories
== nullptr)
1584 while (categories
[len
] != nullptr)
1586 return llvm::makeArrayRef(categories
, len
);
1589 bool SBDebugger::EnableLog(const char *channel
, const char **categories
) {
1590 LLDB_RECORD_METHOD(bool, SBDebugger
, EnableLog
, (const char *, const char **),
1591 channel
, categories
);
1594 uint32_t log_options
=
1595 LLDB_LOG_OPTION_PREPEND_TIMESTAMP
| LLDB_LOG_OPTION_PREPEND_THREAD_NAME
;
1597 llvm::raw_string_ostream
error_stream(error
);
1598 return m_opaque_sp
->EnableLog(channel
, GetCategoryArray(categories
), "",
1599 log_options
, error_stream
);
1604 void SBDebugger::SetLoggingCallback(lldb::LogOutputCallback log_callback
,
1606 LLDB_RECORD_DUMMY(void, SBDebugger
, SetLoggingCallback
,
1607 (lldb::LogOutputCallback
, void *), log_callback
, baton
);
1610 return m_opaque_sp
->SetLoggingCallback(log_callback
, baton
);
1614 namespace lldb_private
{
1617 template <> void RegisterMethods
<SBInputReader
>(Registry
&R
) {
1618 LLDB_REGISTER_METHOD(void, SBInputReader
, SetIsDone
, (bool));
1619 LLDB_REGISTER_METHOD_CONST(bool, SBInputReader
, IsActive
, ());
1622 static void SetFileHandleRedirect(SBDebugger
*, FILE *, bool) {
1626 static SBError
SetFileRedirect(SBDebugger
*, SBFile file
) { return SBError(); }
1628 static SBError
SetFileRedirect(SBDebugger
*, FileSP file
) { return SBError(); }
1630 static bool GetDefaultArchitectureRedirect(char *arch_name
,
1631 size_t arch_name_len
) {
1632 // The function is writing to its argument. Without the redirect it would
1633 // write into the replay buffer.
1635 return SBDebugger::GetDefaultArchitecture(buffer
, arch_name_len
);
1638 template <> void RegisterMethods
<SBDebugger
>(Registry
&R
) {
1639 // Custom implementation.
1640 R
.Register(&invoke
<void (SBDebugger::*)(
1641 FILE *, bool)>::method
<&SBDebugger::SetErrorFileHandle
>::doit
,
1642 &SetFileHandleRedirect
);
1643 R
.Register(&invoke
<void (SBDebugger::*)(
1644 FILE *, bool)>::method
<&SBDebugger::SetOutputFileHandle
>::doit
,
1645 &SetFileHandleRedirect
);
1646 R
.Register
<bool(char *, size_t)>(static_cast<bool (*)(char *, size_t)>(
1647 &SBDebugger::GetDefaultArchitecture
),
1648 &GetDefaultArchitectureRedirect
);
1650 R
.Register(&invoke
<SBError (SBDebugger::*)(
1651 SBFile
)>::method
<&SBDebugger::SetInputFile
>::doit
,
1653 R
.Register(&invoke
<SBError (SBDebugger::*)(
1654 SBFile
)>::method
<&SBDebugger::SetOutputFile
>::doit
,
1656 R
.Register(&invoke
<SBError (SBDebugger::*)(
1657 SBFile
)>::method
<&SBDebugger::SetErrorFile
>::doit
,
1660 R
.Register(&invoke
<SBError (SBDebugger::*)(
1661 FileSP
)>::method
<&SBDebugger::SetInputFile
>::doit
,
1663 R
.Register(&invoke
<SBError (SBDebugger::*)(
1664 FileSP
)>::method
<&SBDebugger::SetOutputFile
>::doit
,
1666 R
.Register(&invoke
<SBError (SBDebugger::*)(
1667 FileSP
)>::method
<&SBDebugger::SetErrorFile
>::doit
,
1670 LLDB_REGISTER_CONSTRUCTOR(SBDebugger
, ());
1671 LLDB_REGISTER_CONSTRUCTOR(SBDebugger
, (const lldb::DebuggerSP
&));
1672 LLDB_REGISTER_CONSTRUCTOR(SBDebugger
, (const lldb::SBDebugger
&));
1673 LLDB_REGISTER_METHOD(lldb::SBDebugger
&,
1674 SBDebugger
, operator=,(const lldb::SBDebugger
&));
1675 LLDB_REGISTER_STATIC_METHOD(void, SBDebugger
, Initialize
, ());
1676 LLDB_REGISTER_STATIC_METHOD(lldb::SBError
, SBDebugger
,
1677 InitializeWithErrorHandling
, ());
1678 LLDB_REGISTER_STATIC_METHOD(void, SBDebugger
, Terminate
, ());
1679 LLDB_REGISTER_METHOD(void, SBDebugger
, Clear
, ());
1680 LLDB_REGISTER_STATIC_METHOD(lldb::SBDebugger
, SBDebugger
, Create
, ());
1681 LLDB_REGISTER_STATIC_METHOD(lldb::SBDebugger
, SBDebugger
, Create
, (bool));
1682 LLDB_REGISTER_STATIC_METHOD(void, SBDebugger
, Destroy
, (lldb::SBDebugger
&));
1683 LLDB_REGISTER_STATIC_METHOD(void, SBDebugger
, MemoryPressureDetected
, ());
1684 LLDB_REGISTER_METHOD_CONST(bool, SBDebugger
, IsValid
, ());
1685 LLDB_REGISTER_METHOD_CONST(bool, SBDebugger
, operator bool,());
1686 LLDB_REGISTER_METHOD(void, SBDebugger
, SetAsync
, (bool));
1687 LLDB_REGISTER_METHOD(bool, SBDebugger
, GetAsync
, ());
1688 LLDB_REGISTER_METHOD(void, SBDebugger
, SkipLLDBInitFiles
, (bool));
1689 LLDB_REGISTER_METHOD(void, SBDebugger
, SkipAppInitFiles
, (bool));
1690 LLDB_REGISTER_METHOD(void, SBDebugger
, SetInputFileHandle
, (FILE *, bool));
1691 LLDB_REGISTER_METHOD(FILE *, SBDebugger
, GetInputFileHandle
, ());
1692 LLDB_REGISTER_METHOD(FILE *, SBDebugger
, GetOutputFileHandle
, ());
1693 LLDB_REGISTER_METHOD(FILE *, SBDebugger
, GetErrorFileHandle
, ());
1694 LLDB_REGISTER_METHOD(SBFile
, SBDebugger
, GetInputFile
, ());
1695 LLDB_REGISTER_METHOD(SBFile
, SBDebugger
, GetOutputFile
, ());
1696 LLDB_REGISTER_METHOD(SBFile
, SBDebugger
, GetErrorFile
, ());
1697 LLDB_REGISTER_METHOD(void, SBDebugger
, SaveInputTerminalState
, ());
1698 LLDB_REGISTER_METHOD(void, SBDebugger
, RestoreInputTerminalState
, ());
1699 LLDB_REGISTER_METHOD(lldb::SBCommandInterpreter
, SBDebugger
,
1700 GetCommandInterpreter
, ());
1701 LLDB_REGISTER_METHOD(void, SBDebugger
, HandleCommand
, (const char *));
1702 LLDB_REGISTER_METHOD(lldb::SBListener
, SBDebugger
, GetListener
, ());
1703 LLDB_REGISTER_METHOD(
1704 void, SBDebugger
, HandleProcessEvent
,
1705 (const lldb::SBProcess
&, const lldb::SBEvent
&, FILE *, FILE *));
1706 LLDB_REGISTER_METHOD(
1707 void, SBDebugger
, HandleProcessEvent
,
1708 (const lldb::SBProcess
&, const lldb::SBEvent
&, SBFile
, SBFile
));
1709 LLDB_REGISTER_METHOD(
1710 void, SBDebugger
, HandleProcessEvent
,
1711 (const lldb::SBProcess
&, const lldb::SBEvent
&, FileSP
, FileSP
));
1712 LLDB_REGISTER_METHOD(lldb::SBSourceManager
, SBDebugger
, GetSourceManager
, ());
1713 LLDB_REGISTER_STATIC_METHOD(bool, SBDebugger
, SetDefaultArchitecture
,
1715 LLDB_REGISTER_METHOD(lldb::ScriptLanguage
, SBDebugger
, GetScriptingLanguage
,
1717 LLDB_REGISTER_STATIC_METHOD(const char *, SBDebugger
, GetVersionString
, ());
1718 LLDB_REGISTER_STATIC_METHOD(const char *, SBDebugger
, StateAsCString
,
1720 LLDB_REGISTER_STATIC_METHOD(lldb::SBStructuredData
, SBDebugger
,
1721 GetBuildConfiguration
, ());
1722 LLDB_REGISTER_STATIC_METHOD(bool, SBDebugger
, StateIsRunningState
,
1724 LLDB_REGISTER_STATIC_METHOD(bool, SBDebugger
, StateIsStoppedState
,
1726 LLDB_REGISTER_METHOD(
1727 lldb::SBTarget
, SBDebugger
, CreateTarget
,
1728 (const char *, const char *, const char *, bool, lldb::SBError
&));
1729 LLDB_REGISTER_METHOD(lldb::SBTarget
, SBDebugger
,
1730 CreateTargetWithFileAndTargetTriple
,
1731 (const char *, const char *));
1732 LLDB_REGISTER_METHOD(lldb::SBTarget
, SBDebugger
, CreateTargetWithFileAndArch
,
1733 (const char *, const char *));
1734 LLDB_REGISTER_METHOD(lldb::SBTarget
, SBDebugger
, CreateTarget
,
1736 LLDB_REGISTER_METHOD(lldb::SBTarget
, SBDebugger
, GetDummyTarget
, ());
1737 LLDB_REGISTER_METHOD(bool, SBDebugger
, DeleteTarget
, (lldb::SBTarget
&));
1738 LLDB_REGISTER_METHOD(lldb::SBTarget
, SBDebugger
, GetTargetAtIndex
,
1740 LLDB_REGISTER_METHOD(uint32_t, SBDebugger
, GetIndexOfTarget
,
1742 LLDB_REGISTER_METHOD(lldb::SBTarget
, SBDebugger
, FindTargetWithProcessID
,
1744 LLDB_REGISTER_METHOD(lldb::SBTarget
, SBDebugger
, FindTargetWithFileAndArch
,
1745 (const char *, const char *));
1746 LLDB_REGISTER_METHOD(uint32_t, SBDebugger
, GetNumTargets
, ());
1747 LLDB_REGISTER_METHOD(lldb::SBTarget
, SBDebugger
, GetSelectedTarget
, ());
1748 LLDB_REGISTER_METHOD(void, SBDebugger
, SetSelectedTarget
, (lldb::SBTarget
&));
1749 LLDB_REGISTER_METHOD(lldb::SBPlatform
, SBDebugger
, GetSelectedPlatform
, ());
1750 LLDB_REGISTER_METHOD(void, SBDebugger
, SetSelectedPlatform
,
1751 (lldb::SBPlatform
&));
1752 LLDB_REGISTER_METHOD(uint32_t, SBDebugger
, GetNumPlatforms
, ());
1753 LLDB_REGISTER_METHOD(lldb::SBPlatform
, SBDebugger
, GetPlatformAtIndex
,
1755 LLDB_REGISTER_METHOD(uint32_t, SBDebugger
, GetNumAvailablePlatforms
, ());
1756 LLDB_REGISTER_METHOD(lldb::SBStructuredData
, SBDebugger
,
1757 GetAvailablePlatformInfoAtIndex
, (uint32_t));
1758 LLDB_REGISTER_METHOD(void, SBDebugger
, DispatchInputInterrupt
, ());
1759 LLDB_REGISTER_METHOD(void, SBDebugger
, DispatchInputEndOfFile
, ());
1760 LLDB_REGISTER_METHOD(void, SBDebugger
, PushInputReader
,
1761 (lldb::SBInputReader
&));
1762 LLDB_REGISTER_METHOD(void, SBDebugger
, RunCommandInterpreter
, (bool, bool));
1763 LLDB_REGISTER_METHOD(void, SBDebugger
, RunCommandInterpreter
,
1764 (bool, bool, lldb::SBCommandInterpreterRunOptions
&,
1765 int &, bool &, bool &));
1766 LLDB_REGISTER_METHOD(lldb::SBError
, SBDebugger
, RunREPL
,
1767 (lldb::LanguageType
, const char *));
1768 LLDB_REGISTER_STATIC_METHOD(lldb::SBDebugger
, SBDebugger
, FindDebuggerWithID
,
1770 LLDB_REGISTER_METHOD(const char *, SBDebugger
, GetInstanceName
, ());
1771 LLDB_REGISTER_STATIC_METHOD(lldb::SBError
, SBDebugger
, SetInternalVariable
,
1772 (const char *, const char *, const char *));
1773 LLDB_REGISTER_STATIC_METHOD(lldb::SBStringList
, SBDebugger
,
1774 GetInternalVariableValue
,
1775 (const char *, const char *));
1776 LLDB_REGISTER_METHOD_CONST(uint32_t, SBDebugger
, GetTerminalWidth
, ());
1777 LLDB_REGISTER_METHOD(void, SBDebugger
, SetTerminalWidth
, (uint32_t));
1778 LLDB_REGISTER_METHOD_CONST(const char *, SBDebugger
, GetPrompt
, ());
1779 LLDB_REGISTER_METHOD(void, SBDebugger
, SetPrompt
, (const char *));
1780 LLDB_REGISTER_METHOD_CONST(const char *, SBDebugger
, GetReproducerPath
, ());
1781 LLDB_REGISTER_METHOD_CONST(lldb::ScriptLanguage
, SBDebugger
,
1782 GetScriptLanguage
, ());
1783 LLDB_REGISTER_METHOD(void, SBDebugger
, SetScriptLanguage
,
1784 (lldb::ScriptLanguage
));
1785 LLDB_REGISTER_METHOD(bool, SBDebugger
, SetUseExternalEditor
, (bool));
1786 LLDB_REGISTER_METHOD(bool, SBDebugger
, GetUseExternalEditor
, ());
1787 LLDB_REGISTER_METHOD(bool, SBDebugger
, SetUseColor
, (bool));
1788 LLDB_REGISTER_METHOD_CONST(bool, SBDebugger
, GetUseColor
, ());
1789 LLDB_REGISTER_METHOD(bool, SBDebugger
, GetDescription
, (lldb::SBStream
&));
1790 LLDB_REGISTER_METHOD(lldb::user_id_t
, SBDebugger
, GetID
, ());
1791 LLDB_REGISTER_METHOD(lldb::SBError
, SBDebugger
, SetCurrentPlatform
,
1793 LLDB_REGISTER_METHOD(bool, SBDebugger
, SetCurrentPlatformSDKRoot
,
1795 LLDB_REGISTER_METHOD_CONST(bool, SBDebugger
, GetCloseInputOnEOF
, ());
1796 LLDB_REGISTER_METHOD(void, SBDebugger
, SetCloseInputOnEOF
, (bool));
1797 LLDB_REGISTER_METHOD(lldb::SBTypeCategory
, SBDebugger
, GetCategory
,
1799 LLDB_REGISTER_METHOD(lldb::SBTypeCategory
, SBDebugger
, GetCategory
,
1800 (lldb::LanguageType
));
1801 LLDB_REGISTER_METHOD(lldb::SBTypeCategory
, SBDebugger
, CreateCategory
,
1803 LLDB_REGISTER_METHOD(bool, SBDebugger
, DeleteCategory
, (const char *));
1804 LLDB_REGISTER_METHOD(uint32_t, SBDebugger
, GetNumCategories
, ());
1805 LLDB_REGISTER_METHOD(lldb::SBTypeCategory
, SBDebugger
, GetCategoryAtIndex
,
1807 LLDB_REGISTER_METHOD(lldb::SBTypeCategory
, SBDebugger
, GetDefaultCategory
,
1809 LLDB_REGISTER_METHOD(lldb::SBTypeFormat
, SBDebugger
, GetFormatForType
,
1810 (lldb::SBTypeNameSpecifier
));
1811 LLDB_REGISTER_METHOD(lldb::SBTypeSummary
, SBDebugger
, GetSummaryForType
,
1812 (lldb::SBTypeNameSpecifier
));
1813 LLDB_REGISTER_METHOD(lldb::SBTypeSynthetic
, SBDebugger
, GetSyntheticForType
,
1814 (lldb::SBTypeNameSpecifier
));
1815 LLDB_REGISTER_METHOD(lldb::SBTypeFilter
, SBDebugger
, GetFilterForType
,
1816 (lldb::SBTypeNameSpecifier
));
1817 LLDB_REGISTER_METHOD(bool, SBDebugger
, EnableLog
,
1818 (const char *, const char **));
1821 } // namespace repro
1822 } // namespace lldb_private