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"
22#include "lldb/API/SBListener.h"
23#include "lldb/API/SBProcess.h"
25#include "lldb/API/SBStream.h"
28#include "lldb/API/SBTarget.h"
29#include "lldb/API/SBThread.h"
30#include "lldb/API/SBTrace.h"
37
38#include "lldb/Core/Debugger.h"
41#include "lldb/Core/Progress.h"
44#include "lldb/Host/Config.h"
46#include "lldb/Host/XML.h"
51#include "lldb/Target/Process.h"
53#include "lldb/Utility/Args.h"
55#include "lldb/Utility/State.h"
57
58#include "llvm/ADT/STLExtras.h"
59#include "llvm/ADT/StringRef.h"
60#include "llvm/Config/llvm-config.h" // for LLVM_ENABLE_CURL
61#include "llvm/Support/DynamicLibrary.h"
62#include "llvm/Support/ManagedStatic.h"
63#include "llvm/Support/PrettyStackTrace.h"
64#include "llvm/Support/Signals.h"
65
66using namespace lldb;
67using namespace lldb_private;
68
69static llvm::ManagedStatic<SystemLifetimeManager> g_debugger_lifetime;
70
72 lldb::SBDebugger &sb_debugger,
73 unsigned long (*callback)(void *, lldb::SBInputReader *,
74 lldb::InputReaderAction, char const *,
75 unsigned long),
76 void *a, lldb::InputReaderGranularity b, char const *c, char const *d,
77 bool e) {
78 LLDB_INSTRUMENT_VA(this, sb_debugger, callback, a, b, c, d, e);
79
80 return SBError();
81}
82
84
87
88 return false;
89}
90
92
94 : m_opaque_sp(debugger_sp) {
95 LLDB_INSTRUMENT_VA(this, debugger_sp);
96}
97
101
102SBDebugger::~SBDebugger() = default;
103
105 LLDB_INSTRUMENT_VA(this, rhs);
106
107 if (this != &rhs) {
109 }
110 return *this;
111}
112
118
120 uint64_t &progress_id,
121 uint64_t &completed,
122 uint64_t &total,
123 bool &is_debugger_specific) {
124 LLDB_INSTRUMENT_VA(event);
125
126 const ProgressEventData *progress_data =
128 if (progress_data == nullptr)
129 return nullptr;
130 progress_id = progress_data->GetID();
131 completed = progress_data->GetCompleted();
132 total = progress_data->GetTotal();
133 is_debugger_specific = progress_data->IsDebuggerSpecific();
134 ConstString message(progress_data->GetMessage());
135 return message.AsCString();
136}
137
140 LLDB_INSTRUMENT_VA(event);
141
142 StructuredData::DictionarySP dictionary_sp =
144
145 if (!dictionary_sp)
146 return {};
147
149 data.m_impl_up->SetObjectSP(std::move(dictionary_sp));
150 return data;
151}
152
155 LLDB_INSTRUMENT_VA(event);
156
157 StructuredData::DictionarySP dictionary_sp =
159
160 if (!dictionary_sp)
161 return {};
162
164 data.m_impl_up->SetObjectSP(std::move(dictionary_sp));
165 return data;
166}
167
169 LLDB_INSTRUMENT_VA(this);
170 SBBroadcaster broadcaster(&m_opaque_sp->GetBroadcaster(), false);
171 return broadcaster;
172}
173
178
181
183 if (auto e = g_debugger_lifetime->Initialize(
184 std::make_unique<SystemInitializerFull>())) {
185 error.SetError(Status::FromError(std::move(e)));
186 }
187 return error;
188}
189
192
193 llvm::EnablePrettyStackTrace();
194 static std::string executable =
195 llvm::sys::fs::getMainExecutable(nullptr, nullptr);
196 llvm::sys::PrintStackTraceOnErrorSignal(executable);
197}
198
199static void DumpDiagnostics(void *cookie) {
200 Diagnostics::Instance().Dump(llvm::errs());
201}
202
205
206 llvm::sys::AddSignalHandler(&DumpDiagnostics, nullptr);
207}
208
211
212 g_debugger_lifetime->Terminate();
213}
214
216 LLDB_INSTRUMENT_VA(this);
217
218 if (m_opaque_sp)
219 m_opaque_sp->ClearIOHandlers();
220
221 m_opaque_sp.reset();
222}
223
226
227 return SBDebugger::Create(false, nullptr, nullptr);
228}
229
230SBDebugger SBDebugger::Create(bool source_init_files) {
231 LLDB_INSTRUMENT_VA(source_init_files);
232
233 return SBDebugger::Create(source_init_files, nullptr, nullptr);
234}
235
236SBDebugger SBDebugger::Create(bool source_init_files,
237 lldb::LogOutputCallback callback, void *baton)
238
239{
240 LLDB_INSTRUMENT_VA(source_init_files, callback, baton);
241
242 SBDebugger debugger;
243
244 // Currently we have issues if this function is called simultaneously on two
245 // different threads. The issues mainly revolve around the fact that the
246 // lldb_private::FormatManager uses global collections and having two threads
247 // parsing the .lldbinit files can cause mayhem. So to get around this for
248 // now we need to use a mutex to prevent bad things from happening.
249 static std::recursive_mutex g_mutex;
250 std::lock_guard<std::recursive_mutex> guard(g_mutex);
251
252 debugger.reset(Debugger::CreateInstance(callback, baton));
253
255 if (source_init_files) {
256 interp.get()->SkipLLDBInitFiles(false);
257 interp.get()->SkipAppInitFiles(false);
259 interp.SourceInitFileInGlobalDirectory(result);
260 interp.SourceInitFileInHomeDirectory(result, false);
261 } else {
262 interp.get()->SkipLLDBInitFiles(true);
263 interp.get()->SkipAppInitFiles(true);
264 }
265 return debugger;
266}
267
269 LLDB_INSTRUMENT_VA(debugger);
270
272
273 if (debugger.m_opaque_sp.get() != nullptr)
274 debugger.m_opaque_sp.reset();
275}
276
279
280 // Since this function can be call asynchronously, we allow it to be non-
281 // mandatory. We have seen deadlocks with this function when called so we
282 // need to safeguard against this until we can determine what is causing the
283 // deadlocks.
284
285 const bool mandatory = false;
286
288}
289
291 LLDB_INSTRUMENT_VA(this);
292 return this->operator bool();
293}
294SBDebugger::operator bool() const {
295 LLDB_INSTRUMENT_VA(this);
296
297 return m_opaque_sp.get() != nullptr;
298}
299
301 LLDB_INSTRUMENT_VA(this, b);
302
303 if (m_opaque_sp)
304 m_opaque_sp->SetAsyncExecution(b);
305}
306
308 LLDB_INSTRUMENT_VA(this);
309
310 return (m_opaque_sp ? m_opaque_sp->GetAsyncExecution() : false);
311}
312
314 LLDB_INSTRUMENT_VA(this, b);
315
316 if (m_opaque_sp)
317 m_opaque_sp->GetCommandInterpreter().SkipLLDBInitFiles(b);
318}
319
321 LLDB_INSTRUMENT_VA(this, b);
322
323 if (m_opaque_sp)
324 m_opaque_sp->GetCommandInterpreter().SkipAppInitFiles(b);
325}
326
327void SBDebugger::SetInputFileHandle(FILE *fh, bool transfer_ownership) {
328 LLDB_INSTRUMENT_VA(this, fh, transfer_ownership);
329 if (m_opaque_sp)
330 m_opaque_sp->SetInputFile(
331 (FileSP)std::make_shared<NativeFile>(fh, transfer_ownership));
332}
333
336 SBError sb_error;
337 if (data == nullptr) {
338 sb_error = Status::FromErrorString("String data is null");
339 return sb_error;
340 }
341
342 size_t size = strlen(data);
343 if (size == 0) {
344 sb_error = Status::FromErrorString("String data is empty");
345 return sb_error;
346 }
347
348 if (!m_opaque_sp) {
349 sb_error = Status::FromErrorString("invalid debugger");
350 return sb_error;
351 }
352
353 sb_error.SetError(m_opaque_sp->SetInputString(data));
354 return sb_error;
355}
356
357// Shouldn't really be settable after initialization as this could cause lots
358// of problems; don't want users trying to switch modes in the middle of a
359// debugging session.
361 LLDB_INSTRUMENT_VA(this, file);
362
364 if (!m_opaque_sp) {
365 error.ref() = Status::FromErrorString("invalid debugger");
366 return error;
367 }
368 if (!file) {
369 error.ref() = Status::FromErrorString("invalid file");
370 return error;
371 }
372 m_opaque_sp->SetInputFile(file.m_opaque_sp);
373 return error;
374}
375
377 LLDB_INSTRUMENT_VA(this, file_sp);
378 return SetInputFile(SBFile(file_sp));
379}
380
382 LLDB_INSTRUMENT_VA(this, file_sp);
383 return SetOutputFile(SBFile(file_sp));
384}
385
386void SBDebugger::SetOutputFileHandle(FILE *fh, bool transfer_ownership) {
387 LLDB_INSTRUMENT_VA(this, fh, transfer_ownership);
388 SetOutputFile((FileSP)std::make_shared<NativeFile>(fh, transfer_ownership));
389}
390
392 LLDB_INSTRUMENT_VA(this, file);
394 if (!m_opaque_sp) {
395 error.ref() = Status::FromErrorString("invalid debugger");
396 return error;
397 }
398 if (!file) {
399 error.ref() = Status::FromErrorString("invalid file");
400 return error;
401 }
402 m_opaque_sp->SetOutputFile(file.m_opaque_sp);
403 return error;
404}
405
406void SBDebugger::SetErrorFileHandle(FILE *fh, bool transfer_ownership) {
407 LLDB_INSTRUMENT_VA(this, fh, transfer_ownership);
408 SetErrorFile((FileSP)std::make_shared<NativeFile>(fh, transfer_ownership));
409}
410
412 LLDB_INSTRUMENT_VA(this, file_sp);
413 return SetErrorFile(SBFile(file_sp));
414}
415
417 LLDB_INSTRUMENT_VA(this, file);
419 if (!m_opaque_sp) {
420 error.ref() = Status::FromErrorString("invalid debugger");
421 return error;
422 }
423 if (!file) {
424 error.ref() = Status::FromErrorString("invalid file");
425 return error;
426 }
427 m_opaque_sp->SetErrorFile(file.m_opaque_sp);
428 return error;
429}
430
432 LLDB_INSTRUMENT_VA(this, setting);
433
435 if (!m_opaque_sp)
436 return data;
437
438 StreamString json_strm;
439 ExecutionContext exe_ctx(
440 m_opaque_sp->GetCommandInterpreter().GetExecutionContext());
441 if (setting && strlen(setting) > 0)
442 m_opaque_sp->DumpPropertyValue(&exe_ctx, json_strm, setting,
443 /*dump_mask*/ 0,
444 /*is_json*/ true);
445 else
446 m_opaque_sp->DumpAllPropertyValues(&exe_ctx, json_strm, /*dump_mask*/ 0,
447 /*is_json*/ true);
448
449 data.m_impl_up->SetObjectSP(StructuredData::ParseJSON(json_strm.GetString()));
450 return data;
451}
452
454 LLDB_INSTRUMENT_VA(this);
455 if (m_opaque_sp) {
456 File &file_sp = m_opaque_sp->GetInputFile();
457 return file_sp.GetStream();
458 }
459 return nullptr;
460}
461
463 LLDB_INSTRUMENT_VA(this);
464 if (m_opaque_sp) {
465 return SBFile(m_opaque_sp->GetInputFileSP());
466 }
467 return SBFile();
468}
469
471 LLDB_INSTRUMENT_VA(this);
472 if (m_opaque_sp)
473 return m_opaque_sp->GetOutputFileSP()->GetStream();
474 return nullptr;
475}
476
478 LLDB_INSTRUMENT_VA(this);
479 if (m_opaque_sp)
480 return SBFile(m_opaque_sp->GetOutputFileSP());
481 return SBFile();
482}
483
485 LLDB_INSTRUMENT_VA(this);
486
487 if (m_opaque_sp)
488 return m_opaque_sp->GetErrorFileSP()->GetStream();
489 return nullptr;
490}
491
493 LLDB_INSTRUMENT_VA(this);
494 SBFile file;
495 if (m_opaque_sp)
496 return SBFile(m_opaque_sp->GetErrorFileSP());
497 return SBFile();
498}
499
501 LLDB_INSTRUMENT_VA(this);
502
503 if (m_opaque_sp)
504 m_opaque_sp->SaveInputTerminalState();
505}
506
508 LLDB_INSTRUMENT_VA(this);
509
510 if (m_opaque_sp)
511 m_opaque_sp->RestoreInputTerminalState();
512}
514 LLDB_INSTRUMENT_VA(this);
515
516 SBCommandInterpreter sb_interpreter;
517 if (m_opaque_sp)
518 sb_interpreter.reset(&m_opaque_sp->GetCommandInterpreter());
519
520 return sb_interpreter;
521}
522
523void SBDebugger::HandleCommand(const char *command) {
524 LLDB_INSTRUMENT_VA(this, command);
525
526 if (m_opaque_sp) {
527 TargetSP target_sp(m_opaque_sp->GetSelectedTarget());
528 std::unique_lock<std::recursive_mutex> lock;
529 if (target_sp)
530 lock = std::unique_lock<std::recursive_mutex>(target_sp->GetAPIMutex());
531
534
535 sb_interpreter.HandleCommand(command, result, false);
536
537 result.PutError(m_opaque_sp->GetErrorFileSP());
538 result.PutOutput(m_opaque_sp->GetOutputFileSP());
539
540 if (!m_opaque_sp->GetAsyncExecution()) {
541 SBProcess process(GetCommandInterpreter().GetProcess());
542 ProcessSP process_sp(process.GetSP());
543 if (process_sp) {
544 EventSP event_sp;
545 ListenerSP lldb_listener_sp = m_opaque_sp->GetListener();
546 while (lldb_listener_sp->GetEventForBroadcaster(
547 process_sp.get(), event_sp, std::chrono::seconds(0))) {
548 SBEvent event(event_sp);
549 HandleProcessEvent(process, event, GetOutputFile(), GetErrorFile());
550 }
551 }
552 }
553 }
554}
555
557 LLDB_INSTRUMENT_VA(this);
558
559 SBListener sb_listener;
560 if (m_opaque_sp)
561 sb_listener.reset(m_opaque_sp->GetListener());
562
563 return sb_listener;
564}
565
566void SBDebugger::HandleProcessEvent(const SBProcess &process,
567 const SBEvent &event, SBFile out,
568 SBFile err) {
569 LLDB_INSTRUMENT_VA(this, process, event, out, err);
570
571 return HandleProcessEvent(process, event, out.m_opaque_sp, err.m_opaque_sp);
572}
573
574void SBDebugger::HandleProcessEvent(const SBProcess &process,
575 const SBEvent &event, FILE *out,
576 FILE *err) {
577 LLDB_INSTRUMENT_VA(this, process, event, out, err);
578
579 FileSP outfile = std::make_shared<NativeFile>(out, false);
580 FileSP errfile = std::make_shared<NativeFile>(err, false);
581 return HandleProcessEvent(process, event, outfile, errfile);
582}
583
584void SBDebugger::HandleProcessEvent(const SBProcess &process,
585 const SBEvent &event, FileSP out_sp,
586 FileSP err_sp) {
587
588 LLDB_INSTRUMENT_VA(this, process, event, out_sp, err_sp);
589
590 if (!process.IsValid())
591 return;
592
593 TargetSP target_sp(process.GetTarget().GetSP());
594 if (!target_sp)
595 return;
596
597 const uint32_t event_type = event.GetType();
598 char stdio_buffer[1024];
599 size_t len;
600
601 std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
602
603 if (event_type &
605 // Drain stdout when we stop just in case we have any bytes
606 while ((len = process.GetSTDOUT(stdio_buffer, sizeof(stdio_buffer))) > 0)
607 if (out_sp)
608 out_sp->Write(stdio_buffer, len);
609 }
610
611 if (event_type &
613 // Drain stderr when we stop just in case we have any bytes
614 while ((len = process.GetSTDERR(stdio_buffer, sizeof(stdio_buffer))) > 0)
615 if (err_sp)
616 err_sp->Write(stdio_buffer, len);
617 }
618
619 if (event_type & Process::eBroadcastBitStateChanged) {
620 StateType event_state = SBProcess::GetStateFromEvent(event);
621
622 if (event_state == eStateInvalid)
623 return;
624
625 bool is_stopped = StateIsStoppedState(event_state);
626 if (!is_stopped)
627 process.ReportEventState(event, out_sp);
628 }
629}
630
632 LLDB_INSTRUMENT_VA(this);
633
634 SBSourceManager sb_source_manager(*this);
635 return sb_source_manager;
636}
637
638bool SBDebugger::GetDefaultArchitecture(char *arch_name, size_t arch_name_len) {
639 LLDB_INSTRUMENT_VA(arch_name, arch_name_len);
640
641 if (arch_name && arch_name_len) {
643
644 if (default_arch.IsValid()) {
645 const std::string &triple_str = default_arch.GetTriple().str();
646 if (!triple_str.empty())
647 ::snprintf(arch_name, arch_name_len, "%s", triple_str.c_str());
648 else
649 ::snprintf(arch_name, arch_name_len, "%s",
650 default_arch.GetArchitectureName());
651 return true;
652 }
653 }
654 if (arch_name && arch_name_len)
655 arch_name[0] = '\0';
656 return false;
657}
658
659bool SBDebugger::SetDefaultArchitecture(const char *arch_name) {
660 LLDB_INSTRUMENT_VA(arch_name);
661
662 if (arch_name) {
663 ArchSpec arch(arch_name);
664 if (arch.IsValid()) {
666 return true;
667 }
668 }
669 return false;
670}
671
673SBDebugger::GetScriptingLanguage(const char *script_language_name) {
674 LLDB_INSTRUMENT_VA(this, script_language_name);
675
676 if (!script_language_name)
679 llvm::StringRef(script_language_name), eScriptLanguageDefault, nullptr);
680}
681
684 LLDB_INSTRUMENT_VA(this, language);
686 if (m_opaque_sp) {
688 m_opaque_sp->GetScriptInterpreter(language);
689 if (interp) {
690 data.m_impl_up->SetObjectSP(interp->GetInterpreterInfo());
691 }
692 }
693 return data;
694}
695
698
700}
701
703 LLDB_INSTRUMENT_VA(state);
704
705 return lldb_private::StateAsCString(state);
706}
707
709 llvm::StringRef name, bool value,
710 llvm::StringRef description) {
711 auto entry_up = std::make_unique<StructuredData::Dictionary>();
712 entry_up->AddBooleanItem("value", value);
713 entry_up->AddStringItem("description", description);
714 dict.AddItem(name, std::move(entry_up));
715}
716
718 auto array_up = std::make_unique<StructuredData::Array>();
719#define LLVM_TARGET(target) \
720 array_up->AddItem(std::make_unique<StructuredData::String>(#target));
721#include "llvm/Config/Targets.def"
722 auto entry_up = std::make_unique<StructuredData::Dictionary>();
723 entry_up->AddItem("value", std::move(array_up));
724 entry_up->AddStringItem("description", "A list of configured LLVM targets.");
725 dict.AddItem("targets", std::move(entry_up));
726}
727
730
731 auto config_up = std::make_unique<StructuredData::Dictionary>();
733 *config_up, "xml", XMLDocument::XMLEnabled(),
734 "A boolean value that indicates if XML support is enabled in LLDB");
736 *config_up, "curl", LLVM_ENABLE_CURL,
737 "A boolean value that indicates if CURL support is enabled in LLDB");
739 *config_up, "curses", LLDB_ENABLE_CURSES,
740 "A boolean value that indicates if curses support is enabled in LLDB");
742 *config_up, "editline", LLDB_ENABLE_LIBEDIT,
743 "A boolean value that indicates if editline support is enabled in LLDB");
744 AddBoolConfigEntry(*config_up, "editline_wchar", LLDB_EDITLINE_USE_WCHAR,
745 "A boolean value that indicates if editline wide "
746 "characters support is enabled in LLDB");
748 *config_up, "lzma", LLDB_ENABLE_LZMA,
749 "A boolean value that indicates if lzma support is enabled in LLDB");
751 *config_up, "python", LLDB_ENABLE_PYTHON,
752 "A boolean value that indicates if python support is enabled in LLDB");
754 *config_up, "lua", LLDB_ENABLE_LUA,
755 "A boolean value that indicates if lua support is enabled in LLDB");
756 AddBoolConfigEntry(*config_up, "fbsdvmcore", LLDB_ENABLE_FBSDVMCORE,
757 "A boolean value that indicates if fbsdvmcore support is "
758 "enabled in LLDB");
759 AddLLVMTargets(*config_up);
760
762 data.m_impl_up->SetObjectSP(std::move(config_up));
763 return data;
764}
765
767 LLDB_INSTRUMENT_VA(state);
768
769 const bool result = lldb_private::StateIsRunningState(state);
770
771 return result;
772}
773
775 LLDB_INSTRUMENT_VA(state);
776
777 const bool result = lldb_private::StateIsStoppedState(state, false);
778
779 return result;
780}
781
783 const char *target_triple,
784 const char *platform_name,
785 bool add_dependent_modules,
786 lldb::SBError &sb_error) {
787 LLDB_INSTRUMENT_VA(this, filename, target_triple, platform_name,
788 add_dependent_modules, sb_error);
789
790 SBTarget sb_target;
791 TargetSP target_sp;
792 if (m_opaque_sp) {
793 sb_error.Clear();
794 OptionGroupPlatform platform_options(false);
795 platform_options.SetPlatformName(platform_name);
796
797 sb_error.ref() = m_opaque_sp->GetTargetList().CreateTarget(
798 *m_opaque_sp, filename, target_triple,
799 add_dependent_modules ? eLoadDependentsYes : eLoadDependentsNo,
800 &platform_options, target_sp);
801
802 if (sb_error.Success())
803 sb_target.SetSP(target_sp);
804 } else {
805 sb_error = Status::FromErrorString("invalid debugger");
806 }
807
808 Log *log = GetLog(LLDBLog::API);
809 LLDB_LOGF(log,
810 "SBDebugger(%p)::CreateTarget (filename=\"%s\", triple=%s, "
811 "platform_name=%s, add_dependent_modules=%u, error=%s) => "
812 "SBTarget(%p)",
813 static_cast<void *>(m_opaque_sp.get()), filename, target_triple,
814 platform_name, add_dependent_modules, sb_error.GetCString(),
815 static_cast<void *>(target_sp.get()));
816
817 return sb_target;
818}
819
822 const char *target_triple) {
823 LLDB_INSTRUMENT_VA(this, filename, target_triple);
824
825 SBTarget sb_target;
826 TargetSP target_sp;
827 if (m_opaque_sp) {
828 const bool add_dependent_modules = true;
829 Status error(m_opaque_sp->GetTargetList().CreateTarget(
830 *m_opaque_sp, filename, target_triple,
831 add_dependent_modules ? eLoadDependentsYes : eLoadDependentsNo, nullptr,
832 target_sp));
833 sb_target.SetSP(target_sp);
834 }
835
836 Log *log = GetLog(LLDBLog::API);
837 LLDB_LOGF(log,
838 "SBDebugger(%p)::CreateTargetWithFileAndTargetTriple "
839 "(filename=\"%s\", triple=%s) => SBTarget(%p)",
840 static_cast<void *>(m_opaque_sp.get()), filename, target_triple,
841 static_cast<void *>(target_sp.get()));
842
843 return sb_target;
844}
845
847 const char *arch_cstr) {
848 LLDB_INSTRUMENT_VA(this, filename, arch_cstr);
849
850 Log *log = GetLog(LLDBLog::API);
851
852 SBTarget sb_target;
853 TargetSP target_sp;
854 if (m_opaque_sp) {
856 if (arch_cstr == nullptr) {
857 // The version of CreateTarget that takes an ArchSpec won't accept an
858 // empty ArchSpec, so when the arch hasn't been specified, we need to
859 // call the target triple version.
860 error = m_opaque_sp->GetTargetList().CreateTarget(
861 *m_opaque_sp, filename, arch_cstr, eLoadDependentsYes, nullptr,
862 target_sp);
863 } else {
864 PlatformSP platform_sp =
865 m_opaque_sp->GetPlatformList().GetSelectedPlatform();
866 ArchSpec arch =
867 Platform::GetAugmentedArchSpec(platform_sp.get(), arch_cstr);
868 if (arch.IsValid())
869 error = m_opaque_sp->GetTargetList().CreateTarget(
870 *m_opaque_sp, filename, arch, eLoadDependentsYes, platform_sp,
871 target_sp);
872 else
873 error = Status::FromErrorStringWithFormat("invalid arch_cstr: %s",
874 arch_cstr);
875 }
876 if (error.Success())
877 sb_target.SetSP(target_sp);
878 }
879
880 LLDB_LOGF(log,
881 "SBDebugger(%p)::CreateTargetWithFileAndArch (filename=\"%s\", "
882 "arch=%s) => SBTarget(%p)",
883 static_cast<void *>(m_opaque_sp.get()),
884 filename ? filename : "<unspecified>",
885 arch_cstr ? arch_cstr : "<unspecified>",
886 static_cast<void *>(target_sp.get()));
887
888 return sb_target;
889}
890
891SBTarget SBDebugger::CreateTarget(const char *filename) {
892 LLDB_INSTRUMENT_VA(this, filename);
893
894 SBTarget sb_target;
895 TargetSP target_sp;
896 if (m_opaque_sp) {
898 const bool add_dependent_modules = true;
899 error = m_opaque_sp->GetTargetList().CreateTarget(
900 *m_opaque_sp, filename, "",
901 add_dependent_modules ? eLoadDependentsYes : eLoadDependentsNo, nullptr,
902 target_sp);
903
904 if (error.Success())
905 sb_target.SetSP(target_sp);
906 }
907 Log *log = GetLog(LLDBLog::API);
908 LLDB_LOGF(log,
909 "SBDebugger(%p)::CreateTarget (filename=\"%s\") => SBTarget(%p)",
910 static_cast<void *>(m_opaque_sp.get()), filename,
911 static_cast<void *>(target_sp.get()));
912 return sb_target;
913}
914
916 LLDB_INSTRUMENT_VA(this);
917
918 SBTarget sb_target;
919 if (m_opaque_sp) {
920 sb_target.SetSP(m_opaque_sp->GetDummyTarget().shared_from_this());
921 }
922 Log *log = GetLog(LLDBLog::API);
923 LLDB_LOGF(log, "SBDebugger(%p)::GetDummyTarget() => SBTarget(%p)",
924 static_cast<void *>(m_opaque_sp.get()),
925 static_cast<void *>(sb_target.GetSP().get()));
926 return sb_target;
927}
928
930 LLDB_INSTRUMENT_VA(this);
931 if (m_opaque_sp) {
932 m_opaque_sp->DispatchClientTelemetry(*entry.m_impl_up);
933 } else {
934 Log *log = GetLog(LLDBLog::API);
935 LLDB_LOGF(log,
936 "Could not send telemetry from SBDebugger - debugger was null.");
937 }
938}
939
941 LLDB_INSTRUMENT_VA(this, target);
942
943 bool result = false;
944 if (m_opaque_sp) {
945 TargetSP target_sp(target.GetSP());
946 if (target_sp) {
947 // No need to lock, the target list is thread safe
948 result = m_opaque_sp->GetTargetList().DeleteTarget(target_sp);
949 target_sp->Destroy();
950 target.Clear();
951 }
952 }
953
954 Log *log = GetLog(LLDBLog::API);
955 LLDB_LOGF(log, "SBDebugger(%p)::DeleteTarget (SBTarget(%p)) => %i",
956 static_cast<void *>(m_opaque_sp.get()),
957 static_cast<void *>(target.m_opaque_sp.get()), result);
958
959 return result;
960}
961
963 LLDB_INSTRUMENT_VA(this, idx);
964
965 SBTarget sb_target;
966 if (m_opaque_sp) {
967 // No need to lock, the target list is thread safe
968 sb_target.SetSP(m_opaque_sp->GetTargetList().GetTargetAtIndex(idx));
969 }
970 return sb_target;
971}
972
974 LLDB_INSTRUMENT_VA(this, target);
975
976 lldb::TargetSP target_sp = target.GetSP();
977 if (!target_sp)
978 return UINT32_MAX;
979
980 if (!m_opaque_sp)
981 return UINT32_MAX;
982
983 return m_opaque_sp->GetTargetList().GetIndexOfTarget(target.GetSP());
984}
985
987 LLDB_INSTRUMENT_VA(this, pid);
988
989 SBTarget sb_target;
990 if (m_opaque_sp) {
991 // No need to lock, the target list is thread safe
992 sb_target.SetSP(m_opaque_sp->GetTargetList().FindTargetWithProcessID(pid));
993 }
994 return sb_target;
995}
996
998 const char *arch_name) {
999 LLDB_INSTRUMENT_VA(this, filename, arch_name);
1000
1001 SBTarget sb_target;
1002 if (m_opaque_sp && filename && filename[0]) {
1003 // No need to lock, the target list is thread safe
1005 m_opaque_sp->GetPlatformList().GetSelectedPlatform().get(), arch_name);
1006 TargetSP target_sp(
1007 m_opaque_sp->GetTargetList().FindTargetWithExecutableAndArchitecture(
1008 FileSpec(filename), arch_name ? &arch : nullptr));
1009 sb_target.SetSP(target_sp);
1010 }
1011 return sb_target;
1012}
1013
1015 SBTarget sb_target;
1016 if (m_opaque_sp) {
1017 // No need to lock, the target list is thread safe
1018 sb_target.SetSP(
1019 m_opaque_sp->GetTargetList().FindTargetWithProcess(process_sp.get()));
1020 }
1021 return sb_target;
1022}
1023
1025 LLDB_INSTRUMENT_VA(this);
1026
1027 if (m_opaque_sp) {
1028 // No need to lock, the target list is thread safe
1029 return m_opaque_sp->GetTargetList().GetNumTargets();
1030 }
1031 return 0;
1032}
1033
1035 LLDB_INSTRUMENT_VA(this);
1036
1037 Log *log = GetLog(LLDBLog::API);
1038
1039 SBTarget sb_target;
1040 TargetSP target_sp;
1041 if (m_opaque_sp) {
1042 // No need to lock, the target list is thread safe
1043 target_sp = m_opaque_sp->GetTargetList().GetSelectedTarget();
1044 sb_target.SetSP(target_sp);
1045 }
1046
1047 if (log) {
1048 SBStream sstr;
1049 sb_target.GetDescription(sstr, eDescriptionLevelBrief);
1050 LLDB_LOGF(log, "SBDebugger(%p)::GetSelectedTarget () => SBTarget(%p): %s",
1051 static_cast<void *>(m_opaque_sp.get()),
1052 static_cast<void *>(target_sp.get()), sstr.GetData());
1053 }
1054
1055 return sb_target;
1056}
1057
1059 LLDB_INSTRUMENT_VA(this, sb_target);
1060
1061 Log *log = GetLog(LLDBLog::API);
1062
1063 TargetSP target_sp(sb_target.GetSP());
1064 if (m_opaque_sp) {
1065 m_opaque_sp->GetTargetList().SetSelectedTarget(target_sp);
1066 }
1067 if (log) {
1068 SBStream sstr;
1069 sb_target.GetDescription(sstr, eDescriptionLevelBrief);
1070 LLDB_LOGF(log, "SBDebugger(%p)::SetSelectedTarget () => SBTarget(%p): %s",
1071 static_cast<void *>(m_opaque_sp.get()),
1072 static_cast<void *>(target_sp.get()), sstr.GetData());
1073 }
1074}
1075
1077 LLDB_INSTRUMENT_VA(this);
1078
1079 Log *log = GetLog(LLDBLog::API);
1080
1081 SBPlatform sb_platform;
1082 DebuggerSP debugger_sp(m_opaque_sp);
1083 if (debugger_sp) {
1084 sb_platform.SetSP(debugger_sp->GetPlatformList().GetSelectedPlatform());
1085 }
1086 LLDB_LOGF(log, "SBDebugger(%p)::GetSelectedPlatform () => SBPlatform(%p): %s",
1087 static_cast<void *>(m_opaque_sp.get()),
1088 static_cast<void *>(sb_platform.GetSP().get()),
1089 sb_platform.GetName());
1090 return sb_platform;
1091}
1092
1094 LLDB_INSTRUMENT_VA(this, sb_platform);
1095
1096 Log *log = GetLog(LLDBLog::API);
1097
1098 DebuggerSP debugger_sp(m_opaque_sp);
1099 if (debugger_sp) {
1100 debugger_sp->GetPlatformList().SetSelectedPlatform(sb_platform.GetSP());
1101 }
1102
1103 LLDB_LOGF(log, "SBDebugger(%p)::SetSelectedPlatform (SBPlatform(%p) %s)",
1104 static_cast<void *>(m_opaque_sp.get()),
1105 static_cast<void *>(sb_platform.GetSP().get()),
1106 sb_platform.GetName());
1107}
1108
1110 LLDB_INSTRUMENT_VA(this);
1111
1112 if (m_opaque_sp) {
1113 // No need to lock, the platform list is thread safe
1114 return m_opaque_sp->GetPlatformList().GetSize();
1115 }
1116 return 0;
1117}
1118
1120 LLDB_INSTRUMENT_VA(this, idx);
1121
1122 SBPlatform sb_platform;
1123 if (m_opaque_sp) {
1124 // No need to lock, the platform list is thread safe
1125 sb_platform.SetSP(m_opaque_sp->GetPlatformList().GetAtIndex(idx));
1126 }
1127 return sb_platform;
1128}
1129
1131 LLDB_INSTRUMENT_VA(this);
1132
1133 uint32_t idx = 0;
1134 while (true) {
1136 break;
1137 }
1138 ++idx;
1139 }
1140 // +1 for the host platform, which should always appear first in the list.
1141 return idx + 1;
1142}
1143
1145 LLDB_INSTRUMENT_VA(this, idx);
1146
1148 auto platform_dict = std::make_unique<StructuredData::Dictionary>();
1149 llvm::StringRef name_str("name"), desc_str("description");
1150
1151 if (idx == 0) {
1152 PlatformSP host_platform_sp(Platform::GetHostPlatform());
1153 platform_dict->AddStringItem(name_str, host_platform_sp->GetPluginName());
1154 platform_dict->AddStringItem(
1155 desc_str, llvm::StringRef(host_platform_sp->GetDescription()));
1156 } else if (idx > 0) {
1157 llvm::StringRef plugin_name =
1159 if (plugin_name.empty()) {
1160 return data;
1161 }
1162 platform_dict->AddStringItem(name_str, llvm::StringRef(plugin_name));
1163
1164 llvm::StringRef plugin_desc =
1166 platform_dict->AddStringItem(desc_str, llvm::StringRef(plugin_desc));
1167 }
1168
1169 data.m_impl_up->SetObjectSP(
1170 StructuredData::ObjectSP(platform_dict.release()));
1171 return data;
1172}
1173
1174void SBDebugger::DispatchInput(void *baton, const void *data, size_t data_len) {
1175 LLDB_INSTRUMENT_VA(this, baton, data, data_len);
1176
1178}
1179
1180void SBDebugger::DispatchInput(const void *data, size_t data_len) {
1182
1183 // Log *log(GetLog (LLDBLog::API));
1184 //
1185 // if (log)
1186 // LLDB_LOGF(log, "SBDebugger(%p)::DispatchInput (data=\"%.*s\",
1187 // size_t=%" PRIu64 ")",
1188 // m_opaque_sp.get(),
1189 // (int) data_len,
1190 // (const char *) data,
1191 // (uint64_t)data_len);
1192 //
1193 // if (m_opaque_sp)
1194 // m_opaque_sp->DispatchInput ((const char *) data, data_len);
1195}
1196
1198 LLDB_INSTRUMENT_VA(this);
1199
1200 if (m_opaque_sp)
1201 m_opaque_sp->DispatchInputInterrupt();
1202}
1203
1205 LLDB_INSTRUMENT_VA(this);
1206
1207 if (m_opaque_sp)
1208 m_opaque_sp->DispatchInputEndOfFile();
1209}
1210
1212 LLDB_INSTRUMENT_VA(this, reader);
1213}
1214
1215void SBDebugger::RunCommandInterpreter(bool auto_handle_events,
1216 bool spawn_thread) {
1217 LLDB_INSTRUMENT_VA(this, auto_handle_events, spawn_thread);
1218
1219 if (m_opaque_sp) {
1221 options.SetAutoHandleEvents(auto_handle_events);
1222 options.SetSpawnThread(spawn_thread);
1223 m_opaque_sp->GetCommandInterpreter().RunCommandInterpreter(options);
1224 }
1225}
1226
1227void SBDebugger::RunCommandInterpreter(bool auto_handle_events,
1228 bool spawn_thread,
1230 int &num_errors, bool &quit_requested,
1231 bool &stopped_for_crash)
1232
1233{
1234 LLDB_INSTRUMENT_VA(this, auto_handle_events, spawn_thread, options,
1235 num_errors, quit_requested, stopped_for_crash);
1236
1237 if (m_opaque_sp) {
1238 options.SetAutoHandleEvents(auto_handle_events);
1239 options.SetSpawnThread(spawn_thread);
1240 CommandInterpreter &interp = m_opaque_sp->GetCommandInterpreter();
1242 interp.RunCommandInterpreter(options.ref());
1243 num_errors = result.GetNumErrors();
1244 quit_requested =
1246 stopped_for_crash =
1248 }
1249}
1250
1252 const SBCommandInterpreterRunOptions &options) {
1253 LLDB_INSTRUMENT_VA(this, options);
1254
1255 if (!m_opaque_sp)
1257
1258 CommandInterpreter &interp = m_opaque_sp->GetCommandInterpreter();
1260 interp.RunCommandInterpreter(options.ref());
1261
1262 return SBCommandInterpreterRunResult(result);
1263}
1264
1266 const char *repl_options) {
1267 LLDB_INSTRUMENT_VA(this, language, repl_options);
1268
1269 SBError error;
1270 if (m_opaque_sp)
1271 error.ref() = m_opaque_sp->RunREPL(language, repl_options);
1272 else
1273 error = Status::FromErrorString("invalid debugger");
1274 return error;
1275}
1276
1277void SBDebugger::reset(const DebuggerSP &debugger_sp) {
1278 m_opaque_sp = debugger_sp;
1279}
1280
1281Debugger *SBDebugger::get() const { return m_opaque_sp.get(); }
1282
1284 assert(m_opaque_sp.get());
1285 return *m_opaque_sp;
1286}
1287
1289
1292
1293 // No need to lock, the debugger list is thread safe
1294 SBDebugger sb_debugger;
1295 DebuggerSP debugger_sp = Debugger::FindDebuggerWithID(id);
1296 if (debugger_sp)
1297 sb_debugger.reset(debugger_sp);
1298 return sb_debugger;
1299}
1300
1302 LLDB_INSTRUMENT_VA(this);
1303
1304 if (!m_opaque_sp)
1305 return nullptr;
1306
1307 return ConstString(m_opaque_sp->GetInstanceName()).AsCString();
1308}
1309
1310SBError SBDebugger::SetInternalVariable(const char *var_name, const char *value,
1311 const char *debugger_instance_name) {
1312 LLDB_INSTRUMENT_VA(var_name, value, debugger_instance_name);
1313
1314 SBError sb_error;
1315 DebuggerSP debugger_sp(
1316 Debugger::FindDebuggerWithInstanceName(debugger_instance_name));
1317 Status error;
1318 if (debugger_sp) {
1319 ExecutionContext exe_ctx(
1320 debugger_sp->GetCommandInterpreter().GetExecutionContext());
1321 error = debugger_sp->SetPropertyValue(&exe_ctx, eVarSetOperationAssign,
1322 var_name, value);
1323 } else {
1325 "invalid debugger instance name '%s'", debugger_instance_name);
1326 }
1327 if (error.Fail())
1328 sb_error.SetError(std::move(error));
1329 return sb_error;
1330}
1331
1334 const char *debugger_instance_name) {
1335 LLDB_INSTRUMENT_VA(var_name, debugger_instance_name);
1336
1337 DebuggerSP debugger_sp(
1338 Debugger::FindDebuggerWithInstanceName(debugger_instance_name));
1339 Status error;
1340 if (debugger_sp) {
1341 ExecutionContext exe_ctx(
1342 debugger_sp->GetCommandInterpreter().GetExecutionContext());
1343 lldb::OptionValueSP value_sp(
1344 debugger_sp->GetPropertyValue(&exe_ctx, var_name, error));
1345 if (value_sp) {
1346 StreamString value_strm;
1347 value_sp->DumpValue(&exe_ctx, value_strm, OptionValue::eDumpOptionValue);
1348 const std::string &value_str = std::string(value_strm.GetString());
1349 if (!value_str.empty()) {
1350 StringList string_list;
1351 string_list.SplitIntoLines(value_str);
1352 return SBStringList(&string_list);
1353 }
1354 }
1355 }
1356 return SBStringList();
1357}
1358
1360 LLDB_INSTRUMENT_VA(this);
1361
1362 return (m_opaque_sp ? m_opaque_sp->GetTerminalWidth() : 0);
1363}
1364
1365void SBDebugger::SetTerminalWidth(uint32_t term_width) {
1366 LLDB_INSTRUMENT_VA(this, term_width);
1367
1368 if (m_opaque_sp)
1369 m_opaque_sp->SetTerminalWidth(term_width);
1370}
1371
1373 LLDB_INSTRUMENT_VA(this);
1374
1375 return (m_opaque_sp ? m_opaque_sp->GetTerminalWidth() : 0);
1376}
1377
1378void SBDebugger::SetTerminalHeight(uint32_t term_height) {
1379 LLDB_INSTRUMENT_VA(this, term_height);
1380
1381 if (m_opaque_sp)
1382 m_opaque_sp->SetTerminalHeight(term_height);
1383}
1384
1385const char *SBDebugger::GetPrompt() const {
1386 LLDB_INSTRUMENT_VA(this);
1387
1388 Log *log = GetLog(LLDBLog::API);
1389
1390 LLDB_LOG(log, "SBDebugger({0:x})::GetPrompt () => \"{1}\"",
1391 static_cast<void *>(m_opaque_sp.get()),
1392 (m_opaque_sp ? m_opaque_sp->GetPrompt() : ""));
1393
1394 return (m_opaque_sp ? ConstString(m_opaque_sp->GetPrompt()).GetCString()
1395 : nullptr);
1396}
1397
1398void SBDebugger::SetPrompt(const char *prompt) {
1399 LLDB_INSTRUMENT_VA(this, prompt);
1400
1401 if (m_opaque_sp)
1402 m_opaque_sp->SetPrompt(llvm::StringRef(prompt));
1403}
1404
1406 LLDB_INSTRUMENT_VA(this);
1407
1408 return "GetReproducerPath has been deprecated";
1409}
1410
1412 LLDB_INSTRUMENT_VA(this);
1413
1414 return (m_opaque_sp ? m_opaque_sp->GetScriptLanguage() : eScriptLanguageNone);
1415}
1416
1418 LLDB_INSTRUMENT_VA(this, script_lang);
1419
1420 if (m_opaque_sp) {
1421 m_opaque_sp->SetScriptLanguage(script_lang);
1422 }
1423}
1424
1426 LLDB_INSTRUMENT_VA(this);
1427
1428 return (m_opaque_sp ? m_opaque_sp->GetREPLLanguage() : eLanguageTypeUnknown);
1429}
1430
1432 LLDB_INSTRUMENT_VA(this, repl_lang);
1433
1434 if (m_opaque_sp) {
1435 m_opaque_sp->SetREPLLanguage(repl_lang);
1436 }
1437}
1438
1440 LLDB_INSTRUMENT_VA(this, value);
1441
1442 return (m_opaque_sp ? m_opaque_sp->SetUseExternalEditor(value) : false);
1443}
1444
1446 LLDB_INSTRUMENT_VA(this);
1447
1448 return (m_opaque_sp ? m_opaque_sp->GetUseExternalEditor() : false);
1449}
1450
1451bool SBDebugger::SetUseColor(bool value) {
1452 LLDB_INSTRUMENT_VA(this, value);
1453
1454 return (m_opaque_sp ? m_opaque_sp->SetUseColor(value) : false);
1455}
1456
1458 LLDB_INSTRUMENT_VA(this);
1459
1460 return (m_opaque_sp ? m_opaque_sp->GetUseColor() : false);
1461}
1462
1464 LLDB_INSTRUMENT_VA(this, value);
1465
1466 return (m_opaque_sp ? m_opaque_sp->SetShowInlineDiagnostics(value) : false);
1467}
1468
1470 LLDB_INSTRUMENT_VA(this, value);
1471
1472 return (m_opaque_sp ? m_opaque_sp->SetUseSourceCache(value) : false);
1473}
1474
1476 LLDB_INSTRUMENT_VA(this);
1477
1478 return (m_opaque_sp ? m_opaque_sp->GetUseSourceCache() : false);
1479}
1480
1482 LLDB_INSTRUMENT_VA(this, description);
1483
1484 Stream &strm = description.ref();
1485
1486 if (m_opaque_sp) {
1487 const char *name = m_opaque_sp->GetInstanceName().c_str();
1488 user_id_t id = m_opaque_sp->GetID();
1489 strm.Printf("Debugger (instance: \"%s\", id: %" PRIu64 ")", name, id);
1490 } else
1491 strm.PutCString("No value");
1492
1493 return true;
1494}
1495
1497 LLDB_INSTRUMENT_VA(this);
1498
1499 return (m_opaque_sp ? m_opaque_sp->GetID() : LLDB_INVALID_UID);
1500}
1501
1502SBError SBDebugger::SetCurrentPlatform(const char *platform_name_cstr) {
1503 LLDB_INSTRUMENT_VA(this, platform_name_cstr);
1504
1505 SBError sb_error;
1506 if (m_opaque_sp) {
1507 if (platform_name_cstr && platform_name_cstr[0]) {
1508 PlatformList &platforms = m_opaque_sp->GetPlatformList();
1509 if (PlatformSP platform_sp = platforms.GetOrCreate(platform_name_cstr))
1510 platforms.SetSelectedPlatform(platform_sp);
1511 else
1512 sb_error.ref() = Status::FromErrorString("platform not found");
1513 } else {
1514 sb_error.ref() = Status::FromErrorString("invalid platform name");
1515 }
1516 } else {
1517 sb_error.ref() = Status::FromErrorString("invalid debugger");
1518 }
1519 return sb_error;
1520}
1521
1522bool SBDebugger::SetCurrentPlatformSDKRoot(const char *sysroot) {
1523 LLDB_INSTRUMENT_VA(this, sysroot);
1524
1525 if (SBPlatform platform = GetSelectedPlatform()) {
1526 platform.SetSDKRoot(sysroot);
1527 return true;
1528 }
1529 return false;
1530}
1531
1533 LLDB_INSTRUMENT_VA(this);
1534
1535 return false;
1536}
1537
1539 LLDB_INSTRUMENT_VA(this, b);
1540}
1541
1542SBTypeCategory SBDebugger::GetCategory(const char *category_name) {
1543 LLDB_INSTRUMENT_VA(this, category_name);
1544
1545 if (!category_name || *category_name == 0)
1546 return SBTypeCategory();
1547
1548 TypeCategoryImplSP category_sp;
1549
1551 category_sp, false)) {
1552 return SBTypeCategory(category_sp);
1553 } else {
1554 return SBTypeCategory();
1555 }
1556}
1557
1559 LLDB_INSTRUMENT_VA(this, lang_type);
1560
1561 TypeCategoryImplSP category_sp;
1562 if (DataVisualization::Categories::GetCategory(lang_type, category_sp)) {
1563 return SBTypeCategory(category_sp);
1564 } else {
1565 return SBTypeCategory();
1566 }
1567}
1568
1569SBTypeCategory SBDebugger::CreateCategory(const char *category_name) {
1570 LLDB_INSTRUMENT_VA(this, category_name);
1571
1572 if (!category_name || *category_name == 0)
1573 return SBTypeCategory();
1574
1575 TypeCategoryImplSP category_sp;
1576
1578 category_sp, true)) {
1579 return SBTypeCategory(category_sp);
1580 } else {
1581 return SBTypeCategory();
1582 }
1583}
1584
1585bool SBDebugger::DeleteCategory(const char *category_name) {
1586 LLDB_INSTRUMENT_VA(this, category_name);
1587
1588 if (!category_name || *category_name == 0)
1589 return false;
1590
1592}
1593
1599
1606
1608 LLDB_INSTRUMENT_VA(this);
1609
1610 return GetCategory("default");
1611}
1612
1614 LLDB_INSTRUMENT_VA(this, type_name);
1615
1616 SBTypeCategory default_category_sb = GetDefaultCategory();
1617 if (default_category_sb.GetEnabled())
1618 return default_category_sb.GetFormatForType(type_name);
1619 return SBTypeFormat();
1620}
1621
1623 LLDB_INSTRUMENT_VA(this, type_name);
1624
1625 if (!type_name.IsValid())
1626 return SBTypeSummary();
1628}
1629
1631 LLDB_INSTRUMENT_VA(this, type_name);
1632
1633 if (!type_name.IsValid())
1634 return SBTypeFilter();
1636}
1637
1639 LLDB_INSTRUMENT_VA(this, type_name);
1640
1641 if (!type_name.IsValid())
1642 return SBTypeSynthetic();
1643 return SBTypeSynthetic(
1645}
1646
1652
1653static llvm::ArrayRef<const char *> GetCategoryArray(const char **categories) {
1654 if (categories == nullptr)
1655 return {};
1656 size_t len = 0;
1657 while (categories[len] != nullptr)
1658 ++len;
1659 return llvm::ArrayRef(categories, len);
1660}
1661
1662bool SBDebugger::EnableLog(const char *channel, const char **categories) {
1663 LLDB_INSTRUMENT_VA(this, channel, categories);
1664
1665 if (m_opaque_sp) {
1666 uint32_t log_options =
1668 std::string error;
1669 llvm::raw_string_ostream error_stream(error);
1670 return m_opaque_sp->EnableLog(channel, GetCategoryArray(categories), "",
1671 log_options, /*buffer_size=*/0,
1672 eLogHandlerStream, error_stream);
1673 } else
1674 return false;
1675}
1676
1678 void *baton) {
1679 LLDB_INSTRUMENT_VA(this, log_callback, baton);
1680
1681 if (m_opaque_sp) {
1682 return m_opaque_sp->SetLoggingCallback(log_callback, baton);
1683 }
1684}
1685
1686void SBDebugger::SetDestroyCallback(
1687 lldb::SBDebuggerDestroyCallback destroy_callback, void *baton) {
1688 LLDB_INSTRUMENT_VA(this, destroy_callback, baton);
1689 if (m_opaque_sp) {
1690 return m_opaque_sp->SetDestroyCallback(
1691 destroy_callback, baton);
1692 }
1693}
1694
1697 void *baton) {
1698 LLDB_INSTRUMENT_VA(this, destroy_callback, baton);
1699
1700 if (m_opaque_sp)
1701 return m_opaque_sp->AddDestroyCallback(destroy_callback, baton);
1702
1704}
1705
1707 LLDB_INSTRUMENT_VA(this, token);
1708
1709 if (m_opaque_sp)
1710 return m_opaque_sp->RemoveDestroyCallback(token);
1711
1712 return false;
1713}
1714
1715SBTrace
1717 const SBFileSpec &trace_description_file) {
1718 LLDB_INSTRUMENT_VA(this, error, trace_description_file);
1719 return SBTrace::LoadTraceFromFile(error, *this, trace_description_file);
1720}
1721
1723 LLDB_INSTRUMENT_VA(this);
1724
1725 if (m_opaque_sp)
1726 m_opaque_sp->RequestInterrupt();
1727}
1729 LLDB_INSTRUMENT_VA(this);
1730
1731 if (m_opaque_sp)
1732 m_opaque_sp->CancelInterruptRequest();
1733}
1734
1736 LLDB_INSTRUMENT_VA(this);
1737
1738 if (m_opaque_sp)
1739 return m_opaque_sp->InterruptRequested();
1740 return false;
1741}
1742
static llvm::raw_ostream & error(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:369
#define LLDB_LOGF(log,...)
Definition Log.h:376
#define LLDB_LOG_OPTION_PREPEND_TIMESTAMP
Definition Log.h:38
#define LLDB_LOG_OPTION_PREPEND_THREAD_NAME
Definition Log.h:40
static llvm::ArrayRef< const char * > GetCategoryArray(const char **categories)
static void DumpDiagnostics(void *cookie)
static void AddBoolConfigEntry(StructuredData::Dictionary &dict, llvm::StringRef name, bool value, llvm::StringRef description)
static void AddLLVMTargets(StructuredData::Dictionary &dict)
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:475
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:678
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:475
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:676
void SetTerminalWidth(uint32_t term_width)
Set the terminal width.
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.
friend class SBInputReader
Definition SBDebugger.h:674
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:680
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:694
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:675
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.
void SetTerminalHeight(uint32_t term_height)
Set the terminal height.
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:304
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:677
void reset(const lldb::DebuggerSP &debugger_sp)
friend class SBPlatform
Definition SBDebugger.h:679
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:673
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.
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:134
FileSP m_opaque_sp
Definition SBFile.h:51
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:177
const char * GetData()
Definition SBStream.cpp:44
StructuredDataImplUP m_impl_up
bool GetDescription(lldb::SBStream &description, lldb::DescriptionLevel description_level)
void SetSP(const lldb::TargetSP &target_sp)
Definition SBTarget.cpp:580
lldb::TargetSP GetSP() const
Definition SBTarget.cpp:578
lldb::TargetSP m_opaque_sp
Definition SBTarget.h:1016
static SBTrace LoadTraceFromFile(SBError &error, SBDebugger &debugger, const SBFileSpec &trace_description_file)
See SBDebugger::LoadTraceFromFile.
Definition SBTrace.cpp:31
SBTypeFormat GetFormatForType(SBTypeNameSpecifier)
lldb::TypeNameSpecifierImplSP GetSP()
An architecture specification class.
Definition ArchSpec.h:31
bool IsValid() const
Tests if this ArchSpec is valid.
Definition ArchSpec.h:366
llvm::Triple & GetTriple()
Architecture triple accessor.
Definition ArchSpec.h:468
const char * GetArchitectureName() const
Returns a static string representing the current architecture.
Definition ArchSpec.cpp:548
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 * AsCString(const char *value_if_empty=nullptr) const
Get the string value as a C string.
const char * GetCString() const
Get the string value as a C string.
static bool Delete(ConstString category)
static lldb::TypeCategoryImplSP GetCategoryAtIndex(size_t)
static bool GetCategory(ConstString category, lldb::TypeCategoryImplSP &entry, bool allow_create=true)
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:80
static lldb::DebuggerSP FindDebuggerWithInstanceName(llvm::StringRef instance_name)
Definition Debugger.cpp:917
static llvm::StringRef GetStaticBroadcasterClass()
Definition Debugger.cpp:960
static lldb::DebuggerSP CreateInstance(lldb::LogOutputCallback log_callback=nullptr, void *baton=nullptr)
Definition Debugger.cpp:841
static lldb::DebuggerSP FindDebuggerWithID(lldb::user_id_t id)
static void Destroy(lldb::DebuggerSP &debugger_sp)
Definition Debugger.cpp:885
static StructuredData::DictionarySP GetAsStructuredData(const Event *event_ptr)
bool Dump(llvm::raw_ostream &stream)
Gather diagnostics 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:57
An abstract base class for files.
Definition File.h:36
virtual FILE * GetStream()
Get the underlying libc stream for this file, or NULL.
Definition File.cpp:129
static size_t RemoveOrphanSharedModules(bool mandatory)
void SetPlatformName(const char *platform_name)
void SetSelectedPlatform(const lldb::PlatformSP &platform_sp)
Definition Platform.h:1111
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:227
static lldb::PlatformSP GetHostPlatform()
Get the native host platform plug-in.
Definition Platform.cpp:134
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:137
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:65
size_t SplitIntoLines(const std::string &lines)
void AddItem(llvm::StringRef key, ObjectSP value_sp)
std::shared_ptr< Dictionary > DictionarySP
std::shared_ptr< Object > ObjectSP
static ObjectSP ParseJSON(llvm::StringRef json_text)
static ArchSpec GetDefaultArchitecture()
Definition Target.cpp:2797
static void SetDefaultArchitecture(const ArchSpec &arch)
Definition Target.cpp:2801
static bool SupportsLanguageStatic(lldb::LanguageType language)
static bool XMLEnabled()
Definition XML.cpp:83
#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:332
const char * GetVersion()
Retrieves a string representing the complete LLDB version, which includes the lldb version number,...
Definition Version.cpp:38
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
@ eDescriptionLevelBrief
@ eCommandInterpreterResultInferiorCrash
Stopped because the corresponding option was set and the inferior crashed.
@ eCommandInterpreterResultQuitRequested
Stopped because quit was requested.
class LLDB_API SBTypeCategory
Definition SBDefines.h:121
std::shared_ptr< lldb_private::Platform > PlatformSP
class LLDB_API SBFile
Definition SBDefines.h:74
StateType
Process and Thread States.
LanguageType
Programming language type.
@ eLanguageTypeUnknown
Unknown or invalid language value.
class LLDB_API SBTypeFilter
Definition SBDefines.h:124
class LLDB_API SBTypeFormat
Definition SBDefines.h:125
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:83
std::shared_ptr< lldb_private::Listener > ListenerSP
int32_t callback_token_t
Definition lldb-types.h:81
std::shared_ptr< lldb_private::TypeCategoryImpl > TypeCategoryImplSP
uint64_t user_id_t
Definition lldb-types.h:82
class LLDB_API SBStringList
Definition SBDefines.h:109
void(* SBDebuggerDestroyCallback)(lldb::user_id_t debugger_id, void *baton)
Definition SBDefines.h:145
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:69
std::shared_ptr< lldb_private::File > FileSP
std::shared_ptr< lldb_private::OptionValue > OptionValueSP
class LLDB_API SBTypeSynthetic
Definition SBDefines.h:132
class LLDB_API SBCommandInterpreterRunResult
Definition SBDefines.h:59
InputReaderGranularity
Token size/granularities for Input Readers.
class LLDB_API SBTypeSummary
Definition SBDefines.h:130
static lldb::ScriptLanguage ToScriptLanguage(llvm::StringRef s, lldb::ScriptLanguage fail_value, bool *success_ptr)