LLDB mainline
SBDebugger.cpp
Go to the documentation of this file.
1//===-- SBDebugger.cpp ----------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
13
18#include "lldb/API/SBError.h"
19#include "lldb/API/SBEvent.h"
20#include "lldb/API/SBFile.h"
21#include "lldb/API/SBFrame.h"
23#include "lldb/API/SBListener.h"
24#include "lldb/API/SBProcess.h"
26#include "lldb/API/SBStream.h"
29#include "lldb/API/SBTarget.h"
30#include "lldb/API/SBThread.h"
31#include "lldb/API/SBTrace.h"
38
39#include "lldb/Core/Debugger.h"
43#include "lldb/Core/Progress.h"
46#include "lldb/Host/Config.h"
48#include "lldb/Host/XML.h"
54#include "lldb/Target/Process.h"
56#include "lldb/Utility/Args.h"
57#include "lldb/Utility/State.h"
59
60#include "llvm/ADT/STLExtras.h"
61#include "llvm/ADT/StringRef.h"
62#include "llvm/Config/llvm-config.h" // for LLVM_ENABLE_CURL
63#include "llvm/Support/DynamicLibrary.h"
64#include "llvm/Support/ManagedStatic.h"
65#include "llvm/Support/PrettyStackTrace.h"
66#include "llvm/Support/Signals.h"
67
68using namespace lldb;
69using namespace lldb_private;
70
71static llvm::ManagedStatic<SystemLifetimeManager> g_debugger_lifetime;
72
74
76
78 lldb::SBDebugger &sb_debugger,
79 unsigned long (*callback)(void *, lldb::SBInputReader *,
80 lldb::InputReaderAction, char const *,
81 unsigned long),
82 void *a, lldb::InputReaderGranularity b, char const *c, char const *d,
83 bool e) {
84 LLDB_INSTRUMENT_VA(this, sb_debugger, callback, a, b, c, d, e);
85
86 return SBError();
87}
88
90
93
94 return false;
95}
96
98
100 : m_opaque_sp(debugger_sp) {
101 LLDB_INSTRUMENT_VA(this, debugger_sp);
102}
103
107
108SBDebugger::~SBDebugger() = default;
109
111 LLDB_INSTRUMENT_VA(this, rhs);
112
113 if (this != &rhs) {
115 }
116 return *this;
117}
118
125
127 uint64_t &progress_id,
128 uint64_t &completed,
129 uint64_t &total,
130 bool &is_debugger_specific) {
131 LLDB_INSTRUMENT_VA(event);
132
133 const ProgressEventData *progress_data =
135 if (progress_data == nullptr)
136 return nullptr;
137 progress_id = progress_data->GetID();
138 completed = progress_data->GetCompleted();
139 total = progress_data->GetTotal();
140 is_debugger_specific = progress_data->IsDebuggerSpecific();
142 progress_data->GetMessage());
143}
144
147 LLDB_INSTRUMENT_VA(event);
148
149 StructuredData::DictionarySP dictionary_sp =
151
152 if (!dictionary_sp)
153 return {};
154
156 data.m_impl_up->SetObjectSP(std::move(dictionary_sp));
157 return data;
158}
159
162 LLDB_INSTRUMENT_VA(event);
163
164 StructuredData::DictionarySP dictionary_sp =
166
167 if (!dictionary_sp)
168 return {};
169
171 data.m_impl_up->SetObjectSP(std::move(dictionary_sp));
172 return data;
173}
174
176 LLDB_INSTRUMENT_VA(this);
177
178 if (m_opaque_sp)
179 return SBBroadcaster(&m_opaque_sp->GetBroadcaster(), false);
180
181 return SBBroadcaster();
182}
183
188
194
196 LLDB_INSTRUMENT_VA(options);
197
199 if (auto e = g_debugger_lifetime->Initialize(
200 std::make_unique<SystemInitializerFull>(options.ref()))) {
201 error.SetError(Status::FromError(std::move(e)));
202 }
203 return error;
204}
205
208
209 llvm::EnablePrettyStackTrace();
210 static std::string executable =
211 llvm::sys::fs::getMainExecutable(nullptr, nullptr);
212 llvm::sys::PrintStackTraceOnErrorSignal(executable);
213}
214
215static void DumpDiagnostics(void *cookie) {
216 Diagnostics::Instance().Dump(llvm::errs());
217}
218
221
222 llvm::sys::AddSignalHandler(&DumpDiagnostics, nullptr);
223}
224
227
228 g_debugger_lifetime->Terminate();
229}
230
232 LLDB_INSTRUMENT_VA(this);
233
234 if (m_opaque_sp)
235 m_opaque_sp->ClearIOHandlers();
236
237 m_opaque_sp.reset();
238}
239
242
243 return SBDebugger::Create(false, nullptr, nullptr);
244}
245
246SBDebugger SBDebugger::Create(bool source_init_files) {
247 LLDB_INSTRUMENT_VA(source_init_files);
248
249 return SBDebugger::Create(source_init_files, nullptr, nullptr);
250}
251
252SBDebugger SBDebugger::Create(bool source_init_files,
253 lldb::LogOutputCallback callback, void *baton)
254
255{
256 LLDB_INSTRUMENT_VA(source_init_files, callback, baton);
257
258 SBDebugger debugger;
259
260 // Currently we have issues if this function is called simultaneously on two
261 // different threads. The issues mainly revolve around the fact that the
262 // lldb_private::FormatManager uses global collections and having two threads
263 // parsing the .lldbinit files can cause mayhem. So to get around this for
264 // now we need to use a mutex to prevent bad things from happening.
265 static std::recursive_mutex g_mutex;
266 std::lock_guard<std::recursive_mutex> guard(g_mutex);
267
268 debugger.reset(Debugger::CreateInstance(callback, baton));
269
271 if (source_init_files) {
272 interp.get()->SkipLLDBInitFiles(false);
273 interp.get()->SkipAppInitFiles(false);
275 interp.SourceInitFileInGlobalDirectory(result);
276 interp.SourceInitFileInHomeDirectory(result, false);
277 } else {
278 interp.get()->SkipLLDBInitFiles(true);
279 interp.get()->SkipAppInitFiles(true);
280 }
281 return debugger;
282}
283
285 LLDB_INSTRUMENT_VA(debugger);
286
288
289 if (debugger.m_opaque_sp.get() != nullptr)
290 debugger.m_opaque_sp.reset();
291}
292
295
296 // Since this function can be call asynchronously, we allow it to be non-
297 // mandatory. We have seen deadlocks with this function when called so we
298 // need to safeguard against this until we can determine what is causing the
299 // deadlocks.
300
301 const bool mandatory = false;
302
304}
305
307 LLDB_INSTRUMENT_VA(this);
308 return this->operator bool();
309}
310SBDebugger::operator bool() const {
311 LLDB_INSTRUMENT_VA(this);
312
313 return m_opaque_sp.get() != nullptr;
314}
315
317 LLDB_INSTRUMENT_VA(this, b);
318
319 if (m_opaque_sp)
320 m_opaque_sp->SetAsyncExecution(b);
321}
322
324 LLDB_INSTRUMENT_VA(this);
325
326 return (m_opaque_sp ? m_opaque_sp->GetAsyncExecution() : false);
327}
328
330 LLDB_INSTRUMENT_VA(this, b);
331
332 if (m_opaque_sp)
333 m_opaque_sp->GetCommandInterpreter().SkipLLDBInitFiles(b);
334}
335
337 LLDB_INSTRUMENT_VA(this, b);
338
339 if (m_opaque_sp)
340 m_opaque_sp->GetCommandInterpreter().SkipAppInitFiles(b);
341}
342
343void SBDebugger::SetInputFileHandle(FILE *fh, bool transfer_ownership) {
344 LLDB_INSTRUMENT_VA(this, fh, transfer_ownership);
345 if (m_opaque_sp)
346 m_opaque_sp->SetInputFile((FileSP)std::make_shared<NativeFile>(
347 fh, File::eOpenOptionReadOnly, transfer_ownership));
348}
349
352 SBError sb_error;
353 if (data == nullptr) {
354 sb_error = Status::FromErrorString("String data is null");
355 return sb_error;
356 }
357
358 size_t size = strlen(data);
359 if (size == 0) {
360 sb_error = Status::FromErrorString("String data is empty");
361 return sb_error;
362 }
363
364 if (!m_opaque_sp) {
365 sb_error = Status::FromErrorString("invalid debugger");
366 return sb_error;
367 }
368
369 sb_error.SetError(m_opaque_sp->SetInputString(data));
370 return sb_error;
371}
372
373// Shouldn't really be settable after initialization as this could cause lots
374// of problems; don't want users trying to switch modes in the middle of a
375// debugging session.
377 LLDB_INSTRUMENT_VA(this, file);
378
380 if (!m_opaque_sp) {
381 error.ref() = Status::FromErrorString("invalid debugger");
382 return error;
383 }
384 if (!file) {
385 error.ref() = Status::FromErrorString("invalid file");
386 return error;
387 }
388 m_opaque_sp->SetInputFile(file.m_opaque_sp);
389 return error;
390}
391
393 LLDB_INSTRUMENT_VA(this, file_sp);
394 return SetInputFile(SBFile(file_sp));
395}
396
398 LLDB_INSTRUMENT_VA(this, file_sp);
399 return SetOutputFile(SBFile(file_sp));
400}
401
402void SBDebugger::SetOutputFileHandle(FILE *fh, bool transfer_ownership) {
403 LLDB_INSTRUMENT_VA(this, fh, transfer_ownership);
404 SetOutputFile((FileSP)std::make_shared<NativeFile>(
405 fh, File::eOpenOptionWriteOnly, transfer_ownership));
406}
407
409 LLDB_INSTRUMENT_VA(this, file);
411 if (!m_opaque_sp) {
412 error.ref() = Status::FromErrorString("invalid debugger");
413 return error;
414 }
415 if (!file) {
416 error.ref() = Status::FromErrorString("invalid file");
417 return error;
418 }
419 m_opaque_sp->SetOutputFile(file.m_opaque_sp);
420 return error;
421}
422
423void SBDebugger::SetErrorFileHandle(FILE *fh, bool transfer_ownership) {
424 LLDB_INSTRUMENT_VA(this, fh, transfer_ownership);
425 SetErrorFile((FileSP)std::make_shared<NativeFile>(
426 fh, File::eOpenOptionWriteOnly, transfer_ownership));
427}
428
430 LLDB_INSTRUMENT_VA(this, file_sp);
431 return SetErrorFile(SBFile(file_sp));
432}
433
435 LLDB_INSTRUMENT_VA(this, file);
437 if (!m_opaque_sp) {
438 error.ref() = Status::FromErrorString("invalid debugger");
439 return error;
440 }
441 if (!file) {
442 error.ref() = Status::FromErrorString("invalid file");
443 return error;
444 }
445 m_opaque_sp->SetErrorFile(file.m_opaque_sp);
446 return error;
447}
448
450 LLDB_INSTRUMENT_VA(this, setting);
451
453 if (!m_opaque_sp)
454 return data;
455
456 StreamString json_strm;
457 ExecutionContext exe_ctx(
458 m_opaque_sp->GetCommandInterpreter().GetExecutionContext());
459 if (setting && strlen(setting) > 0)
460 m_opaque_sp->DumpPropertyValue(&exe_ctx, json_strm, setting,
461 /*dump_mask*/ 0,
462 /*is_json*/ true);
463 else
464 m_opaque_sp->DumpAllPropertyValues(&exe_ctx, json_strm, /*dump_mask*/ 0,
465 /*is_json*/ true);
466
467 data.m_impl_up->SetObjectSP(StructuredData::ParseJSON(json_strm.GetString()));
468 return data;
469}
470
472 LLDB_INSTRUMENT_VA(this);
473 if (m_opaque_sp) {
474 File &file_sp = m_opaque_sp->GetInputFile();
475 return file_sp.GetStream();
476 }
477 return nullptr;
478}
479
481 LLDB_INSTRUMENT_VA(this);
482 if (m_opaque_sp) {
483 return SBFile(m_opaque_sp->GetInputFileSP());
484 }
485 return SBFile();
486}
487
489 LLDB_INSTRUMENT_VA(this);
490 if (m_opaque_sp)
491 return m_opaque_sp->GetOutputFileSP()->GetStream();
492 return nullptr;
493}
494
496 LLDB_INSTRUMENT_VA(this);
497 if (m_opaque_sp)
498 return SBFile(m_opaque_sp->GetOutputFileSP());
499 return SBFile();
500}
501
503 LLDB_INSTRUMENT_VA(this);
504
505 if (m_opaque_sp)
506 return m_opaque_sp->GetErrorFileSP()->GetStream();
507 return nullptr;
508}
509
511 LLDB_INSTRUMENT_VA(this);
512 SBFile file;
513 if (m_opaque_sp)
514 return SBFile(m_opaque_sp->GetErrorFileSP());
515 return SBFile();
516}
517
519 LLDB_INSTRUMENT_VA(this);
520
521 if (m_opaque_sp)
522 m_opaque_sp->SaveInputTerminalState();
523}
524
526 LLDB_INSTRUMENT_VA(this);
527
528 if (m_opaque_sp)
529 m_opaque_sp->RestoreInputTerminalState();
530}
532 LLDB_INSTRUMENT_VA(this);
533
534 SBCommandInterpreter sb_interpreter;
535 if (m_opaque_sp)
536 sb_interpreter.reset(&m_opaque_sp->GetCommandInterpreter());
537
538 return sb_interpreter;
539}
540
541void SBDebugger::HandleCommand(const char *command) {
542 LLDB_INSTRUMENT_VA(this, command);
543
544 if (m_opaque_sp) {
545 TargetSP target_sp(
546 m_opaque_sp->GetCommandInterpreter().GetSelectedTarget());
547 TargetAPIMutex api_lock;
548 std::unique_lock<TargetAPIMutex> guard;
549 if (target_sp) {
550 api_lock = TargetAPIMutex(target_sp->GetAPIMutex());
551 guard = std::unique_lock<TargetAPIMutex>(api_lock);
552 }
553
556
557 sb_interpreter.HandleCommand(command, result, false);
558
559 result.PutError(m_opaque_sp->GetErrorFileSP());
560 result.PutOutput(m_opaque_sp->GetOutputFileSP());
561
562 if (!m_opaque_sp->GetAsyncExecution()) {
563 SBProcess process(GetCommandInterpreter().GetProcess());
564 ProcessSP process_sp(process.GetSP());
565 if (process_sp) {
566 EventSP event_sp;
567 ListenerSP lldb_listener_sp = m_opaque_sp->GetListener();
568 while (lldb_listener_sp->GetEventForBroadcaster(
569 process_sp.get(), event_sp, std::chrono::seconds(0))) {
570 SBEvent event(event_sp);
571 HandleProcessEvent(process, event, GetOutputFile(), GetErrorFile());
572 }
573 }
574 }
575 }
576}
577
579 LLDB_INSTRUMENT_VA(this);
580
581 SBListener sb_listener;
582 if (m_opaque_sp)
583 sb_listener.reset(m_opaque_sp->GetListener());
584
585 return sb_listener;
586}
587
588void SBDebugger::HandleProcessEvent(const SBProcess &process,
589 const SBEvent &event, SBFile out,
590 SBFile err) {
591 LLDB_INSTRUMENT_VA(this, process, event, out, err);
592
593 return HandleProcessEvent(process, event, out.m_opaque_sp, err.m_opaque_sp);
594}
595
596void SBDebugger::HandleProcessEvent(const SBProcess &process,
597 const SBEvent &event, FILE *out,
598 FILE *err) {
599 LLDB_INSTRUMENT_VA(this, process, event, out, err);
600
601 FileSP outfile =
602 std::make_shared<NativeFile>(out, File::eOpenOptionWriteOnly, false);
603 FileSP errfile =
604 std::make_shared<NativeFile>(err, File::eOpenOptionWriteOnly, false);
605 return HandleProcessEvent(process, event, outfile, errfile);
606}
607
608void SBDebugger::HandleProcessEvent(const SBProcess &process,
609 const SBEvent &event, FileSP out_sp,
610 FileSP err_sp) {
611
612 LLDB_INSTRUMENT_VA(this, process, event, out_sp, err_sp);
613
614 if (!process.IsValid())
615 return;
616
617 TargetSP target_sp(process.GetTarget().GetSP());
618 if (!target_sp)
619 return;
620
621 const uint32_t event_type = event.GetType();
622 char stdio_buffer[1024];
623 size_t len;
624
625 TargetAPIMutex api_lock = target_sp->GetAPIMutex();
626 std::lock_guard<TargetAPIMutex> guard(api_lock);
627
628 if (event_type &
630 // Drain stdout when we stop just in case we have any bytes
631 while ((len = process.GetSTDOUT(stdio_buffer, sizeof(stdio_buffer))) > 0)
632 if (out_sp)
633 out_sp->Write(stdio_buffer, len);
634 }
635
636 if (event_type &
638 // Drain stderr when we stop just in case we have any bytes
639 while ((len = process.GetSTDERR(stdio_buffer, sizeof(stdio_buffer))) > 0)
640 if (err_sp)
641 err_sp->Write(stdio_buffer, len);
642 }
643
644 if (event_type & Process::eBroadcastBitStateChanged) {
645 StateType event_state = SBProcess::GetStateFromEvent(event);
646
647 if (event_state == eStateInvalid)
648 return;
649
650 bool is_stopped = StateIsStoppedState(event_state);
651 if (!is_stopped)
652 process.ReportEventState(event, out_sp);
653 }
654}
655
657 LLDB_INSTRUMENT_VA(this);
658
659 SBSourceManager sb_source_manager(*this);
660 return sb_source_manager;
661}
662
663bool SBDebugger::GetDefaultArchitecture(char *arch_name, size_t arch_name_len) {
664 LLDB_INSTRUMENT_VA(arch_name, arch_name_len);
665
666 if (arch_name && arch_name_len) {
668
669 if (default_arch.IsValid()) {
670 const std::string &triple_str = default_arch.GetTriple().str();
671 if (!triple_str.empty())
672 ::snprintf(arch_name, arch_name_len, "%s", triple_str.c_str());
673 else
674 ::snprintf(arch_name, arch_name_len, "%s",
675 default_arch.GetArchitectureName());
676 return true;
677 }
678 }
679 if (arch_name && arch_name_len)
680 arch_name[0] = '\0';
681 return false;
682}
683
684bool SBDebugger::SetDefaultArchitecture(const char *arch_name) {
685 LLDB_INSTRUMENT_VA(arch_name);
686
687 if (arch_name) {
688 ArchSpec arch(arch_name);
689 if (arch.IsValid()) {
691 return true;
692 }
693 }
694 return false;
695}
696
698SBDebugger::GetScriptingLanguage(const char *script_language_name) {
699 LLDB_INSTRUMENT_VA(this, script_language_name);
700
701 if (!script_language_name)
704 llvm::StringRef(script_language_name), eScriptLanguageDefault, nullptr);
705}
706
709 LLDB_INSTRUMENT_VA(this, language);
711 if (m_opaque_sp) {
713 m_opaque_sp->GetScriptInterpreter(language);
714 if (interp) {
715 data.m_impl_up->SetObjectSP(interp->GetInterpreterInfo());
716 }
717 }
718 return data;
719}
720
723
724 // Callable before Initialize, so the system pool may not exist.
726}
727
729 LLDB_INSTRUMENT_VA(state);
730
731 return lldb_private::StateAsCString(state);
732}
733
741
743 LLDB_INSTRUMENT_VA(state);
744
745 const bool result = lldb_private::StateIsRunningState(state);
746
747 return result;
748}
749
751 LLDB_INSTRUMENT_VA(state);
752
753 const bool result = lldb_private::StateIsStoppedState(state, false);
754
755 return result;
756}
757
759 const char *target_triple,
760 const char *platform_name,
761 bool add_dependent_modules,
762 lldb::SBError &sb_error) {
763 LLDB_INSTRUMENT_VA(this, filename, target_triple, platform_name,
764 add_dependent_modules, sb_error);
765
766 SBTarget sb_target;
767 TargetSP target_sp;
768 if (m_opaque_sp) {
769 sb_error.Clear();
770 OptionGroupPlatform platform_options(false);
771 platform_options.SetPlatformName(platform_name);
772
773 sb_error.ref() = m_opaque_sp->GetTargetList().CreateTarget(
774 *m_opaque_sp, filename, target_triple,
775 add_dependent_modules ? eLoadDependentsYes : eLoadDependentsNo,
776 &platform_options, target_sp);
777
778 if (sb_error.Success())
779 sb_target.SetSP(target_sp);
780 } else {
781 sb_error = Status::FromErrorString("invalid debugger");
782 }
783
784 Log *log = GetLog(LLDBLog::API);
785 LLDB_LOGF(log,
786 "SBDebugger(%p)::CreateTarget (filename=\"%s\", triple=%s, "
787 "platform_name=%s, add_dependent_modules=%u, error=%s) => "
788 "SBTarget(%p)",
789 static_cast<void *>(m_opaque_sp.get()), filename, target_triple,
790 platform_name, add_dependent_modules, sb_error.GetCString(),
791 static_cast<void *>(target_sp.get()));
792
793 return sb_target;
794}
795
798 const char *target_triple) {
799 LLDB_INSTRUMENT_VA(this, filename, target_triple);
800
801 SBTarget sb_target;
802 TargetSP target_sp;
803 if (m_opaque_sp) {
804 const bool add_dependent_modules = true;
805 Status error(m_opaque_sp->GetTargetList().CreateTarget(
806 *m_opaque_sp, filename, target_triple,
807 add_dependent_modules ? eLoadDependentsYes : eLoadDependentsNo, nullptr,
808 target_sp));
809 sb_target.SetSP(target_sp);
810 }
811
812 Log *log = GetLog(LLDBLog::API);
813 LLDB_LOGF(log,
814 "SBDebugger(%p)::CreateTargetWithFileAndTargetTriple "
815 "(filename=\"%s\", triple=%s) => SBTarget(%p)",
816 static_cast<void *>(m_opaque_sp.get()), filename, target_triple,
817 static_cast<void *>(target_sp.get()));
818
819 return sb_target;
820}
821
823 const char *arch_cstr) {
824 LLDB_INSTRUMENT_VA(this, filename, arch_cstr);
825
826 Log *log = GetLog(LLDBLog::API);
827
828 SBTarget sb_target;
829 TargetSP target_sp;
830 if (m_opaque_sp) {
832 if (arch_cstr == nullptr) {
833 // The version of CreateTarget that takes an ArchSpec won't accept an
834 // empty ArchSpec, so when the arch hasn't been specified, we need to
835 // call the target triple version.
836 error = m_opaque_sp->GetTargetList().CreateTarget(
837 *m_opaque_sp, filename, arch_cstr, eLoadDependentsYes, nullptr,
838 target_sp);
839 } else {
840 PlatformSP platform_sp =
841 m_opaque_sp->GetPlatformList().GetSelectedPlatform();
842 ArchSpec arch =
843 Platform::GetAugmentedArchSpec(platform_sp.get(), arch_cstr);
844 if (arch.IsValid())
845 error = m_opaque_sp->GetTargetList().CreateTarget(
846 *m_opaque_sp, filename, arch, eLoadDependentsYes, platform_sp,
847 target_sp);
848 else
849 error = Status::FromErrorStringWithFormat("invalid arch_cstr: %s",
850 arch_cstr);
851 }
852 if (error.Success())
853 sb_target.SetSP(target_sp);
854 }
855
856 LLDB_LOGF(log,
857 "SBDebugger(%p)::CreateTargetWithFileAndArch (filename=\"%s\", "
858 "arch=%s) => SBTarget(%p)",
859 static_cast<void *>(m_opaque_sp.get()),
860 filename ? filename : "<unspecified>",
861 arch_cstr ? arch_cstr : "<unspecified>",
862 static_cast<void *>(target_sp.get()));
863
864 return sb_target;
865}
866
867SBTarget SBDebugger::CreateTarget(const char *filename) {
868 LLDB_INSTRUMENT_VA(this, filename);
869
870 SBTarget sb_target;
871 TargetSP target_sp;
872 if (m_opaque_sp) {
874 const bool add_dependent_modules = true;
875 error = m_opaque_sp->GetTargetList().CreateTarget(
876 *m_opaque_sp, filename, "",
877 add_dependent_modules ? eLoadDependentsYes : eLoadDependentsNo, nullptr,
878 target_sp);
879
880 if (error.Success())
881 sb_target.SetSP(target_sp);
882 }
883 Log *log = GetLog(LLDBLog::API);
884 LLDB_LOGF(log,
885 "SBDebugger(%p)::CreateTarget (filename=\"%s\") => SBTarget(%p)",
886 static_cast<void *>(m_opaque_sp.get()), filename,
887 static_cast<void *>(target_sp.get()));
888 return sb_target;
889}
890
892 LLDB_INSTRUMENT_VA(this);
893
894 SBTarget sb_target;
895 if (m_opaque_sp) {
896 sb_target.SetSP(m_opaque_sp->GetDummyTarget().shared_from_this());
897 }
898 Log *log = GetLog(LLDBLog::API);
899 LLDB_LOGF(log, "SBDebugger(%p)::GetDummyTarget() => SBTarget(%p)",
900 static_cast<void *>(m_opaque_sp.get()),
901 static_cast<void *>(sb_target.GetSP().get()));
902 return sb_target;
903}
904
906 LLDB_INSTRUMENT_VA(this);
907 if (m_opaque_sp) {
908 m_opaque_sp->DispatchClientTelemetry(*entry.m_impl_up);
909 } else {
910 Log *log = GetLog(LLDBLog::API);
911 LLDB_LOGF(log,
912 "Could not send telemetry from SBDebugger - debugger was null.");
913 }
914}
915
917 LLDB_INSTRUMENT_VA(this, target);
918
919 bool result = false;
920 if (m_opaque_sp) {
921 TargetSP target_sp(target.GetSP());
922 if (target_sp) {
923 // No need to lock, the target list is thread safe
924 result = m_opaque_sp->GetTargetList().DeleteTarget(target_sp);
925 target_sp->Destroy();
926 target.Clear();
927 }
928 }
929
930 Log *log = GetLog(LLDBLog::API);
931 LLDB_LOGF(log, "SBDebugger(%p)::DeleteTarget (SBTarget(%p)) => %i",
932 static_cast<void *>(m_opaque_sp.get()),
933 static_cast<void *>(target.m_opaque_sp.get()), result);
934
935 return result;
936}
937
939 LLDB_INSTRUMENT_VA(this, idx);
940
941 SBTarget sb_target;
942 if (m_opaque_sp) {
943 // No need to lock, the target list is thread safe
944 sb_target.SetSP(m_opaque_sp->GetTargetList().GetTargetAtIndex(idx));
945 }
946 return sb_target;
947}
948
950 LLDB_INSTRUMENT_VA(this, target);
951
952 lldb::TargetSP target_sp = target.GetSP();
953 if (!target_sp)
954 return UINT32_MAX;
955
956 if (!m_opaque_sp)
957 return UINT32_MAX;
958
959 return m_opaque_sp->GetTargetList().GetIndexOfTarget(target.GetSP());
960}
961
963 LLDB_INSTRUMENT_VA(this, id);
964 SBTarget sb_target;
965 if (m_opaque_sp) {
966 // No need to lock, the target list is thread safe
967 sb_target.SetSP(
968 m_opaque_sp->GetTargetList().FindTargetByGloballyUniqueID(id));
969 }
970 return sb_target;
971}
972
974 LLDB_INSTRUMENT_VA(this, pid);
975
976 SBTarget sb_target;
977 if (m_opaque_sp) {
978 // No need to lock, the target list is thread safe
979 sb_target.SetSP(m_opaque_sp->GetTargetList().FindTargetWithProcessID(pid));
980 }
981 return sb_target;
982}
983
985 const char *arch_name) {
986 LLDB_INSTRUMENT_VA(this, filename, arch_name);
987
988 SBTarget sb_target;
989 if (m_opaque_sp && filename && filename[0]) {
990 // No need to lock, the target list is thread safe
992 m_opaque_sp->GetPlatformList().GetSelectedPlatform().get(), arch_name);
993 TargetSP target_sp(
994 m_opaque_sp->GetTargetList().FindTargetWithExecutableAndArchitecture(
995 FileSpec(filename), arch_name ? &arch : nullptr));
996 sb_target.SetSP(target_sp);
997 }
998 return sb_target;
999}
1000
1002 SBTarget sb_target;
1003 if (m_opaque_sp) {
1004 // No need to lock, the target list is thread safe
1005 sb_target.SetSP(
1006 m_opaque_sp->GetTargetList().FindTargetWithProcess(process_sp.get()));
1007 }
1008 return sb_target;
1009}
1010
1012 LLDB_INSTRUMENT_VA(this);
1013
1014 if (m_opaque_sp) {
1015 // No need to lock, the target list is thread safe
1016 return m_opaque_sp->GetTargetList().GetNumTargets();
1017 }
1018 return 0;
1019}
1020
1022 LLDB_INSTRUMENT_VA(this);
1023
1024 Log *log = GetLog(LLDBLog::API);
1025
1026 SBTarget sb_target;
1027 TargetSP target_sp;
1028 if (m_opaque_sp) {
1029 // No need to lock, the target list is thread safe
1030 target_sp = m_opaque_sp->GetTargetList().GetSelectedTarget();
1031 sb_target.SetSP(target_sp);
1032 }
1033
1034 if (log) {
1035 SBStream sstr;
1036 sb_target.GetDescription(sstr, eDescriptionLevelBrief);
1037 LLDB_LOGF(log, "SBDebugger(%p)::GetSelectedTarget () => SBTarget(%p): %s",
1038 static_cast<void *>(m_opaque_sp.get()),
1039 static_cast<void *>(target_sp.get()), sstr.GetData());
1040 }
1041
1042 return sb_target;
1043}
1044
1046 LLDB_INSTRUMENT_VA(this, sb_target);
1047
1048 Log *log = GetLog(LLDBLog::API);
1049
1050 TargetSP target_sp(sb_target.GetSP());
1051 if (m_opaque_sp) {
1052 m_opaque_sp->GetTargetList().SetSelectedTarget(target_sp);
1053 }
1054 if (log) {
1055 SBStream sstr;
1056 sb_target.GetDescription(sstr, eDescriptionLevelBrief);
1057 LLDB_LOGF(log, "SBDebugger(%p)::SetSelectedTarget () => SBTarget(%p): %s",
1058 static_cast<void *>(m_opaque_sp.get()),
1059 static_cast<void *>(target_sp.get()), sstr.GetData());
1060 }
1061}
1062
1064 LLDB_INSTRUMENT_VA(this);
1065
1066 Log *log = GetLog(LLDBLog::API);
1067
1068 SBPlatform sb_platform;
1069 DebuggerSP debugger_sp(m_opaque_sp);
1070 if (debugger_sp) {
1071 sb_platform.SetSP(debugger_sp->GetPlatformList().GetSelectedPlatform());
1072 }
1073 LLDB_LOGF(log, "SBDebugger(%p)::GetSelectedPlatform () => SBPlatform(%p): %s",
1074 static_cast<void *>(m_opaque_sp.get()),
1075 static_cast<void *>(sb_platform.GetSP().get()),
1076 sb_platform.GetName());
1077 return sb_platform;
1078}
1079
1081 LLDB_INSTRUMENT_VA(this, sb_platform);
1082
1083 Log *log = GetLog(LLDBLog::API);
1084
1085 DebuggerSP debugger_sp(m_opaque_sp);
1086 if (debugger_sp) {
1087 debugger_sp->GetPlatformList().SetSelectedPlatform(sb_platform.GetSP());
1088 }
1089
1090 LLDB_LOGF(log, "SBDebugger(%p)::SetSelectedPlatform (SBPlatform(%p) %s)",
1091 static_cast<void *>(m_opaque_sp.get()),
1092 static_cast<void *>(sb_platform.GetSP().get()),
1093 sb_platform.GetName());
1094}
1095
1097 LLDB_INSTRUMENT_VA(this);
1098
1099 if (m_opaque_sp) {
1100 // No need to lock, the platform list is thread safe
1101 return m_opaque_sp->GetPlatformList().GetSize();
1102 }
1103 return 0;
1104}
1105
1107 LLDB_INSTRUMENT_VA(this, idx);
1108
1109 SBPlatform sb_platform;
1110 if (m_opaque_sp) {
1111 // No need to lock, the platform list is thread safe
1112 sb_platform.SetSP(m_opaque_sp->GetPlatformList().GetAtIndex(idx));
1113 }
1114 return sb_platform;
1115}
1116
1118 LLDB_INSTRUMENT_VA(this);
1119
1120 uint32_t idx = 0;
1121 while (true) {
1123 break;
1124 }
1125 ++idx;
1126 }
1127 // +1 for the host platform, which should always appear first in the list.
1128 return idx + 1;
1129}
1130
1132 LLDB_INSTRUMENT_VA(this, idx);
1133
1135 auto platform_dict = std::make_unique<StructuredData::Dictionary>();
1136 llvm::StringRef name_str("name"), desc_str("description");
1137
1138 if (idx == 0) {
1139 PlatformSP host_platform_sp(Platform::GetHostPlatform());
1140 platform_dict->AddStringItem(name_str, host_platform_sp->GetPluginName());
1141 platform_dict->AddStringItem(
1142 desc_str, llvm::StringRef(host_platform_sp->GetDescription()));
1143 } else if (idx > 0) {
1144 llvm::StringRef plugin_name =
1146 if (plugin_name.empty()) {
1147 return data;
1148 }
1149 platform_dict->AddStringItem(name_str, llvm::StringRef(plugin_name));
1150
1151 llvm::StringRef plugin_desc =
1153 platform_dict->AddStringItem(desc_str, llvm::StringRef(plugin_desc));
1154 }
1155
1156 data.m_impl_up->SetObjectSP(
1157 StructuredData::ObjectSP(platform_dict.release()));
1158 return data;
1159}
1160
1161void SBDebugger::DispatchInput(void *baton, const void *data, size_t data_len) {
1162 LLDB_INSTRUMENT_VA(this, baton, data, data_len);
1163
1165}
1166
1167void SBDebugger::DispatchInput(const void *data, size_t data_len) {
1169
1170 // Log *log(GetLog (LLDBLog::API));
1171 //
1172 // if (log)
1173 // LLDB_LOGF(log, "SBDebugger(%p)::DispatchInput (data=\"%.*s\",
1174 // size_t=%" PRIu64 ")",
1175 // m_opaque_sp.get(),
1176 // (int) data_len,
1177 // (const char *) data,
1178 // (uint64_t)data_len);
1179 //
1180 // if (m_opaque_sp)
1181 // m_opaque_sp->DispatchInput ((const char *) data, data_len);
1182}
1183
1185 LLDB_INSTRUMENT_VA(this);
1186
1187 if (m_opaque_sp)
1188 m_opaque_sp->DispatchInputInterrupt();
1189}
1190
1192 LLDB_INSTRUMENT_VA(this);
1193
1194 if (m_opaque_sp)
1195 m_opaque_sp->DispatchInputEndOfFile();
1196}
1197
1199 LLDB_INSTRUMENT_VA(this, reader);
1200}
1201
1202void SBDebugger::RunCommandInterpreter(bool auto_handle_events,
1203 bool spawn_thread) {
1204 LLDB_INSTRUMENT_VA(this, auto_handle_events, spawn_thread);
1205
1206 if (m_opaque_sp) {
1208 options.SetAutoHandleEvents(auto_handle_events);
1209 options.SetSpawnThread(spawn_thread);
1210 m_opaque_sp->GetCommandInterpreter().RunCommandInterpreter(options);
1211 }
1212}
1213
1214void SBDebugger::RunCommandInterpreter(bool auto_handle_events,
1215 bool spawn_thread,
1217 int &num_errors, bool &quit_requested,
1218 bool &stopped_for_crash)
1219
1220{
1221 LLDB_INSTRUMENT_VA(this, auto_handle_events, spawn_thread, options,
1222 num_errors, quit_requested, stopped_for_crash);
1223
1224 if (m_opaque_sp) {
1225 options.SetAutoHandleEvents(auto_handle_events);
1226 options.SetSpawnThread(spawn_thread);
1227 CommandInterpreter &interp = m_opaque_sp->GetCommandInterpreter();
1229 interp.RunCommandInterpreter(options.ref());
1230 num_errors = result.GetNumErrors();
1231 quit_requested =
1233 stopped_for_crash =
1235 }
1236}
1237
1239 const SBCommandInterpreterRunOptions &options) {
1240 LLDB_INSTRUMENT_VA(this, options);
1241
1242 if (!m_opaque_sp)
1244
1245 CommandInterpreter &interp = m_opaque_sp->GetCommandInterpreter();
1247 interp.RunCommandInterpreter(options.ref());
1248
1249 return SBCommandInterpreterRunResult(result);
1250}
1251
1253 const char *repl_options) {
1254 LLDB_INSTRUMENT_VA(this, language, repl_options);
1255
1256 SBError error;
1257 if (m_opaque_sp)
1258 error.ref() = m_opaque_sp->RunREPL(language, repl_options);
1259 else
1260 error = Status::FromErrorString("invalid debugger");
1261 return error;
1262}
1263
1264void SBDebugger::reset(const DebuggerSP &debugger_sp) {
1265 m_opaque_sp = debugger_sp;
1266}
1267
1268Debugger *SBDebugger::get() const { return m_opaque_sp.get(); }
1269
1271 assert(m_opaque_sp.get());
1272 return *m_opaque_sp;
1273}
1274
1276
1279
1280 // No need to lock, the debugger list is thread safe
1281 SBDebugger sb_debugger;
1282 DebuggerSP debugger_sp = Debugger::FindDebuggerWithID(id);
1283 if (debugger_sp)
1284 sb_debugger.reset(debugger_sp);
1285 return sb_debugger;
1286}
1287
1289 LLDB_INSTRUMENT_VA(this);
1290
1291 if (!m_opaque_sp)
1292 return nullptr;
1293
1294 return m_opaque_sp->GetStringPool().InternNonEmpty(
1295 m_opaque_sp->GetInstanceName());
1296}
1297
1298SBError SBDebugger::SetInternalVariable(const char *var_name, const char *value,
1299 const char *debugger_instance_name) {
1300 LLDB_INSTRUMENT_VA(var_name, value, debugger_instance_name);
1301
1302 SBError sb_error;
1303 DebuggerSP debugger_sp(
1304 Debugger::FindDebuggerWithInstanceName(debugger_instance_name));
1305 Status error;
1306 if (debugger_sp) {
1307 ExecutionContext exe_ctx(
1308 debugger_sp->GetCommandInterpreter().GetExecutionContext());
1309 error = debugger_sp->SetPropertyValue(&exe_ctx, eVarSetOperationAssign,
1310 var_name, value);
1311 // There's no command output to add the warning to, so report it as a
1312 // diagnostic event for the client to show.
1313 if (error.Success())
1314 if (std::optional<std::string> warning =
1315 debugger_sp->GetDeprecationWarning(var_name))
1316 Debugger::ReportWarning(std::move(*warning), debugger_sp->GetID());
1317 } else {
1319 "invalid debugger instance name '%s'", debugger_instance_name);
1320 }
1321 if (error.Fail())
1322 sb_error.SetError(std::move(error));
1323 return sb_error;
1324}
1325
1328 const char *debugger_instance_name) {
1329 LLDB_INSTRUMENT_VA(var_name, debugger_instance_name);
1330
1331 DebuggerSP debugger_sp(
1332 Debugger::FindDebuggerWithInstanceName(debugger_instance_name));
1333 Status error;
1334 if (debugger_sp) {
1335 ExecutionContext exe_ctx(
1336 debugger_sp->GetCommandInterpreter().GetExecutionContext());
1337 lldb::OptionValueSP value_sp(
1338 debugger_sp->GetPropertyValue(&exe_ctx, var_name, error));
1339 if (value_sp) {
1340 StreamString value_strm;
1341 // Like GetSetting, include deprecated settings.
1342 value_sp->DumpValue(&exe_ctx, value_strm,
1345 const std::string &value_str = std::string(value_strm.GetString());
1346 if (!value_str.empty()) {
1347 StringList string_list;
1348 string_list.SplitIntoLines(value_str);
1349 return SBStringList(&string_list);
1350 }
1351 }
1352 }
1353 return SBStringList();
1354}
1355
1357 LLDB_INSTRUMENT_VA(this);
1358
1359 return (m_opaque_sp ? m_opaque_sp->GetTerminalWidth() : 0);
1360}
1361
1362void SBDebugger::SetTerminalWidth(uint32_t term_width) {
1363 LLDB_INSTRUMENT_VA(this, term_width);
1364
1365 if (m_opaque_sp)
1366 m_opaque_sp->SetTerminalWidth(term_width);
1367}
1368
1370 LLDB_INSTRUMENT_VA(this);
1371
1372 return (m_opaque_sp ? m_opaque_sp->GetTerminalHeight() : 0);
1373}
1374
1375void SBDebugger::SetTerminalHeight(uint32_t term_height) {
1376 LLDB_INSTRUMENT_VA(this, term_height);
1377
1378 if (m_opaque_sp)
1379 m_opaque_sp->SetTerminalHeight(term_height);
1380}
1381
1382void SBDebugger::SetTerminalDimensions(uint32_t term_width,
1383 uint32_t term_height) {
1384 LLDB_INSTRUMENT_VA(this, term_width, term_height);
1385
1386 if (m_opaque_sp)
1387 m_opaque_sp->SetTerminalDimensions(term_width, term_height);
1388}
1389
1390const char *SBDebugger::GetPrompt() const {
1391 LLDB_INSTRUMENT_VA(this);
1392
1393 Log *log = GetLog(LLDBLog::API);
1394
1395 LLDB_LOG(log, "SBDebugger({0:x})::GetPrompt () => \"{1}\"",
1396 static_cast<void *>(m_opaque_sp.get()),
1397 (m_opaque_sp ? m_opaque_sp->GetPrompt() : ""));
1398
1399 return (m_opaque_sp
1400 ? m_opaque_sp->GetStringPool().Intern(m_opaque_sp->GetPrompt())
1401 : nullptr);
1402}
1403
1404void SBDebugger::SetPrompt(const char *prompt) {
1405 LLDB_INSTRUMENT_VA(this, prompt);
1406
1407 if (m_opaque_sp)
1408 m_opaque_sp->SetPrompt(llvm::StringRef(prompt));
1409}
1410
1412 LLDB_INSTRUMENT_VA(this);
1413
1414 return "GetReproducerPath has been deprecated";
1415}
1416
1418 LLDB_INSTRUMENT_VA(this);
1419
1420 return (m_opaque_sp ? m_opaque_sp->GetScriptLanguage() : eScriptLanguageNone);
1421}
1422
1424 LLDB_INSTRUMENT_VA(this, script_lang);
1425
1426 if (m_opaque_sp) {
1427 m_opaque_sp->SetScriptLanguage(script_lang);
1428 }
1429}
1430
1432 LLDB_INSTRUMENT_VA(this);
1433
1434 return (m_opaque_sp ? m_opaque_sp->GetREPLLanguage() : eLanguageTypeUnknown);
1435}
1436
1438 LLDB_INSTRUMENT_VA(this, repl_lang);
1439
1440 if (m_opaque_sp) {
1441 m_opaque_sp->SetREPLLanguage(repl_lang);
1442 }
1443}
1444
1446 LLDB_INSTRUMENT_VA(this, value);
1447
1448 return (m_opaque_sp ? m_opaque_sp->SetUseExternalEditor(value) : false);
1449}
1450
1452 LLDB_INSTRUMENT_VA(this);
1453
1454 return (m_opaque_sp ? m_opaque_sp->GetUseExternalEditor() : false);
1455}
1456
1457bool SBDebugger::SetUseColor(bool value) {
1458 LLDB_INSTRUMENT_VA(this, value);
1459
1460 return (m_opaque_sp ? m_opaque_sp->SetUseColor(value) : false);
1461}
1462
1464 LLDB_INSTRUMENT_VA(this);
1465
1466 return (m_opaque_sp ? m_opaque_sp->GetUseColor() : false);
1467}
1468
1470 LLDB_INSTRUMENT_VA(this, value);
1471
1472 return (m_opaque_sp ? m_opaque_sp->SetShowInlineDiagnostics(value) : false);
1473}
1474
1476 LLDB_INSTRUMENT_VA(this, value);
1477
1478 return (m_opaque_sp ? m_opaque_sp->SetUseSourceCache(value) : false);
1479}
1480
1482 LLDB_INSTRUMENT_VA(this);
1483
1484 return (m_opaque_sp ? m_opaque_sp->GetUseSourceCache() : false);
1485}
1486
1488 LLDB_INSTRUMENT_VA(this, description);
1489
1490 Stream &strm = description.ref();
1491
1492 if (m_opaque_sp) {
1493 const char *name = m_opaque_sp->GetInstanceName().c_str();
1494 user_id_t id = m_opaque_sp->GetID();
1495 strm.Printf("Debugger (instance: \"%s\", id: %" PRIu64 ")", name, id);
1496 } else
1497 strm.PutCString("No value");
1498
1499 return true;
1500}
1501
1503 LLDB_INSTRUMENT_VA(this);
1504
1505 return (m_opaque_sp ? m_opaque_sp->GetID() : LLDB_INVALID_UID);
1506}
1507
1508SBError SBDebugger::SetCurrentPlatform(const char *platform_name_cstr) {
1509 LLDB_INSTRUMENT_VA(this, platform_name_cstr);
1510
1511 SBError sb_error;
1512 if (m_opaque_sp) {
1513 if (platform_name_cstr && platform_name_cstr[0]) {
1514 PlatformList &platforms = m_opaque_sp->GetPlatformList();
1515 if (PlatformSP platform_sp = platforms.GetOrCreate(platform_name_cstr))
1516 platforms.SetSelectedPlatform(platform_sp);
1517 else
1518 sb_error.ref() = Status::FromErrorString("platform not found");
1519 } else {
1520 sb_error.ref() = Status::FromErrorString("invalid platform name");
1521 }
1522 } else {
1523 sb_error.ref() = Status::FromErrorString("invalid debugger");
1524 }
1525 return sb_error;
1526}
1527
1528bool SBDebugger::SetCurrentPlatformSDKRoot(const char *sysroot) {
1529 LLDB_INSTRUMENT_VA(this, sysroot);
1530
1531 if (SBPlatform platform = GetSelectedPlatform()) {
1532 platform.SetSDKRoot(sysroot);
1533 return true;
1534 }
1535 return false;
1536}
1537
1539 LLDB_INSTRUMENT_VA(this);
1540
1541 return false;
1542}
1543
1545 LLDB_INSTRUMENT_VA(this, b);
1546}
1547
1548SBTypeCategory SBDebugger::GetCategory(const char *category_name) {
1549 LLDB_INSTRUMENT_VA(this, category_name);
1550
1551 if (!category_name || *category_name == 0)
1552 return SBTypeCategory();
1553
1554 TypeCategoryImplSP category_sp;
1555
1557 category_sp, false)) {
1558 return SBTypeCategory(category_sp);
1559 } else {
1560 return SBTypeCategory();
1561 }
1562}
1563
1565 LLDB_INSTRUMENT_VA(this, lang_type);
1566
1567 TypeCategoryImplSP category_sp;
1568 if (DataVisualization::Categories::GetCategory(lang_type, category_sp)) {
1569 return SBTypeCategory(category_sp);
1570 } else {
1571 return SBTypeCategory();
1572 }
1573}
1574
1575SBTypeCategory SBDebugger::CreateCategory(const char *category_name) {
1576 LLDB_INSTRUMENT_VA(this, category_name);
1577
1578 if (!category_name || *category_name == 0)
1579 return SBTypeCategory();
1580
1581 TypeCategoryImplSP category_sp;
1582
1584 category_sp, true)) {
1585 return SBTypeCategory(category_sp);
1586 } else {
1587 return SBTypeCategory();
1588 }
1589}
1590
1591bool SBDebugger::DeleteCategory(const char *category_name) {
1592 LLDB_INSTRUMENT_VA(this, category_name);
1593
1594 if (!category_name || *category_name == 0)
1595 return false;
1596
1598}
1599
1605
1612
1614 LLDB_INSTRUMENT_VA(this);
1615
1616 return GetCategory("default");
1617}
1618
1620 LLDB_INSTRUMENT_VA(this, type_name);
1621
1622 SBTypeCategory default_category_sb = GetDefaultCategory();
1623 if (default_category_sb.GetEnabled())
1624 return default_category_sb.GetFormatForType(type_name);
1625 return SBTypeFormat();
1626}
1627
1629 LLDB_INSTRUMENT_VA(this, type_name);
1630
1631 if (!type_name.IsValid())
1632 return SBTypeSummary();
1634}
1635
1637 LLDB_INSTRUMENT_VA(this, type_name);
1638
1639 if (!type_name.IsValid())
1640 return SBTypeFilter();
1642}
1643
1645 LLDB_INSTRUMENT_VA(this, type_name);
1646
1647 if (!type_name.IsValid())
1648 return SBTypeSynthetic();
1649 return SBTypeSynthetic(
1651}
1652
1658
1659static llvm::ArrayRef<const char *> GetCategoryArray(const char **categories) {
1660 if (categories == nullptr)
1661 return {};
1662 size_t len = 0;
1663 while (categories[len] != nullptr)
1664 ++len;
1665 return llvm::ArrayRef(categories, len);
1666}
1667
1668bool SBDebugger::EnableLog(const char *channel, const char **categories) {
1669 LLDB_INSTRUMENT_VA(this, channel, categories);
1670
1671 if (m_opaque_sp) {
1672 uint32_t log_options =
1674 llvm::Error err = m_opaque_sp->EnableLog(
1675 channel, GetCategoryArray(categories), "", log_options,
1676 /*buffer_size=*/0, eLogHandlerStream);
1677 bool succeeded = !bool(err);
1678 llvm::consumeError(std::move(err));
1679 return succeeded;
1680 } else
1681 return false;
1682}
1683
1685 void *baton) {
1686 LLDB_INSTRUMENT_VA(this, log_callback, baton);
1687
1688 if (m_opaque_sp) {
1689 return m_opaque_sp->SetLoggingCallback(log_callback, baton);
1690 }
1691}
1692
1693void SBDebugger::SetDestroyCallback(
1694 lldb::SBDebuggerDestroyCallback destroy_callback, void *baton) {
1695 LLDB_INSTRUMENT_VA(this, destroy_callback, baton);
1696 if (m_opaque_sp) {
1697 return m_opaque_sp->SetDestroyCallback(
1698 destroy_callback, baton);
1699 }
1700}
1701
1704 void *baton) {
1705 LLDB_INSTRUMENT_VA(this, destroy_callback, baton);
1706
1707 if (m_opaque_sp)
1708 return m_opaque_sp->AddDestroyCallback(destroy_callback, baton);
1709
1711}
1712
1714 LLDB_INSTRUMENT_VA(this, token);
1715
1716 if (m_opaque_sp)
1717 return m_opaque_sp->RemoveDestroyCallback(token);
1718
1719 return false;
1720}
1721
1722SBTrace
1724 const SBFileSpec &trace_description_file) {
1725 LLDB_INSTRUMENT_VA(this, error, trace_description_file);
1726 return SBTrace::LoadTraceFromFile(error, *this, trace_description_file);
1727}
1728
1730 LLDB_INSTRUMENT_VA(this);
1731
1732 if (m_opaque_sp)
1733 m_opaque_sp->RequestInterrupt();
1734}
1736 LLDB_INSTRUMENT_VA(this);
1737
1738 if (m_opaque_sp)
1739 m_opaque_sp->CancelInterruptRequest();
1740}
1741
1743 LLDB_INSTRUMENT_VA(this);
1744
1745 if (m_opaque_sp)
1746 return m_opaque_sp->InterruptRequested();
1747 return false;
1748}
1749
static llvm::raw_ostream & error(Stream &strm)
static llvm::raw_ostream & warning(Stream &strm)
#define LLDB_INSTRUMENT()
#define LLDB_INSTRUMENT_VA(...)
#define LLDB_LOG(log,...)
The LLDB_LOG* macros defined below are the way to emit log messages.
Definition Log.h:375
#define LLDB_LOGF(log,...)
Definition Log.h:389
#define LLDB_LOG_OPTION_PREPEND_TIMESTAMP
Definition Log.h:41
#define LLDB_LOG_OPTION_PREPEND_THREAD_NAME
Definition Log.h:43
static llvm::ArrayRef< const char * > GetCategoryArray(const char **categories)
static void DumpDiagnostics(void *cookie)
static llvm::ManagedStatic< SystemLifetimeManager > g_debugger_lifetime
lldb_private::CommandInterpreterRunOptions & ref() const
void reset(lldb_private::CommandInterpreter *)
void SourceInitFileInHomeDirectory(lldb::SBCommandReturnObject &result)
lldb_private::CommandInterpreter * get()
void SourceInitFileInGlobalDirectory(lldb::SBCommandReturnObject &result)
lldb::ReturnStatus HandleCommand(const char *command_line, lldb::SBCommandReturnObject &result, bool add_to_history=false)
static lldb::SBError SetInternalVariable(const char *var_name, const char *value, const char *debugger_instance_name)
Set an internal variable.
bool DeleteCategory(const char *category_name)
Delete a type category.
lldb::LanguageType GetREPLLanguage() const
Get the current REPL language.
lldb::SBTarget GetTargetAtIndex(uint32_t idx)
Get a target by index.
lldb::SBTarget CreateTarget(const char *filename, const char *target_triple, const char *platform_name, bool add_dependent_modules, lldb::SBError &error)
Create a target with the specified parameters.
SBTypeFilter GetFilterForType(SBTypeNameSpecifier type_name_spec)
Get the filter for a type.
SBError RunREPL(lldb::LanguageType language, const char *repl_options)
Run a REPL (Read-Eval-Print Loop) for the specified language.
bool DeleteTarget(lldb::SBTarget &target)
Delete a target from the debugger.
void SkipAppInitFiles(bool b)
Set whether to skip loading application-specific .lldbinit files.
lldb::SBDebugger & operator=(const lldb::SBDebugger &rhs)
Assignment operator.
static void Terminate()
Terminate LLDB and its subsystems.
lldb::SBPlatform GetPlatformAtIndex(uint32_t idx)
Get one of the currently active platforms.
void SkipLLDBInitFiles(bool b)
Set whether to skip loading .lldbinit files.
void SetAsync(bool b)
Set whether the debugger should run in asynchronous mode.
const void * data
Definition SBDebugger.h:485
bool SetUseExternalEditor(bool input)
Set whether to use an external editor.
bool GetCloseInputOnEOF() const
Get whether to close input on EOF (deprecated).
static bool GetDefaultArchitecture(char *arch_name, size_t arch_name_len)
Get the default architecture.
static void MemoryPressureDetected()
Notify the debugger that system memory pressure has been detected.
void SetPrompt(const char *prompt)
Set the command prompt string.
bool GetDescription(lldb::SBStream &description)
Get a description of this debugger.
void DispatchInput(const void *data, size_t data_len)
Dispatch input to the debugger.
friend class SBStructuredData
Definition SBDebugger.h:697
bool GetUseExternalEditor()
Get whether an external editor is being used.
static void PrintStackTraceOnError()
Configure LLDB to print a stack trace when it crashes.
static lldb::SBDebugger Create()
Create a new debugger instance (deprecated).
void SetInputFileHandle(FILE *f, bool transfer_ownership)
Set the input file handle for the debugger.
void RunCommandInterpreter(bool auto_handle_events, bool spawn_thread)
Run the command interpreter.
static const char * GetVersionString()
Get the LLDB version string.
lldb_private::Debugger & ref() const
lldb::SBStructuredData GetSetting(const char *setting=nullptr)
Get debugger settings as structured data.
const void size_t data_len
Definition SBDebugger.h:485
const char * GetReproducerPath() const
Get the path to the reproducer.
void SetOutputFileHandle(FILE *f, bool transfer_ownership)
Set the output file handle for the debugger.
static lldb::SBError InitializeWithErrorHandling()
Initialize the LLDB debugger subsystem with error handling.
friend class SBProcess
Definition SBDebugger.h:695
SBTypeSummary GetSummaryForType(SBTypeNameSpecifier type_name_spec)
Get the summary for a type.
void HandleCommand(const char *command)
Execute a command in the command interpreter.
lldb::SBCommandInterpreter GetCommandInterpreter()
Get the command interpreter for this debugger.
SBFile GetInputFile()
Get the input file for the debugger.
const char * GetPrompt() const
Get the command prompt string.
void SetTerminalDimensions(uint32_t term_width, uint32_t term_height)
Set the terminal width and height together.
friend class SBInputReader
Definition SBDebugger.h:693
bool SetUseColor(bool use_color)
Set whether to use color in output.
bool GetAsync()
Get whether the debugger is running in asynchronous mode.
const lldb::DebuggerSP & get_sp() const
static bool StateIsRunningState(lldb::StateType state)
Check if a state is a running state.
SBError SetErrorFile(SBFile file)
Set the error file for the debugger.
bool SetUseSourceCache(bool use_source_cache)
Set whether to use the source cache.
uint32_t GetNumCategories()
Get the number of type categories.
static lldb::SBStringList GetInternalVariableValue(const char *var_name, const char *debugger_instance_name)
Get the value of an internal variable.
friend class SBTarget
Definition SBDebugger.h:699
void Clear()
Clear this debugger instance.
SBTypeFormat GetFormatForType(SBTypeNameSpecifier type_name_spec)
Get the format for a type.
bool GetUseColor() const
Get whether color is being used in output.
static bool SupportsLanguage(lldb::LanguageType language)
Check if a specific language is supported by LLDB.
lldb::SBListener GetListener()
Get the listener associated with this debugger.
void SetLoggingCallback(lldb::LogOutputCallback log_callback, void *baton)
Set a callback for log output.
lldb::DebuggerSP m_opaque_sp
Definition SBDebugger.h:713
lldb::ScriptLanguage GetScriptLanguage() const
Get the current scripting language.
LLDB_DEPRECATED_FIXME("Use AddDestroyCallback and RemoveDestroyCallback", "AddDestroyCallback") void SetDestroyCallback(lldb lldb::callback_token_t AddDestroyCallback(lldb::SBDebuggerDestroyCallback destroy_callback, void *baton)
Set a callback for when the debugger is destroyed (deprecated).
void SetScriptLanguage(lldb::ScriptLanguage script_lang)
Set the current scripting language.
uint32_t GetNumAvailablePlatforms()
Get the number of available platforms.
lldb::SBTarget FindTargetWithLLDBProcess(const lldb::ProcessSP &processSP)
friend class SBListener
Definition SBDebugger.h:694
SBTypeSynthetic GetSyntheticForType(SBTypeNameSpecifier type_name_spec)
Get the synthetic for a type.
void DispatchClientTelemetry(const lldb::SBStructuredData &data)
Dispatch telemetry data from client to server.
SBTypeCategory GetCategoryAtIndex(uint32_t index)
Get a type category by index.
lldb::SBPlatform GetSelectedPlatform()
Get the selected platform.
static const char * GetBroadcasterClass()
Get the broadcaster class name.
lldb::SBTarget CreateTargetWithFileAndArch(const char *filename, const char *archname)
Create a target with the specified file and architecture.
bool IsValid() const
Check if this is a valid SBDebugger object.
static void Initialize()
Initialize LLDB and its subsystems.
static bool StateIsStoppedState(lldb::StateType state)
Check if a state is a stopped state.
lldb::SBError SetCurrentPlatform(const char *platform_name)
Set the current platform by name.
lldb::SBSourceManager GetSourceManager()
Get the source manager for this debugger.
SBTypeCategory GetCategory(const char *category_name)
Get a type category by name.
void ResetStatistics()
Clear collected statistics for targets belonging to this debugger.
void SetREPLLanguage(lldb::LanguageType repl_lang)
Set the current REPL language.
SBStructuredData GetScriptInterpreterInfo(ScriptLanguage language)
Get information about a script interpreter as structured data.
static SBDebugger FindDebuggerWithID(int id)
Find a debugger by ID. Returns an invalid debugger if not found.
bool SetShowInlineDiagnostics(bool b)
Set whether to show inline diagnostics.
uint32_t GetNumPlatforms()
Get the number of currently active platforms.
void DispatchInputEndOfFile()
Signal end-of-file to the current input dispatch.
uint32_t GetTerminalWidth() const
Get the terminal width.
bool InterruptRequested()
Check if an interrupt has been requested.
lldb::SBTarget FindTargetWithFileAndArch(const char *filename, const char *arch)
Find a target with the specified file and architecture.
static lldb::SBStructuredData GetProgressDataFromEvent(const lldb::SBEvent &event)
Get progress data from an event.
static const char * StateAsCString(lldb::StateType state)
Convert a state type to a string.
void PushInputReader(lldb::SBInputReader &reader)
Push an input reader onto the IO handler stack.
static const char * GetProgressFromEvent(const lldb::SBEvent &event, uint64_t &progress_id, uint64_t &completed, uint64_t &total, bool &is_debugger_specific)
Get progress data from a SBEvent whose type is eBroadcastBitProgress.
lldb::SBTarget GetDummyTarget()
Get the dummy target.
bool EnableLog(const char *channel, const char **categories)
Enable logging for a specific channel and category.
static bool SetDefaultArchitecture(const char *arch_name)
Set the default architecture.
lldb_private::Debugger * get() const
void RestoreInputTerminalState()
Restore the previously saved terminal state.
SBFile GetOutputFile()
Get the output file for the debugger.
lldb::SBBroadcaster GetBroadcaster()
Get the broadcaster that allows subscribing to events from this debugger.
void SetSelectedTarget(SBTarget &target)
Set the selected target.
SBTypeCategory GetDefaultCategory()
Get the default type category.
bool GetUseSourceCache() const
Get whether the source cache is being used.
SBFile GetErrorFile()
Get the error file for the debugger.
uint32_t GetTerminalHeight() const
Get the terminal height.
LLDB_DEPRECATED_FIXME("Use HandleProcessEvent(const SBProcess &, const SBEvent &, SBFile, " "SBFile) or HandleProcessEvent(const SBProcess &, const SBEvent &, " "FileSP, FileSP)", "HandleProcessEvent(const SBProcess &, const SBEvent &, SBFile, SBFile)") void HandleProcessEvent(const lldb voi HandleProcessEvent)(const lldb::SBProcess &process, const lldb::SBEvent &event, SBFile out, SBFile err)
Handle a process event (deprecated).
Definition SBDebugger.h:310
lldb::SBStructuredData GetAvailablePlatformInfoAtIndex(uint32_t idx)
Get information about the available platform at the given index as structured data.
static SBStructuredData GetBuildConfiguration()
Get the build configuration as structured data.
SBTypeCategory CreateCategory(const char *category_name)
Create a new type category.
bool SetCurrentPlatformSDKRoot(const char *sysroot)
Set the SDK root for the current platform.
void SetErrorFileHandle(FILE *f, bool transfer_ownership)
Set the error file handle for the debugger.
SBTrace LoadTraceFromFile(SBError &error, const SBFileSpec &trace_description_file)
Load a trace from a trace description file.
void CancelInterruptRequest()
Cancel a previously requested interrupt.
uint32_t GetNumTargets()
Get the number of targets in the debugger.
FILE * GetInputFileHandle()
Get the input file handle for the debugger.
SBError SetInputFile(SBFile file)
Set the input file for the debugger.
void DispatchInputInterrupt()
Interrupt the current input dispatch.
SBError SetInputString(const char *data)
Set the input from a string.
uint32_t GetIndexOfTarget(lldb::SBTarget target)
Get the index of a target.
SBError SetOutputFile(SBFile file)
Set the output file for the debugger.
lldb::SBTarget GetSelectedTarget()
Get the currently selected target.
void SaveInputTerminalState()
Save the current terminal state.
FILE * GetErrorFileHandle()
Get the error file handle for the debugger.
void SetSelectedPlatform(lldb::SBPlatform &platform)
Set the selected platform.
friend class SBSourceManager
Definition SBDebugger.h:696
void reset(const lldb::DebuggerSP &debugger_sp)
friend class SBPlatform
Definition SBDebugger.h:698
FILE * GetOutputFileHandle()
Get the output file handle for the debugger.
const char * GetInstanceName()
Get the instance name of this debugger.
lldb::SBTarget FindTargetWithProcessID(lldb::pid_t pid)
Find a target with the specified process ID.
static void PrintDiagnosticsOnError()
Configure LLDB to print diagnostic information when it crashes.
void SetCloseInputOnEOF(bool b)
Set whether to close input on EOF (deprecated).
friend class SBCommandInterpreter
Definition SBDebugger.h:692
lldb::user_id_t GetID()
Get the unique ID of this debugger.
lldb::SBTarget CreateTargetWithFileAndTargetTriple(const char *filename, const char *target_triple)
Create a target with the specified file and target triple.
SBDebugger()
Default constructor creates an invalid SBDebugger instance.
bool RemoveDestroyCallback(lldb::callback_token_t token)
Remove a destroy callback.
static lldb::SBStructuredData GetDiagnosticFromEvent(const lldb::SBEvent &event)
Get diagnostic information from an event.
lldb::ScriptLanguage GetScriptingLanguage(const char *script_language_name)
Get the scripting language by name.
lldb::SBTarget FindTargetByGloballyUniqueID(lldb::user_id_t id) const
Find a target with the specified unique ID.
static void Destroy(lldb::SBDebugger &debugger)
Destroy a debugger instance.
void RequestInterrupt()
Request an interrupt of the current operation.
bool Success() const
Definition SBError.cpp:81
void SetError(uint32_t err, lldb::ErrorType type)
Definition SBError.cpp:124
lldb_private::Status & ref()
Definition SBError.cpp:191
const char * GetCString() const
Get the error string as a null-terminated UTF8 c-string.
Definition SBError.cpp:55
void Clear()
Definition SBError.cpp:63
lldb_private::Event * get() const
Definition SBEvent.cpp:136
FileSP m_opaque_sp
Definition SBFile.h:64
Options for SBDebugger::Initialize. They apply to the whole process.
const lldb_private::InitializationOptions & ref() const
SBError Initialize(lldb::SBDebugger &sb_debugger, unsigned long(*callback)(void *, lldb::SBInputReader *, lldb::InputReaderAction, char const *, unsigned long), void *a, lldb::InputReaderGranularity b, char const *c, char const *d, bool e)
bool IsActive() const
void reset(lldb::ListenerSP listener_sp)
const char * GetName()
lldb::PlatformSP GetSP() const
void SetSP(const lldb::PlatformSP &platform_sp)
void ReportEventState(const lldb::SBEvent &event, FILE *out) const
lldb::ProcessSP GetSP() const
static lldb::StateType GetStateFromEvent(const lldb::SBEvent &event)
lldb::SBTarget GetTarget() const
size_t GetSTDOUT(char *dst, size_t dst_len) const
bool IsValid() const
size_t GetSTDERR(char *dst, size_t dst_len) const
lldb_private::Stream & ref()
Definition SBStream.cpp:179
const char * GetData()
Definition SBStream.cpp:45
StructuredDataImplUP m_impl_up
bool GetDescription(lldb::SBStream &description, lldb::DescriptionLevel description_level)
void SetSP(const lldb::TargetSP &target_sp)
Definition SBTarget.cpp:602
lldb::TargetSP GetSP() const
Definition SBTarget.cpp:600
lldb::TargetSP m_opaque_sp
Definition SBTarget.h:1082
static SBTrace LoadTraceFromFile(SBError &error, SBDebugger &debugger, const SBFileSpec &trace_description_file)
See SBDebugger::LoadTraceFromFile.
Definition SBTrace.cpp:59
SBTypeFormat GetFormatForType(SBTypeNameSpecifier)
lldb::TypeNameSpecifierImplSP GetSP()
An architecture specification class.
Definition ArchSpec.h:32
bool IsValid() const
Tests if this ArchSpec is valid.
Definition ArchSpec.h:375
llvm::Triple & GetTriple()
Architecture triple accessor.
Definition ArchSpec.h:465
const char * GetArchitectureName() const
Returns a static string representing the current architecture.
Definition ArchSpec.cpp:568
void SetAutoHandleEvents(bool auto_handle_events)
bool IsResult(lldb::CommandInterpreterResult result)
void SkipAppInitFiles(bool skip_app_init_files)
void SkipLLDBInitFiles(bool skip_lldbinit_files)
CommandInterpreterRunResult RunCommandInterpreter(CommandInterpreterRunOptions &options)
A uniqued constant string class.
Definition ConstString.h:40
const char * GetCString() const
Get the string value as a C string.
static bool GetCategory(llvm::StringRef category, lldb::TypeCategoryImplSP &entry, bool allow_create=true)
static lldb::TypeCategoryImplSP GetCategoryAtIndex(size_t)
static bool Delete(llvm::StringRef category)
static lldb::ScriptedSyntheticChildrenSP GetSyntheticForType(lldb::TypeNameSpecifierImplSP type_sp)
static lldb::TypeFilterImplSP GetFilterForType(lldb::TypeNameSpecifierImplSP type_sp)
static lldb::TypeSummaryImplSP GetSummaryForType(lldb::TypeNameSpecifierImplSP type_sp)
static void ResetStatistics(Debugger &debugger, Target *target)
Reset metrics associated with one or all targets in a debugger.
A class to manage flag bits.
Definition Debugger.h:106
static void ReportWarning(std::string message, std::optional< lldb::user_id_t > debugger_id=std::nullopt, std::once_flag *once=nullptr)
Report warning events.
static lldb::DebuggerSP FindDebuggerWithInstanceName(llvm::StringRef instance_name)
static StructuredData::DictionarySP GetBuildConfiguration()
Get the build configuration as structured data.
static llvm::StringRef GetStaticBroadcasterClass()
static lldb::DebuggerSP CreateInstance(lldb::LogOutputCallback log_callback=nullptr, void *baton=nullptr)
Definition Debugger.cpp:978
static lldb::DebuggerSP FindDebuggerWithID(lldb::user_id_t id)
static void Destroy(lldb::DebuggerSP &debugger_sp)
static StructuredData::DictionarySP GetAsStructuredData(const Event *event_ptr)
bool Dump(llvm::raw_ostream &stream)
Write the diagnostic log into a directory and print a message to the given output stream.
static Diagnostics & Instance()
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
A file utility class.
Definition FileSpec.h:56
An abstract base class for files.
Definition FileBase.h:34
virtual FILE * GetStream()
Get the underlying libc stream for this file, or NULL.
Definition File.cpp:121
static std::string GetVersionWithLanguageInfo()
Returns lldb_private::GetVersion(), followed by the GetVersionInfo() of each registered language plug...
Definition Language.cpp:117
static size_t RemoveOrphanSharedModules(bool mandatory)
void SetPlatformName(const char *platform_name)
@ eDumpOptionIncludeDeprecated
Also dump deprecated settings that still have their default value.
Definition OptionValue.h:68
void SetSelectedPlatform(const lldb::PlatformSP &platform_sp)
Definition Platform.h:1194
lldb::PlatformSP GetOrCreate(llvm::StringRef name)
static ArchSpec GetAugmentedArchSpec(Platform *platform, llvm::StringRef triple)
Augments the triple either with information from platform or the host system (if platform is null).
Definition Platform.cpp:332
static lldb::PlatformSP GetHostPlatform()
Get the native host platform plug-in.
Definition Platform.cpp:150
static llvm::StringRef GetPlatformPluginDescriptionAtIndex(uint32_t idx)
static llvm::StringRef GetPlatformPluginNameAtIndex(uint32_t idx)
static const ProgressEventData * GetEventDataFromEvent(const Event *event_ptr)
static StructuredData::DictionarySP GetAsStructuredData(const Event *event_ptr)
virtual StructuredData::DictionarySP GetInterpreterInfo()
An error handling class.
Definition Status.h:118
static Status FromErrorStringWithFormat(const char *format,...) __attribute__((format(printf
Definition Status.cpp:106
static Status FromErrorString(const char *str)
Definition Status.h:141
static Status FromError(llvm::Error error)
Avoid using this in new code. Migrate APIs to llvm::Expected instead.
Definition Status.cpp:136
llvm::StringRef GetString() const
A stream class that can stream formatted output to a file.
Definition Stream.h:28
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
Definition Stream.cpp:134
size_t PutCString(llvm::StringRef cstr)
Output a C string to the stream.
Definition Stream.cpp:63
size_t SplitIntoLines(const std::string &lines)
const char * InternNonEmpty(llvm::StringRef str) const
Like Intern, but an empty string yields nullptr.
Definition StringPool.h:81
static StringPoolRef GetSystemPool()
The system pool. Only valid between Initialize and Terminate.
std::shared_ptr< Dictionary > DictionarySP
std::shared_ptr< Object > ObjectSP
static ObjectSP ParseJSON(llvm::StringRef json_text)
A Lockable handle over a Target's API mutex, returned by Target::GetAPIMutex() and backing the public...
static ArchSpec GetDefaultArchitecture()
Definition Target.cpp:2987
static void SetDefaultArchitecture(const ArchSpec &arch)
Definition Target.cpp:2991
static bool SupportsLanguageStatic(lldb::LanguageType language)
#define LLDB_INVALID_UID
#define UINT32_MAX
#define LLDB_INVALID_CALLBACK_TOKEN
Definition lldb-types.h:71
A class that represents a running process on the host machine.
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
Definition Log.h:338
bool StateIsStoppedState(lldb::StateType state, bool must_exist)
Check if a state represents a state where the process or thread is stopped.
Definition State.cpp:89
bool StateIsRunningState(lldb::StateType state)
Check if a state represents a state where the process or thread is running.
Definition State.cpp:68
const char * StateAsCString(lldb::StateType state)
Converts a StateType to a C string.
Definition State.cpp:14
ScriptLanguage
Script interpreter types.
@ eScriptLanguageDefault
@ eScriptLanguageNone
class LLDB_API SBBroadcaster
Definition SBDefines.h:56
@ eDescriptionLevelBrief
@ eCommandInterpreterResultInferiorCrash
Stopped because the corresponding option was set and the inferior crashed.
@ eCommandInterpreterResultQuitRequested
Stopped because quit was requested.
class LLDB_API SBInitializationOptions
Definition SBDefines.h:83
class LLDB_API SBTypeCategory
Definition SBDefines.h:125
std::shared_ptr< lldb_private::Platform > PlatformSP
class LLDB_API SBFile
Definition SBDefines.h:75
StateType
Process and Thread States.
LanguageType
Programming language type.
@ eLanguageTypeUnknown
Unknown or invalid language value.
class LLDB_API SBTypeFilter
Definition SBDefines.h:128
class LLDB_API SBTypeFormat
Definition SBDefines.h:129
std::shared_ptr< lldb_private::Process > ProcessSP
std::shared_ptr< lldb_private::Debugger > DebuggerSP
std::shared_ptr< lldb_private::Event > EventSP
uint64_t pid_t
Definition lldb-types.h:84
std::shared_ptr< lldb_private::Listener > ListenerSP
int32_t callback_token_t
Definition lldb-types.h:82
std::shared_ptr< lldb_private::TypeCategoryImpl > TypeCategoryImplSP
uint64_t user_id_t
Definition lldb-types.h:83
class LLDB_API SBStringList
Definition SBDefines.h:113
void(* SBDebuggerDestroyCallback)(lldb::user_id_t debugger_id, void *baton)
Definition SBDefines.h:149
void(* LogOutputCallback)(const char *, void *baton)
Definition lldb-types.h:73
std::shared_ptr< lldb_private::Target > TargetSP
class LLDB_API SBError
Definition SBDefines.h:70
std::shared_ptr< lldb_private::File > FileSP
std::shared_ptr< lldb_private::OptionValue > OptionValueSP
class LLDB_API SBTypeSynthetic
Definition SBDefines.h:136
class LLDB_API SBCommandInterpreterRunResult
Definition SBDefines.h:60
InputReaderGranularity
Token size/granularities for Input Readers.
class LLDB_API SBTypeSummary
Definition SBDefines.h:134
static lldb::ScriptLanguage ToScriptLanguage(llvm::StringRef s, lldb::ScriptLanguage fail_value, bool *success_ptr)