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/Support/DynamicLibrary.h"
61#include "llvm/Support/ManagedStatic.h"
62#include "llvm/Support/PrettyStackTrace.h"
63#include "llvm/Support/Signals.h"
64
65using namespace lldb;
66using namespace lldb_private;
67
68static llvm::ManagedStatic<SystemLifetimeManager> g_debugger_lifetime;
69
71 lldb::SBDebugger &sb_debugger,
72 unsigned long (*callback)(void *, lldb::SBInputReader *,
73 lldb::InputReaderAction, char const *,
74 unsigned long),
75 void *a, lldb::InputReaderGranularity b, char const *c, char const *d,
76 bool e) {
77 LLDB_INSTRUMENT_VA(this, sb_debugger, callback, a, b, c, d, e);
78
79 return SBError();
80}
81
83
86
87 return false;
88}
89
91
93 : m_opaque_sp(debugger_sp) {
94 LLDB_INSTRUMENT_VA(this, debugger_sp);
95}
96
97SBDebugger::SBDebugger(const SBDebugger &rhs) : m_opaque_sp(rhs.m_opaque_sp) {
98 LLDB_INSTRUMENT_VA(this, rhs);
99}
100
101SBDebugger::~SBDebugger() = default;
102
104 LLDB_INSTRUMENT_VA(this, rhs);
105
106 if (this != &rhs) {
108 }
109 return *this;
110}
111
114
116}
117
119 uint64_t &progress_id,
120 uint64_t &completed,
121 uint64_t &total,
122 bool &is_debugger_specific) {
123 LLDB_INSTRUMENT_VA(event);
124
125 const ProgressEventData *progress_data =
127 if (progress_data == nullptr)
128 return nullptr;
129 progress_id = progress_data->GetID();
130 completed = progress_data->GetCompleted();
131 total = progress_data->GetTotal();
132 is_debugger_specific = progress_data->IsDebuggerSpecific();
133 ConstString message(progress_data->GetMessage());
134 return message.AsCString();
135}
136
139 LLDB_INSTRUMENT_VA(event);
140
141 StructuredData::DictionarySP dictionary_sp =
143
144 if (!dictionary_sp)
145 return {};
146
148 data.m_impl_up->SetObjectSP(std::move(dictionary_sp));
149 return data;
150}
151
154 LLDB_INSTRUMENT_VA(event);
155
156 StructuredData::DictionarySP dictionary_sp =
158
159 if (!dictionary_sp)
160 return {};
161
163 data.m_impl_up->SetObjectSP(std::move(dictionary_sp));
164 return data;
165}
166
168 LLDB_INSTRUMENT_VA(this);
169 SBBroadcaster broadcaster(&m_opaque_sp->GetBroadcaster(), false);
170 return broadcaster;
171}
172
176}
177
180
181 auto LoadPlugin = [](const lldb::DebuggerSP &debugger_sp,
182 const FileSpec &spec,
183 Status &error) -> llvm::sys::DynamicLibrary {
184 llvm::sys::DynamicLibrary dynlib =
185 llvm::sys::DynamicLibrary::getPermanentLibrary(spec.GetPath().c_str());
186 if (dynlib.isValid()) {
187 typedef bool (*LLDBCommandPluginInit)(lldb::SBDebugger & debugger);
188
189 lldb::SBDebugger debugger_sb(debugger_sp);
190 // This calls the bool lldb::PluginInitialize(lldb::SBDebugger debugger)
191 // function.
192 // TODO: mangle this differently for your system - on OSX, the first
193 // underscore needs to be removed and the second one stays
194 LLDBCommandPluginInit init_func =
195 (LLDBCommandPluginInit)(uintptr_t)dynlib.getAddressOfSymbol(
196 "_ZN4lldb16PluginInitializeENS_10SBDebuggerE");
197 if (init_func) {
198 if (init_func(debugger_sb))
199 return dynlib;
200 else
201 error.SetErrorString("plug-in refused to load "
202 "(lldb::PluginInitialize(lldb::SBDebugger) "
203 "returned false)");
204 } else {
205 error.SetErrorString("plug-in is missing the required initialization: "
206 "lldb::PluginInitialize(lldb::SBDebugger)");
207 }
208 } else {
209 if (FileSystem::Instance().Exists(spec))
210 error.SetErrorString("this file does not represent a loadable dylib");
211 else
212 error.SetErrorString("no such file");
213 }
214 return llvm::sys::DynamicLibrary();
215 };
216
218 if (auto e = g_debugger_lifetime->Initialize(
219 std::make_unique<SystemInitializerFull>(), LoadPlugin)) {
220 error.SetError(Status(std::move(e)));
221 }
222 return error;
223}
224
227
228 llvm::EnablePrettyStackTrace();
229 static std::string executable =
230 llvm::sys::fs::getMainExecutable(nullptr, nullptr);
231 llvm::sys::PrintStackTraceOnErrorSignal(executable);
232}
233
234static void DumpDiagnostics(void *cookie) {
235 Diagnostics::Instance().Dump(llvm::errs());
236}
237
240
241 llvm::sys::AddSignalHandler(&DumpDiagnostics, nullptr);
242}
243
246
247 g_debugger_lifetime->Terminate();
248}
249
251 LLDB_INSTRUMENT_VA(this);
252
253 if (m_opaque_sp)
254 m_opaque_sp->ClearIOHandlers();
255
256 m_opaque_sp.reset();
257}
258
261
262 return SBDebugger::Create(false, nullptr, nullptr);
263}
264
265SBDebugger SBDebugger::Create(bool source_init_files) {
266 LLDB_INSTRUMENT_VA(source_init_files);
267
268 return SBDebugger::Create(source_init_files, nullptr, nullptr);
269}
270
271SBDebugger SBDebugger::Create(bool source_init_files,
272 lldb::LogOutputCallback callback, void *baton)
273
274{
275 LLDB_INSTRUMENT_VA(source_init_files, callback, baton);
276
277 SBDebugger debugger;
278
279 // Currently we have issues if this function is called simultaneously on two
280 // different threads. The issues mainly revolve around the fact that the
281 // lldb_private::FormatManager uses global collections and having two threads
282 // parsing the .lldbinit files can cause mayhem. So to get around this for
283 // now we need to use a mutex to prevent bad things from happening.
284 static std::recursive_mutex g_mutex;
285 std::lock_guard<std::recursive_mutex> guard(g_mutex);
286
287 debugger.reset(Debugger::CreateInstance(callback, baton));
288
290 if (source_init_files) {
291 interp.get()->SkipLLDBInitFiles(false);
292 interp.get()->SkipAppInitFiles(false);
294 interp.SourceInitFileInGlobalDirectory(result);
295 interp.SourceInitFileInHomeDirectory(result, false);
296 } else {
297 interp.get()->SkipLLDBInitFiles(true);
298 interp.get()->SkipAppInitFiles(true);
299 }
300 return debugger;
301}
302
304 LLDB_INSTRUMENT_VA(debugger);
305
307
308 if (debugger.m_opaque_sp.get() != nullptr)
309 debugger.m_opaque_sp.reset();
310}
311
314
315 // Since this function can be call asynchronously, we allow it to be non-
316 // mandatory. We have seen deadlocks with this function when called so we
317 // need to safeguard against this until we can determine what is causing the
318 // deadlocks.
319
320 const bool mandatory = false;
321
323}
324
326 LLDB_INSTRUMENT_VA(this);
327 return this->operator bool();
328}
329SBDebugger::operator bool() const {
330 LLDB_INSTRUMENT_VA(this);
331
332 return m_opaque_sp.get() != nullptr;
333}
334
336 LLDB_INSTRUMENT_VA(this, b);
337
338 if (m_opaque_sp)
339 m_opaque_sp->SetAsyncExecution(b);
340}
341
343 LLDB_INSTRUMENT_VA(this);
344
345 return (m_opaque_sp ? m_opaque_sp->GetAsyncExecution() : false);
346}
347
349 LLDB_INSTRUMENT_VA(this, b);
350
351 if (m_opaque_sp)
352 m_opaque_sp->GetCommandInterpreter().SkipLLDBInitFiles(b);
353}
354
356 LLDB_INSTRUMENT_VA(this, b);
357
358 if (m_opaque_sp)
359 m_opaque_sp->GetCommandInterpreter().SkipAppInitFiles(b);
360}
361
362void SBDebugger::SetInputFileHandle(FILE *fh, bool transfer_ownership) {
363 LLDB_INSTRUMENT_VA(this, fh, transfer_ownership);
364 if (m_opaque_sp)
365 m_opaque_sp->SetInputFile(
366 (FileSP)std::make_shared<NativeFile>(fh, transfer_ownership));
367}
368
371 SBError sb_error;
372 if (data == nullptr) {
373 sb_error.SetErrorString("String data is null");
374 return sb_error;
375 }
376
377 size_t size = strlen(data);
378 if (size == 0) {
379 sb_error.SetErrorString("String data is empty");
380 return sb_error;
381 }
382
383 if (!m_opaque_sp) {
384 sb_error.SetErrorString("invalid debugger");
385 return sb_error;
386 }
387
388 sb_error.SetError(m_opaque_sp->SetInputString(data));
389 return sb_error;
390}
391
392// Shouldn't really be settable after initialization as this could cause lots
393// of problems; don't want users trying to switch modes in the middle of a
394// debugging session.
396 LLDB_INSTRUMENT_VA(this, file);
397
399 if (!m_opaque_sp) {
400 error.ref().SetErrorString("invalid debugger");
401 return error;
402 }
403 if (!file) {
404 error.ref().SetErrorString("invalid file");
405 return error;
406 }
407 m_opaque_sp->SetInputFile(file.m_opaque_sp);
408 return error;
409}
410
412 LLDB_INSTRUMENT_VA(this, file_sp);
413 return SetInputFile(SBFile(file_sp));
414}
415
417 LLDB_INSTRUMENT_VA(this, file_sp);
418 return SetOutputFile(SBFile(file_sp));
419}
420
421void SBDebugger::SetOutputFileHandle(FILE *fh, bool transfer_ownership) {
422 LLDB_INSTRUMENT_VA(this, fh, transfer_ownership);
423 SetOutputFile((FileSP)std::make_shared<NativeFile>(fh, transfer_ownership));
424}
425
427 LLDB_INSTRUMENT_VA(this, file);
429 if (!m_opaque_sp) {
430 error.ref().SetErrorString("invalid debugger");
431 return error;
432 }
433 if (!file) {
434 error.ref().SetErrorString("invalid file");
435 return error;
436 }
437 m_opaque_sp->SetOutputFile(file.m_opaque_sp);
438 return error;
439}
440
441void SBDebugger::SetErrorFileHandle(FILE *fh, bool transfer_ownership) {
442 LLDB_INSTRUMENT_VA(this, fh, transfer_ownership);
443 SetErrorFile((FileSP)std::make_shared<NativeFile>(fh, transfer_ownership));
444}
445
447 LLDB_INSTRUMENT_VA(this, file_sp);
448 return SetErrorFile(SBFile(file_sp));
449}
450
452 LLDB_INSTRUMENT_VA(this, file);
454 if (!m_opaque_sp) {
455 error.ref().SetErrorString("invalid debugger");
456 return error;
457 }
458 if (!file) {
459 error.ref().SetErrorString("invalid file");
460 return error;
461 }
462 m_opaque_sp->SetErrorFile(file.m_opaque_sp);
463 return error;
464}
465
467 LLDB_INSTRUMENT_VA(this, setting);
468
470 if (!m_opaque_sp)
471 return data;
472
473 StreamString json_strm;
474 ExecutionContext exe_ctx(
475 m_opaque_sp->GetCommandInterpreter().GetExecutionContext());
476 if (setting && strlen(setting) > 0)
477 m_opaque_sp->DumpPropertyValue(&exe_ctx, json_strm, setting,
478 /*dump_mask*/ 0,
479 /*is_json*/ true);
480 else
481 m_opaque_sp->DumpAllPropertyValues(&exe_ctx, json_strm, /*dump_mask*/ 0,
482 /*is_json*/ true);
483
484 data.m_impl_up->SetObjectSP(StructuredData::ParseJSON(json_strm.GetString()));
485 return data;
486}
487
489 LLDB_INSTRUMENT_VA(this);
490 if (m_opaque_sp) {
491 File &file_sp = m_opaque_sp->GetInputFile();
492 return file_sp.GetStream();
493 }
494 return nullptr;
495}
496
498 LLDB_INSTRUMENT_VA(this);
499 if (m_opaque_sp) {
500 return SBFile(m_opaque_sp->GetInputFileSP());
501 }
502 return SBFile();
503}
504
506 LLDB_INSTRUMENT_VA(this);
507 if (m_opaque_sp) {
508 StreamFile &stream_file = m_opaque_sp->GetOutputStream();
509 return stream_file.GetFile().GetStream();
510 }
511 return nullptr;
512}
513
515 LLDB_INSTRUMENT_VA(this);
516 if (m_opaque_sp) {
517 SBFile file(m_opaque_sp->GetOutputStream().GetFileSP());
518 return file;
519 }
520 return SBFile();
521}
522
524 LLDB_INSTRUMENT_VA(this);
525
526 if (m_opaque_sp) {
527 StreamFile &stream_file = m_opaque_sp->GetErrorStream();
528 return stream_file.GetFile().GetStream();
529 }
530 return nullptr;
531}
532
534 LLDB_INSTRUMENT_VA(this);
535 SBFile file;
536 if (m_opaque_sp) {
537 SBFile file(m_opaque_sp->GetErrorStream().GetFileSP());
538 return file;
539 }
540 return SBFile();
541}
542
544 LLDB_INSTRUMENT_VA(this);
545
546 if (m_opaque_sp)
547 m_opaque_sp->SaveInputTerminalState();
548}
549
551 LLDB_INSTRUMENT_VA(this);
552
553 if (m_opaque_sp)
554 m_opaque_sp->RestoreInputTerminalState();
555}
557 LLDB_INSTRUMENT_VA(this);
558
559 SBCommandInterpreter sb_interpreter;
560 if (m_opaque_sp)
561 sb_interpreter.reset(&m_opaque_sp->GetCommandInterpreter());
562
563 return sb_interpreter;
564}
565
566void SBDebugger::HandleCommand(const char *command) {
567 LLDB_INSTRUMENT_VA(this, command);
568
569 if (m_opaque_sp) {
570 TargetSP target_sp(m_opaque_sp->GetSelectedTarget());
571 std::unique_lock<std::recursive_mutex> lock;
572 if (target_sp)
573 lock = std::unique_lock<std::recursive_mutex>(target_sp->GetAPIMutex());
574
577
578 sb_interpreter.HandleCommand(command, result, false);
579
580 result.PutError(m_opaque_sp->GetErrorStream().GetFileSP());
581 result.PutOutput(m_opaque_sp->GetOutputStream().GetFileSP());
582
583 if (!m_opaque_sp->GetAsyncExecution()) {
584 SBProcess process(GetCommandInterpreter().GetProcess());
585 ProcessSP process_sp(process.GetSP());
586 if (process_sp) {
587 EventSP event_sp;
588 ListenerSP lldb_listener_sp = m_opaque_sp->GetListener();
589 while (lldb_listener_sp->GetEventForBroadcaster(
590 process_sp.get(), event_sp, std::chrono::seconds(0))) {
591 SBEvent event(event_sp);
592 HandleProcessEvent(process, event, GetOutputFile(), GetErrorFile());
593 }
594 }
595 }
596 }
597}
598
600 LLDB_INSTRUMENT_VA(this);
601
602 SBListener sb_listener;
603 if (m_opaque_sp)
604 sb_listener.reset(m_opaque_sp->GetListener());
605
606 return sb_listener;
607}
608
609void SBDebugger::HandleProcessEvent(const SBProcess &process,
610 const SBEvent &event, SBFile out,
611 SBFile err) {
612 LLDB_INSTRUMENT_VA(this, process, event, out, err);
613
614 return HandleProcessEvent(process, event, out.m_opaque_sp, err.m_opaque_sp);
615}
616
617void SBDebugger::HandleProcessEvent(const SBProcess &process,
618 const SBEvent &event, FILE *out,
619 FILE *err) {
620 LLDB_INSTRUMENT_VA(this, process, event, out, err);
621
622 FileSP outfile = std::make_shared<NativeFile>(out, false);
623 FileSP errfile = std::make_shared<NativeFile>(err, false);
624 return HandleProcessEvent(process, event, outfile, errfile);
625}
626
627void SBDebugger::HandleProcessEvent(const SBProcess &process,
628 const SBEvent &event, FileSP out_sp,
629 FileSP err_sp) {
630
631 LLDB_INSTRUMENT_VA(this, process, event, out_sp, err_sp);
632
633 if (!process.IsValid())
634 return;
635
636 TargetSP target_sp(process.GetTarget().GetSP());
637 if (!target_sp)
638 return;
639
640 const uint32_t event_type = event.GetType();
641 char stdio_buffer[1024];
642 size_t len;
643
644 std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
645
646 if (event_type &
648 // Drain stdout when we stop just in case we have any bytes
649 while ((len = process.GetSTDOUT(stdio_buffer, sizeof(stdio_buffer))) > 0)
650 if (out_sp)
651 out_sp->Write(stdio_buffer, len);
652 }
653
654 if (event_type &
656 // Drain stderr when we stop just in case we have any bytes
657 while ((len = process.GetSTDERR(stdio_buffer, sizeof(stdio_buffer))) > 0)
658 if (err_sp)
659 err_sp->Write(stdio_buffer, len);
660 }
661
662 if (event_type & Process::eBroadcastBitStateChanged) {
663 StateType event_state = SBProcess::GetStateFromEvent(event);
664
665 if (event_state == eStateInvalid)
666 return;
667
668 bool is_stopped = StateIsStoppedState(event_state);
669 if (!is_stopped)
670 process.ReportEventState(event, out_sp);
671 }
672}
673
675 LLDB_INSTRUMENT_VA(this);
676
677 SBSourceManager sb_source_manager(*this);
678 return sb_source_manager;
679}
680
681bool SBDebugger::GetDefaultArchitecture(char *arch_name, size_t arch_name_len) {
682 LLDB_INSTRUMENT_VA(arch_name, arch_name_len);
683
684 if (arch_name && arch_name_len) {
686
687 if (default_arch.IsValid()) {
688 const std::string &triple_str = default_arch.GetTriple().str();
689 if (!triple_str.empty())
690 ::snprintf(arch_name, arch_name_len, "%s", triple_str.c_str());
691 else
692 ::snprintf(arch_name, arch_name_len, "%s",
693 default_arch.GetArchitectureName());
694 return true;
695 }
696 }
697 if (arch_name && arch_name_len)
698 arch_name[0] = '\0';
699 return false;
700}
701
702bool SBDebugger::SetDefaultArchitecture(const char *arch_name) {
703 LLDB_INSTRUMENT_VA(arch_name);
704
705 if (arch_name) {
706 ArchSpec arch(arch_name);
707 if (arch.IsValid()) {
709 return true;
710 }
711 }
712 return false;
713}
714
716SBDebugger::GetScriptingLanguage(const char *script_language_name) {
717 LLDB_INSTRUMENT_VA(this, script_language_name);
718
719 if (!script_language_name)
722 llvm::StringRef(script_language_name), eScriptLanguageDefault, nullptr);
723}
724
727 LLDB_INSTRUMENT_VA(this, language);
729 if (m_opaque_sp) {
731 m_opaque_sp->GetScriptInterpreter(language);
732 if (interp) {
733 data.m_impl_up->SetObjectSP(interp->GetInterpreterInfo());
734 }
735 }
736 return data;
737}
738
741
743}
744
746 LLDB_INSTRUMENT_VA(state);
747
748 return lldb_private::StateAsCString(state);
749}
750
752 llvm::StringRef name, bool value,
753 llvm::StringRef description) {
754 auto entry_up = std::make_unique<StructuredData::Dictionary>();
755 entry_up->AddBooleanItem("value", value);
756 entry_up->AddStringItem("description", description);
757 dict.AddItem(name, std::move(entry_up));
758}
759
761 auto array_up = std::make_unique<StructuredData::Array>();
762#define LLVM_TARGET(target) \
763 array_up->AddItem(std::make_unique<StructuredData::String>(#target));
764#include "llvm/Config/Targets.def"
765 auto entry_up = std::make_unique<StructuredData::Dictionary>();
766 entry_up->AddItem("value", std::move(array_up));
767 entry_up->AddStringItem("description", "A list of configured LLVM targets.");
768 dict.AddItem("targets", std::move(entry_up));
769}
770
773
774 auto config_up = std::make_unique<StructuredData::Dictionary>();
776 *config_up, "xml", XMLDocument::XMLEnabled(),
777 "A boolean value that indicates if XML support is enabled in LLDB");
779 *config_up, "curses", LLDB_ENABLE_CURSES,
780 "A boolean value that indicates if curses support is enabled in LLDB");
782 *config_up, "editline", LLDB_ENABLE_LIBEDIT,
783 "A boolean value that indicates if editline support is enabled in LLDB");
784 AddBoolConfigEntry(*config_up, "editline_wchar", LLDB_EDITLINE_USE_WCHAR,
785 "A boolean value that indicates if editline wide "
786 "characters support is enabled in LLDB");
788 *config_up, "lzma", LLDB_ENABLE_LZMA,
789 "A boolean value that indicates if lzma support is enabled in LLDB");
791 *config_up, "python", LLDB_ENABLE_PYTHON,
792 "A boolean value that indicates if python support is enabled in LLDB");
794 *config_up, "lua", LLDB_ENABLE_LUA,
795 "A boolean value that indicates if lua support is enabled in LLDB");
796 AddBoolConfigEntry(*config_up, "fbsdvmcore", LLDB_ENABLE_FBSDVMCORE,
797 "A boolean value that indicates if fbsdvmcore support is "
798 "enabled in LLDB");
799 AddLLVMTargets(*config_up);
800
802 data.m_impl_up->SetObjectSP(std::move(config_up));
803 return data;
804}
805
807 LLDB_INSTRUMENT_VA(state);
808
809 const bool result = lldb_private::StateIsRunningState(state);
810
811 return result;
812}
813
815 LLDB_INSTRUMENT_VA(state);
816
817 const bool result = lldb_private::StateIsStoppedState(state, false);
818
819 return result;
820}
821
823 const char *target_triple,
824 const char *platform_name,
825 bool add_dependent_modules,
826 lldb::SBError &sb_error) {
827 LLDB_INSTRUMENT_VA(this, filename, target_triple, platform_name,
828 add_dependent_modules, sb_error);
829
830 SBTarget sb_target;
831 TargetSP target_sp;
832 if (m_opaque_sp) {
833 sb_error.Clear();
834 OptionGroupPlatform platform_options(false);
835 platform_options.SetPlatformName(platform_name);
836
837 sb_error.ref() = m_opaque_sp->GetTargetList().CreateTarget(
838 *m_opaque_sp, filename, target_triple,
839 add_dependent_modules ? eLoadDependentsYes : eLoadDependentsNo,
840 &platform_options, target_sp);
841
842 if (sb_error.Success())
843 sb_target.SetSP(target_sp);
844 } else {
845 sb_error.SetErrorString("invalid debugger");
846 }
847
848 Log *log = GetLog(LLDBLog::API);
849 LLDB_LOGF(log,
850 "SBDebugger(%p)::CreateTarget (filename=\"%s\", triple=%s, "
851 "platform_name=%s, add_dependent_modules=%u, error=%s) => "
852 "SBTarget(%p)",
853 static_cast<void *>(m_opaque_sp.get()), filename, target_triple,
854 platform_name, add_dependent_modules, sb_error.GetCString(),
855 static_cast<void *>(target_sp.get()));
856
857 return sb_target;
858}
859
862 const char *target_triple) {
863 LLDB_INSTRUMENT_VA(this, filename, target_triple);
864
865 SBTarget sb_target;
866 TargetSP target_sp;
867 if (m_opaque_sp) {
868 const bool add_dependent_modules = true;
869 Status error(m_opaque_sp->GetTargetList().CreateTarget(
870 *m_opaque_sp, filename, target_triple,
871 add_dependent_modules ? eLoadDependentsYes : eLoadDependentsNo, nullptr,
872 target_sp));
873 sb_target.SetSP(target_sp);
874 }
875
876 Log *log = GetLog(LLDBLog::API);
877 LLDB_LOGF(log,
878 "SBDebugger(%p)::CreateTargetWithFileAndTargetTriple "
879 "(filename=\"%s\", triple=%s) => SBTarget(%p)",
880 static_cast<void *>(m_opaque_sp.get()), filename, target_triple,
881 static_cast<void *>(target_sp.get()));
882
883 return sb_target;
884}
885
887 const char *arch_cstr) {
888 LLDB_INSTRUMENT_VA(this, filename, arch_cstr);
889
890 Log *log = GetLog(LLDBLog::API);
891
892 SBTarget sb_target;
893 TargetSP target_sp;
894 if (m_opaque_sp) {
896 if (arch_cstr == nullptr) {
897 // The version of CreateTarget that takes an ArchSpec won't accept an
898 // empty ArchSpec, so when the arch hasn't been specified, we need to
899 // call the target triple version.
900 error = m_opaque_sp->GetTargetList().CreateTarget(
901 *m_opaque_sp, filename, arch_cstr, eLoadDependentsYes, nullptr,
902 target_sp);
903 } else {
904 PlatformSP platform_sp =
905 m_opaque_sp->GetPlatformList().GetSelectedPlatform();
906 ArchSpec arch =
907 Platform::GetAugmentedArchSpec(platform_sp.get(), arch_cstr);
908 if (arch.IsValid())
909 error = m_opaque_sp->GetTargetList().CreateTarget(
910 *m_opaque_sp, filename, arch, eLoadDependentsYes, platform_sp,
911 target_sp);
912 else
913 error.SetErrorStringWithFormat("invalid arch_cstr: %s", arch_cstr);
914 }
915 if (error.Success())
916 sb_target.SetSP(target_sp);
917 }
918
919 LLDB_LOGF(log,
920 "SBDebugger(%p)::CreateTargetWithFileAndArch (filename=\"%s\", "
921 "arch=%s) => SBTarget(%p)",
922 static_cast<void *>(m_opaque_sp.get()),
923 filename ? filename : "<unspecified>",
924 arch_cstr ? arch_cstr : "<unspecified>",
925 static_cast<void *>(target_sp.get()));
926
927 return sb_target;
928}
929
930SBTarget SBDebugger::CreateTarget(const char *filename) {
931 LLDB_INSTRUMENT_VA(this, filename);
932
933 SBTarget sb_target;
934 TargetSP target_sp;
935 if (m_opaque_sp) {
937 const bool add_dependent_modules = true;
938 error = m_opaque_sp->GetTargetList().CreateTarget(
939 *m_opaque_sp, filename, "",
940 add_dependent_modules ? eLoadDependentsYes : eLoadDependentsNo, nullptr,
941 target_sp);
942
943 if (error.Success())
944 sb_target.SetSP(target_sp);
945 }
946 Log *log = GetLog(LLDBLog::API);
947 LLDB_LOGF(log,
948 "SBDebugger(%p)::CreateTarget (filename=\"%s\") => SBTarget(%p)",
949 static_cast<void *>(m_opaque_sp.get()), filename,
950 static_cast<void *>(target_sp.get()));
951 return sb_target;
952}
953
955 LLDB_INSTRUMENT_VA(this);
956
957 SBTarget sb_target;
958 if (m_opaque_sp) {
959 sb_target.SetSP(m_opaque_sp->GetDummyTarget().shared_from_this());
960 }
961 Log *log = GetLog(LLDBLog::API);
962 LLDB_LOGF(log, "SBDebugger(%p)::GetDummyTarget() => SBTarget(%p)",
963 static_cast<void *>(m_opaque_sp.get()),
964 static_cast<void *>(sb_target.GetSP().get()));
965 return sb_target;
966}
967
969 LLDB_INSTRUMENT_VA(this, target);
970
971 bool result = false;
972 if (m_opaque_sp) {
973 TargetSP target_sp(target.GetSP());
974 if (target_sp) {
975 // No need to lock, the target list is thread safe
976 result = m_opaque_sp->GetTargetList().DeleteTarget(target_sp);
977 target_sp->Destroy();
978 target.Clear();
979 }
980 }
981
982 Log *log = GetLog(LLDBLog::API);
983 LLDB_LOGF(log, "SBDebugger(%p)::DeleteTarget (SBTarget(%p)) => %i",
984 static_cast<void *>(m_opaque_sp.get()),
985 static_cast<void *>(target.m_opaque_sp.get()), result);
986
987 return result;
988}
989
991 LLDB_INSTRUMENT_VA(this, idx);
992
993 SBTarget sb_target;
994 if (m_opaque_sp) {
995 // No need to lock, the target list is thread safe
996 sb_target.SetSP(m_opaque_sp->GetTargetList().GetTargetAtIndex(idx));
997 }
998 return sb_target;
999}
1000
1002 LLDB_INSTRUMENT_VA(this, target);
1003
1004 lldb::TargetSP target_sp = target.GetSP();
1005 if (!target_sp)
1006 return UINT32_MAX;
1007
1008 if (!m_opaque_sp)
1009 return UINT32_MAX;
1010
1011 return m_opaque_sp->GetTargetList().GetIndexOfTarget(target.GetSP());
1012}
1013
1015 LLDB_INSTRUMENT_VA(this, pid);
1016
1017 SBTarget sb_target;
1018 if (m_opaque_sp) {
1019 // No need to lock, the target list is thread safe
1020 sb_target.SetSP(m_opaque_sp->GetTargetList().FindTargetWithProcessID(pid));
1021 }
1022 return sb_target;
1023}
1024
1026 const char *arch_name) {
1027 LLDB_INSTRUMENT_VA(this, filename, arch_name);
1028
1029 SBTarget sb_target;
1030 if (m_opaque_sp && filename && filename[0]) {
1031 // No need to lock, the target list is thread safe
1033 m_opaque_sp->GetPlatformList().GetSelectedPlatform().get(), arch_name);
1034 TargetSP target_sp(
1035 m_opaque_sp->GetTargetList().FindTargetWithExecutableAndArchitecture(
1036 FileSpec(filename), arch_name ? &arch : nullptr));
1037 sb_target.SetSP(target_sp);
1038 }
1039 return sb_target;
1040}
1041
1043 SBTarget sb_target;
1044 if (m_opaque_sp) {
1045 // No need to lock, the target list is thread safe
1046 sb_target.SetSP(
1047 m_opaque_sp->GetTargetList().FindTargetWithProcess(process_sp.get()));
1048 }
1049 return sb_target;
1050}
1051
1053 LLDB_INSTRUMENT_VA(this);
1054
1055 if (m_opaque_sp) {
1056 // No need to lock, the target list is thread safe
1057 return m_opaque_sp->GetTargetList().GetNumTargets();
1058 }
1059 return 0;
1060}
1061
1063 LLDB_INSTRUMENT_VA(this);
1064
1065 Log *log = GetLog(LLDBLog::API);
1066
1067 SBTarget sb_target;
1068 TargetSP target_sp;
1069 if (m_opaque_sp) {
1070 // No need to lock, the target list is thread safe
1071 target_sp = m_opaque_sp->GetTargetList().GetSelectedTarget();
1072 sb_target.SetSP(target_sp);
1073 }
1074
1075 if (log) {
1076 SBStream sstr;
1077 sb_target.GetDescription(sstr, eDescriptionLevelBrief);
1078 LLDB_LOGF(log, "SBDebugger(%p)::GetSelectedTarget () => SBTarget(%p): %s",
1079 static_cast<void *>(m_opaque_sp.get()),
1080 static_cast<void *>(target_sp.get()), sstr.GetData());
1081 }
1082
1083 return sb_target;
1084}
1085
1087 LLDB_INSTRUMENT_VA(this, sb_target);
1088
1089 Log *log = GetLog(LLDBLog::API);
1090
1091 TargetSP target_sp(sb_target.GetSP());
1092 if (m_opaque_sp) {
1093 m_opaque_sp->GetTargetList().SetSelectedTarget(target_sp);
1094 }
1095 if (log) {
1096 SBStream sstr;
1097 sb_target.GetDescription(sstr, eDescriptionLevelBrief);
1098 LLDB_LOGF(log, "SBDebugger(%p)::SetSelectedTarget () => SBTarget(%p): %s",
1099 static_cast<void *>(m_opaque_sp.get()),
1100 static_cast<void *>(target_sp.get()), sstr.GetData());
1101 }
1102}
1103
1105 LLDB_INSTRUMENT_VA(this);
1106
1107 Log *log = GetLog(LLDBLog::API);
1108
1109 SBPlatform sb_platform;
1110 DebuggerSP debugger_sp(m_opaque_sp);
1111 if (debugger_sp) {
1112 sb_platform.SetSP(debugger_sp->GetPlatformList().GetSelectedPlatform());
1113 }
1114 LLDB_LOGF(log, "SBDebugger(%p)::GetSelectedPlatform () => SBPlatform(%p): %s",
1115 static_cast<void *>(m_opaque_sp.get()),
1116 static_cast<void *>(sb_platform.GetSP().get()),
1117 sb_platform.GetName());
1118 return sb_platform;
1119}
1120
1122 LLDB_INSTRUMENT_VA(this, sb_platform);
1123
1124 Log *log = GetLog(LLDBLog::API);
1125
1126 DebuggerSP debugger_sp(m_opaque_sp);
1127 if (debugger_sp) {
1128 debugger_sp->GetPlatformList().SetSelectedPlatform(sb_platform.GetSP());
1129 }
1130
1131 LLDB_LOGF(log, "SBDebugger(%p)::SetSelectedPlatform (SBPlatform(%p) %s)",
1132 static_cast<void *>(m_opaque_sp.get()),
1133 static_cast<void *>(sb_platform.GetSP().get()),
1134 sb_platform.GetName());
1135}
1136
1138 LLDB_INSTRUMENT_VA(this);
1139
1140 if (m_opaque_sp) {
1141 // No need to lock, the platform list is thread safe
1142 return m_opaque_sp->GetPlatformList().GetSize();
1143 }
1144 return 0;
1145}
1146
1148 LLDB_INSTRUMENT_VA(this, idx);
1149
1150 SBPlatform sb_platform;
1151 if (m_opaque_sp) {
1152 // No need to lock, the platform list is thread safe
1153 sb_platform.SetSP(m_opaque_sp->GetPlatformList().GetAtIndex(idx));
1154 }
1155 return sb_platform;
1156}
1157
1159 LLDB_INSTRUMENT_VA(this);
1160
1161 uint32_t idx = 0;
1162 while (true) {
1164 break;
1165 }
1166 ++idx;
1167 }
1168 // +1 for the host platform, which should always appear first in the list.
1169 return idx + 1;
1170}
1171
1173 LLDB_INSTRUMENT_VA(this, idx);
1174
1176 auto platform_dict = std::make_unique<StructuredData::Dictionary>();
1177 llvm::StringRef name_str("name"), desc_str("description");
1178
1179 if (idx == 0) {
1180 PlatformSP host_platform_sp(Platform::GetHostPlatform());
1181 platform_dict->AddStringItem(name_str, host_platform_sp->GetPluginName());
1182 platform_dict->AddStringItem(
1183 desc_str, llvm::StringRef(host_platform_sp->GetDescription()));
1184 } else if (idx > 0) {
1185 llvm::StringRef plugin_name =
1187 if (plugin_name.empty()) {
1188 return data;
1189 }
1190 platform_dict->AddStringItem(name_str, llvm::StringRef(plugin_name));
1191
1192 llvm::StringRef plugin_desc =
1194 platform_dict->AddStringItem(desc_str, llvm::StringRef(plugin_desc));
1195 }
1196
1197 data.m_impl_up->SetObjectSP(
1198 StructuredData::ObjectSP(platform_dict.release()));
1199 return data;
1200}
1201
1202void SBDebugger::DispatchInput(void *baton, const void *data, size_t data_len) {
1203 LLDB_INSTRUMENT_VA(this, baton, data, data_len);
1204
1206}
1207
1208void SBDebugger::DispatchInput(const void *data, size_t data_len) {
1210
1211 // Log *log(GetLog (LLDBLog::API));
1212 //
1213 // if (log)
1214 // LLDB_LOGF(log, "SBDebugger(%p)::DispatchInput (data=\"%.*s\",
1215 // size_t=%" PRIu64 ")",
1216 // m_opaque_sp.get(),
1217 // (int) data_len,
1218 // (const char *) data,
1219 // (uint64_t)data_len);
1220 //
1221 // if (m_opaque_sp)
1222 // m_opaque_sp->DispatchInput ((const char *) data, data_len);
1223}
1224
1226 LLDB_INSTRUMENT_VA(this);
1227
1228 if (m_opaque_sp)
1229 m_opaque_sp->DispatchInputInterrupt();
1230}
1231
1233 LLDB_INSTRUMENT_VA(this);
1234
1235 if (m_opaque_sp)
1236 m_opaque_sp->DispatchInputEndOfFile();
1237}
1238
1240 LLDB_INSTRUMENT_VA(this, reader);
1241}
1242
1243void SBDebugger::RunCommandInterpreter(bool auto_handle_events,
1244 bool spawn_thread) {
1245 LLDB_INSTRUMENT_VA(this, auto_handle_events, spawn_thread);
1246
1247 if (m_opaque_sp) {
1249 options.SetAutoHandleEvents(auto_handle_events);
1250 options.SetSpawnThread(spawn_thread);
1251 m_opaque_sp->GetCommandInterpreter().RunCommandInterpreter(options);
1252 }
1253}
1254
1255void SBDebugger::RunCommandInterpreter(bool auto_handle_events,
1256 bool spawn_thread,
1258 int &num_errors, bool &quit_requested,
1259 bool &stopped_for_crash)
1260
1261{
1262 LLDB_INSTRUMENT_VA(this, auto_handle_events, spawn_thread, options,
1263 num_errors, quit_requested, stopped_for_crash);
1264
1265 if (m_opaque_sp) {
1266 options.SetAutoHandleEvents(auto_handle_events);
1267 options.SetSpawnThread(spawn_thread);
1268 CommandInterpreter &interp = m_opaque_sp->GetCommandInterpreter();
1270 interp.RunCommandInterpreter(options.ref());
1271 num_errors = result.GetNumErrors();
1272 quit_requested =
1274 stopped_for_crash =
1276 }
1277}
1278
1280 const SBCommandInterpreterRunOptions &options) {
1281 LLDB_INSTRUMENT_VA(this, options);
1282
1283 if (!m_opaque_sp)
1285
1286 CommandInterpreter &interp = m_opaque_sp->GetCommandInterpreter();
1288 interp.RunCommandInterpreter(options.ref());
1289
1290 return SBCommandInterpreterRunResult(result);
1291}
1292
1294 const char *repl_options) {
1295 LLDB_INSTRUMENT_VA(this, language, repl_options);
1296
1297 SBError error;
1298 if (m_opaque_sp)
1299 error.ref() = m_opaque_sp->RunREPL(language, repl_options);
1300 else
1301 error.SetErrorString("invalid debugger");
1302 return error;
1303}
1304
1305void SBDebugger::reset(const DebuggerSP &debugger_sp) {
1306 m_opaque_sp = debugger_sp;
1307}
1308
1309Debugger *SBDebugger::get() const { return m_opaque_sp.get(); }
1310
1312 assert(m_opaque_sp.get());
1313 return *m_opaque_sp;
1314}
1315
1317
1320
1321 // No need to lock, the debugger list is thread safe
1322 SBDebugger sb_debugger;
1323 DebuggerSP debugger_sp = Debugger::FindDebuggerWithID(id);
1324 if (debugger_sp)
1325 sb_debugger.reset(debugger_sp);
1326 return sb_debugger;
1327}
1328
1330 LLDB_INSTRUMENT_VA(this);
1331
1332 if (!m_opaque_sp)
1333 return nullptr;
1334
1335 return ConstString(m_opaque_sp->GetInstanceName()).AsCString();
1336}
1337
1338SBError SBDebugger::SetInternalVariable(const char *var_name, const char *value,
1339 const char *debugger_instance_name) {
1340 LLDB_INSTRUMENT_VA(var_name, value, debugger_instance_name);
1341
1342 SBError sb_error;
1343 DebuggerSP debugger_sp(
1344 Debugger::FindDebuggerWithInstanceName(debugger_instance_name));
1345 Status error;
1346 if (debugger_sp) {
1347 ExecutionContext exe_ctx(
1348 debugger_sp->GetCommandInterpreter().GetExecutionContext());
1349 error = debugger_sp->SetPropertyValue(&exe_ctx, eVarSetOperationAssign,
1350 var_name, value);
1351 } else {
1352 error.SetErrorStringWithFormat("invalid debugger instance name '%s'",
1353 debugger_instance_name);
1354 }
1355 if (error.Fail())
1356 sb_error.SetError(error);
1357 return sb_error;
1358}
1359
1362 const char *debugger_instance_name) {
1363 LLDB_INSTRUMENT_VA(var_name, debugger_instance_name);
1364
1365 DebuggerSP debugger_sp(
1366 Debugger::FindDebuggerWithInstanceName(debugger_instance_name));
1367 Status error;
1368 if (debugger_sp) {
1369 ExecutionContext exe_ctx(
1370 debugger_sp->GetCommandInterpreter().GetExecutionContext());
1371 lldb::OptionValueSP value_sp(
1372 debugger_sp->GetPropertyValue(&exe_ctx, var_name, error));
1373 if (value_sp) {
1374 StreamString value_strm;
1375 value_sp->DumpValue(&exe_ctx, value_strm, OptionValue::eDumpOptionValue);
1376 const std::string &value_str = std::string(value_strm.GetString());
1377 if (!value_str.empty()) {
1378 StringList string_list;
1379 string_list.SplitIntoLines(value_str);
1380 return SBStringList(&string_list);
1381 }
1382 }
1383 }
1384 return SBStringList();
1385}
1386
1388 LLDB_INSTRUMENT_VA(this);
1389
1390 return (m_opaque_sp ? m_opaque_sp->GetTerminalWidth() : 0);
1391}
1392
1393void SBDebugger::SetTerminalWidth(uint32_t term_width) {
1394 LLDB_INSTRUMENT_VA(this, term_width);
1395
1396 if (m_opaque_sp)
1397 m_opaque_sp->SetTerminalWidth(term_width);
1398}
1399
1400const char *SBDebugger::GetPrompt() const {
1401 LLDB_INSTRUMENT_VA(this);
1402
1403 Log *log = GetLog(LLDBLog::API);
1404
1405 LLDB_LOG(log, "SBDebugger({0:x})::GetPrompt () => \"{1}\"",
1406 static_cast<void *>(m_opaque_sp.get()),
1407 (m_opaque_sp ? m_opaque_sp->GetPrompt() : ""));
1408
1409 return (m_opaque_sp ? ConstString(m_opaque_sp->GetPrompt()).GetCString()
1410 : nullptr);
1411}
1412
1413void SBDebugger::SetPrompt(const char *prompt) {
1414 LLDB_INSTRUMENT_VA(this, prompt);
1415
1416 if (m_opaque_sp)
1417 m_opaque_sp->SetPrompt(llvm::StringRef(prompt));
1418}
1419
1421 LLDB_INSTRUMENT_VA(this);
1422
1423 return "GetReproducerPath has been deprecated";
1424}
1425
1427 LLDB_INSTRUMENT_VA(this);
1428
1429 return (m_opaque_sp ? m_opaque_sp->GetScriptLanguage() : eScriptLanguageNone);
1430}
1431
1433 LLDB_INSTRUMENT_VA(this, script_lang);
1434
1435 if (m_opaque_sp) {
1436 m_opaque_sp->SetScriptLanguage(script_lang);
1437 }
1438}
1439
1441 LLDB_INSTRUMENT_VA(this);
1442
1443 return (m_opaque_sp ? m_opaque_sp->GetREPLLanguage() : eLanguageTypeUnknown);
1444}
1445
1447 LLDB_INSTRUMENT_VA(this, repl_lang);
1448
1449 if (m_opaque_sp) {
1450 m_opaque_sp->SetREPLLanguage(repl_lang);
1451 }
1452}
1453
1455 LLDB_INSTRUMENT_VA(this, value);
1456
1457 return (m_opaque_sp ? m_opaque_sp->SetUseExternalEditor(value) : false);
1458}
1459
1461 LLDB_INSTRUMENT_VA(this);
1462
1463 return (m_opaque_sp ? m_opaque_sp->GetUseExternalEditor() : false);
1464}
1465
1466bool SBDebugger::SetUseColor(bool value) {
1467 LLDB_INSTRUMENT_VA(this, value);
1468
1469 return (m_opaque_sp ? m_opaque_sp->SetUseColor(value) : false);
1470}
1471
1473 LLDB_INSTRUMENT_VA(this);
1474
1475 return (m_opaque_sp ? m_opaque_sp->GetUseColor() : false);
1476}
1477
1479 LLDB_INSTRUMENT_VA(this, value);
1480
1481 return (m_opaque_sp ? m_opaque_sp->SetUseSourceCache(value) : false);
1482}
1483
1485 LLDB_INSTRUMENT_VA(this);
1486
1487 return (m_opaque_sp ? m_opaque_sp->GetUseSourceCache() : false);
1488}
1489
1491 LLDB_INSTRUMENT_VA(this, description);
1492
1493 Stream &strm = description.ref();
1494
1495 if (m_opaque_sp) {
1496 const char *name = m_opaque_sp->GetInstanceName().c_str();
1497 user_id_t id = m_opaque_sp->GetID();
1498 strm.Printf("Debugger (instance: \"%s\", id: %" PRIu64 ")", name, id);
1499 } else
1500 strm.PutCString("No value");
1501
1502 return true;
1503}
1504
1506 LLDB_INSTRUMENT_VA(this);
1507
1508 return (m_opaque_sp ? m_opaque_sp->GetID() : LLDB_INVALID_UID);
1509}
1510
1511SBError SBDebugger::SetCurrentPlatform(const char *platform_name_cstr) {
1512 LLDB_INSTRUMENT_VA(this, platform_name_cstr);
1513
1514 SBError sb_error;
1515 if (m_opaque_sp) {
1516 if (platform_name_cstr && platform_name_cstr[0]) {
1517 PlatformList &platforms = m_opaque_sp->GetPlatformList();
1518 if (PlatformSP platform_sp = platforms.GetOrCreate(platform_name_cstr))
1519 platforms.SetSelectedPlatform(platform_sp);
1520 else
1521 sb_error.ref().SetErrorString("platform not found");
1522 } else {
1523 sb_error.ref().SetErrorString("invalid platform name");
1524 }
1525 } else {
1526 sb_error.ref().SetErrorString("invalid debugger");
1527 }
1528 return sb_error;
1529}
1530
1531bool SBDebugger::SetCurrentPlatformSDKRoot(const char *sysroot) {
1532 LLDB_INSTRUMENT_VA(this, sysroot);
1533
1534 if (SBPlatform platform = GetSelectedPlatform()) {
1535 platform.SetSDKRoot(sysroot);
1536 return true;
1537 }
1538 return false;
1539}
1540
1542 LLDB_INSTRUMENT_VA(this);
1543
1544 return false;
1545}
1546
1548 LLDB_INSTRUMENT_VA(this, b);
1549}
1550
1551SBTypeCategory SBDebugger::GetCategory(const char *category_name) {
1552 LLDB_INSTRUMENT_VA(this, category_name);
1553
1554 if (!category_name || *category_name == 0)
1555 return SBTypeCategory();
1556
1557 TypeCategoryImplSP category_sp;
1558
1560 category_sp, false)) {
1561 return SBTypeCategory(category_sp);
1562 } else {
1563 return SBTypeCategory();
1564 }
1565}
1566
1568 LLDB_INSTRUMENT_VA(this, lang_type);
1569
1570 TypeCategoryImplSP category_sp;
1571 if (DataVisualization::Categories::GetCategory(lang_type, category_sp)) {
1572 return SBTypeCategory(category_sp);
1573 } else {
1574 return SBTypeCategory();
1575 }
1576}
1577
1578SBTypeCategory SBDebugger::CreateCategory(const char *category_name) {
1579 LLDB_INSTRUMENT_VA(this, category_name);
1580
1581 if (!category_name || *category_name == 0)
1582 return SBTypeCategory();
1583
1584 TypeCategoryImplSP category_sp;
1585
1587 category_sp, true)) {
1588 return SBTypeCategory(category_sp);
1589 } else {
1590 return SBTypeCategory();
1591 }
1592}
1593
1594bool SBDebugger::DeleteCategory(const char *category_name) {
1595 LLDB_INSTRUMENT_VA(this, category_name);
1596
1597 if (!category_name || *category_name == 0)
1598 return false;
1599
1601}
1602
1604 LLDB_INSTRUMENT_VA(this);
1605
1607}
1608
1610 LLDB_INSTRUMENT_VA(this, index);
1611
1612 return SBTypeCategory(
1614}
1615
1617 LLDB_INSTRUMENT_VA(this);
1618
1619 return GetCategory("default");
1620}
1621
1623 LLDB_INSTRUMENT_VA(this, type_name);
1624
1625 SBTypeCategory default_category_sb = GetDefaultCategory();
1626 if (default_category_sb.GetEnabled())
1627 return default_category_sb.GetFormatForType(type_name);
1628 return SBTypeFormat();
1629}
1630
1632 LLDB_INSTRUMENT_VA(this, type_name);
1633
1634 if (!type_name.IsValid())
1635 return SBTypeSummary();
1637}
1638
1640 LLDB_INSTRUMENT_VA(this, type_name);
1641
1642 if (!type_name.IsValid())
1643 return SBTypeFilter();
1645}
1646
1648 LLDB_INSTRUMENT_VA(this, type_name);
1649
1650 if (!type_name.IsValid())
1651 return SBTypeSynthetic();
1652 return SBTypeSynthetic(
1654}
1655
1656static llvm::ArrayRef<const char *> GetCategoryArray(const char **categories) {
1657 if (categories == nullptr)
1658 return {};
1659 size_t len = 0;
1660 while (categories[len] != nullptr)
1661 ++len;
1662 return llvm::ArrayRef(categories, len);
1663}
1664
1665bool SBDebugger::EnableLog(const char *channel, const char **categories) {
1666 LLDB_INSTRUMENT_VA(this, channel, categories);
1667
1668 if (m_opaque_sp) {
1669 uint32_t log_options =
1671 std::string error;
1672 llvm::raw_string_ostream error_stream(error);
1673 return m_opaque_sp->EnableLog(channel, GetCategoryArray(categories), "",
1674 log_options, /*buffer_size=*/0,
1675 eLogHandlerStream, error_stream);
1676 } else
1677 return false;
1678}
1679
1681 void *baton) {
1682 LLDB_INSTRUMENT_VA(this, log_callback, baton);
1683
1684 if (m_opaque_sp) {
1685 return m_opaque_sp->SetLoggingCallback(log_callback, baton);
1686 }
1687}
1688
1690 lldb::SBDebuggerDestroyCallback destroy_callback, void *baton) {
1691 LLDB_INSTRUMENT_VA(this, destroy_callback, baton);
1692 if (m_opaque_sp) {
1693 return m_opaque_sp->SetDestroyCallback(
1694 destroy_callback, baton);
1695 }
1696}
1697
1698SBTrace
1700 const SBFileSpec &trace_description_file) {
1701 LLDB_INSTRUMENT_VA(this, error, trace_description_file);
1702 return SBTrace::LoadTraceFromFile(error, *this, trace_description_file);
1703}
1704
1706 LLDB_INSTRUMENT_VA(this);
1707
1708 if (m_opaque_sp)
1709 m_opaque_sp->RequestInterrupt();
1710}
1712 LLDB_INSTRUMENT_VA(this);
1713
1714 if (m_opaque_sp)
1715 m_opaque_sp->CancelInterruptRequest();
1716}
1717
1719 LLDB_INSTRUMENT_VA(this);
1720
1721 if (m_opaque_sp)
1722 return m_opaque_sp->InterruptRequested();
1723 return false;
1724}
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:342
#define LLDB_LOGF(log,...)
Definition: Log.h:349
#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)
Definition: SBDebugger.cpp:234
static void AddBoolConfigEntry(StructuredData::Dictionary &dict, llvm::StringRef name, bool value, llvm::StringRef description)
Definition: SBDebugger.cpp:751
static void AddLLVMTargets(StructuredData::Dictionary &dict)
Definition: SBDebugger.cpp:760
static llvm::ManagedStatic< SystemLifetimeManager > g_debugger_lifetime
Definition: SBDebugger.cpp:68
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)
bool DeleteCategory(const char *category_name)
lldb::LanguageType GetREPLLanguage() const
lldb::SBTarget GetTargetAtIndex(uint32_t idx)
Definition: SBDebugger.cpp:990
lldb::SBTarget CreateTarget(const char *filename, const char *target_triple, const char *platform_name, bool add_dependent_modules, lldb::SBError &error)
Definition: SBDebugger.cpp:822
SBError RunREPL(lldb::LanguageType language, const char *repl_options)
bool DeleteTarget(lldb::SBTarget &target)
Definition: SBDebugger.cpp:968
void SkipAppInitFiles(bool b)
Definition: SBDebugger.cpp:355
lldb::SBDebugger & operator=(const lldb::SBDebugger &rhs)
Definition: SBDebugger.cpp:103
static void Terminate()
Definition: SBDebugger.cpp:244
lldb::SBPlatform GetPlatformAtIndex(uint32_t idx)
Get one of the currently active platforms.
void SkipLLDBInitFiles(bool b)
Definition: SBDebugger.cpp:348
void SetAsync(bool b)
Definition: SBDebugger.cpp:335
SBTypeSummary GetSummaryForType(SBTypeNameSpecifier)
const void * data
Definition: SBDebugger.h:330
SBTypeCategory GetCategoryAtIndex(uint32_t)
bool SetUseExternalEditor(bool input)
bool GetCloseInputOnEOF() const
static bool GetDefaultArchitecture(char *arch_name, size_t arch_name_len)
Definition: SBDebugger.cpp:681
static void MemoryPressureDetected()
Definition: SBDebugger.cpp:312
void SetPrompt(const char *prompt)
bool GetDescription(lldb::SBStream &description)
void DispatchInput(const void *data, size_t data_len)
bool GetUseExternalEditor()
static void PrintStackTraceOnError()
Definition: SBDebugger.cpp:225
static lldb::SBDebugger Create()
Definition: SBDebugger.cpp:259
void SetInputFileHandle(FILE *f, bool transfer_ownership)
Definition: SBDebugger.cpp:362
void RunCommandInterpreter(bool auto_handle_events, bool spawn_thread)
Run the command interpreter.
static const char * GetVersionString()
Definition: SBDebugger.cpp:739
lldb_private::Debugger & ref() const
lldb::SBStructuredData GetSetting(const char *setting=nullptr)
Getting a specific setting value into SBStructuredData format.
Definition: SBDebugger.cpp:466
const void size_t data_len
Definition: SBDebugger.h:330
const char * GetReproducerPath() const
void SetOutputFileHandle(FILE *f, bool transfer_ownership)
Definition: SBDebugger.cpp:421
static lldb::SBError InitializeWithErrorHandling()
Definition: SBDebugger.cpp:178
void SetTerminalWidth(uint32_t term_width)
void HandleCommand(const char *command)
Definition: SBDebugger.cpp:566
lldb::SBCommandInterpreter GetCommandInterpreter()
Definition: SBDebugger.cpp:556
SBFile GetInputFile()
Definition: SBDebugger.cpp:497
const char * GetPrompt() const
bool SetUseColor(bool use_color)
const lldb::DebuggerSP & get_sp() const
static bool StateIsRunningState(lldb::StateType state)
Definition: SBDebugger.cpp:806
SBError SetErrorFile(SBFile file)
Definition: SBDebugger.cpp:451
bool SetUseSourceCache(bool use_source_cache)
uint32_t GetNumCategories()
static lldb::SBStringList GetInternalVariableValue(const char *var_name, const char *debugger_instance_name)
bool GetUseColor() const
lldb::SBListener GetListener()
Definition: SBDebugger.cpp:599
void SetLoggingCallback(lldb::LogOutputCallback log_callback, void *baton)
lldb::DebuggerSP m_opaque_sp
Definition: SBDebugger.h:498
lldb::ScriptLanguage GetScriptLanguage() const
void SetScriptLanguage(lldb::ScriptLanguage script_lang)
uint32_t GetNumAvailablePlatforms()
Get the number of available platforms.
lldb::SBTarget FindTargetWithLLDBProcess(const lldb::ProcessSP &processSP)
SBStructuredData GetScriptInterpreterInfo(ScriptLanguage)
Definition: SBDebugger.cpp:726
lldb::SBPlatform GetSelectedPlatform()
static const char * GetBroadcasterClass()
Definition: SBDebugger.cpp:112
lldb::SBTarget CreateTargetWithFileAndArch(const char *filename, const char *archname)
Definition: SBDebugger.cpp:886
bool IsValid() const
Definition: SBDebugger.cpp:325
static void Initialize()
Definition: SBDebugger.cpp:173
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 void HandleProcessEvent(const lldb::SBProcess &process, const lldb::SBEvent &event, SBFile out, SBFile err)
Definition: SBDebugger.h:214
static bool StateIsStoppedState(lldb::StateType state)
Definition: SBDebugger.cpp:814
lldb::SBError SetCurrentPlatform(const char *platform_name)
lldb::SBSourceManager GetSourceManager()
Definition: SBDebugger.cpp:674
SBTypeCategory GetCategory(const char *category_name)
void SetREPLLanguage(lldb::LanguageType repl_lang)
static SBDebugger FindDebuggerWithID(int id)
uint32_t GetNumPlatforms()
Get the number of currently active platforms.
void DispatchInputEndOfFile()
uint32_t GetTerminalWidth() const
bool InterruptRequested()
SBTypeFilter GetFilterForType(SBTypeNameSpecifier)
lldb::SBTarget FindTargetWithFileAndArch(const char *filename, const char *arch)
static lldb::SBStructuredData GetProgressDataFromEvent(const lldb::SBEvent &event)
Definition: SBDebugger.cpp:138
static const char * StateAsCString(lldb::StateType state)
Definition: SBDebugger.cpp:745
void PushInputReader(lldb::SBInputReader &reader)
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.
Definition: SBDebugger.cpp:118
lldb::SBTarget GetDummyTarget()
Definition: SBDebugger.cpp:954
bool EnableLog(const char *channel, const char **categories)
static bool SetDefaultArchitecture(const char *arch_name)
Definition: SBDebugger.cpp:702
lldb_private::Debugger * get() const
void RestoreInputTerminalState()
Definition: SBDebugger.cpp:550
SBFile GetOutputFile()
Definition: SBDebugger.cpp:514
lldb::SBBroadcaster GetBroadcaster()
Definition: SBDebugger.cpp:167
void SetSelectedTarget(SBTarget &target)
SBTypeCategory GetDefaultCategory()
bool GetUseSourceCache() const
SBFile GetErrorFile()
Definition: SBDebugger.cpp:533
lldb::SBStructuredData GetAvailablePlatformInfoAtIndex(uint32_t idx)
Get the name and description of one of the available platforms.
static SBStructuredData GetBuildConfiguration()
Definition: SBDebugger.cpp:771
SBTypeCategory CreateCategory(const char *category_name)
bool SetCurrentPlatformSDKRoot(const char *sysroot)
void SetErrorFileHandle(FILE *f, bool transfer_ownership)
Definition: SBDebugger.cpp:441
SBTrace LoadTraceFromFile(SBError &error, const SBFileSpec &trace_description_file)
Load a trace from a trace description file and create Targets, Processes and Threads based on the con...
void CancelInterruptRequest()
uint32_t GetNumTargets()
FILE * GetInputFileHandle()
Definition: SBDebugger.cpp:488
SBError SetInputFile(SBFile file)
Definition: SBDebugger.cpp:395
void DispatchInputInterrupt()
SBError SetInputString(const char *data)
Definition: SBDebugger.cpp:369
uint32_t GetIndexOfTarget(lldb::SBTarget target)
SBError SetOutputFile(SBFile file)
Definition: SBDebugger.cpp:426
SBTypeSynthetic GetSyntheticForType(SBTypeNameSpecifier)
lldb::SBTarget GetSelectedTarget()
void SaveInputTerminalState()
Definition: SBDebugger.cpp:543
FILE * GetErrorFileHandle()
Definition: SBDebugger.cpp:523
void SetSelectedPlatform(lldb::SBPlatform &platform)
void reset(const lldb::DebuggerSP &debugger_sp)
FILE * GetOutputFileHandle()
Definition: SBDebugger.cpp:505
const char * GetInstanceName()
lldb::SBTarget FindTargetWithProcessID(lldb::pid_t pid)
static void PrintDiagnosticsOnError()
Definition: SBDebugger.cpp:238
void SetCloseInputOnEOF(bool b)
lldb::user_id_t GetID()
lldb::SBTarget CreateTargetWithFileAndTargetTriple(const char *filename, const char *target_triple)
Definition: SBDebugger.cpp:861
static lldb::SBStructuredData GetDiagnosticFromEvent(const lldb::SBEvent &event)
Definition: SBDebugger.cpp:153
lldb::ScriptLanguage GetScriptingLanguage(const char *script_language_name)
Definition: SBDebugger.cpp:716
void SetDestroyCallback(lldb::SBDebuggerDestroyCallback destroy_callback, void *baton)
static void Destroy(lldb::SBDebugger &debugger)
Definition: SBDebugger.cpp:303
SBTypeFormat GetFormatForType(SBTypeNameSpecifier)
bool Success() const
Definition: SBError.cpp:75
void SetErrorString(const char *err_str)
Definition: SBError.cpp:132
void SetError(uint32_t err, lldb::ErrorType type)
Definition: SBError.cpp:106
lldb_private::Status & ref()
Definition: SBError.cpp:167
const char * GetCString() const
Get the error string as a NULL terminated UTF8 c-string.
Definition: SBError.cpp:49
void Clear()
Definition: SBError.cpp:57
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)
Definition: SBDebugger.cpp:70
bool IsActive() const
Definition: SBDebugger.cpp:84
void SetIsDone(bool)
Definition: SBDebugger.cpp:82
void reset(lldb::ListenerSP listener_sp)
Definition: SBListener.cpp:292
const char * GetName()
Definition: SBPlatform.cpp:341
lldb::PlatformSP GetSP() const
Definition: SBPlatform.cpp:350
void SetSP(const lldb::PlatformSP &platform_sp)
Definition: SBPlatform.cpp:352
void ReportEventState(const lldb::SBEvent &event, FILE *out) const
Definition: SBProcess.cpp:306
lldb::ProcessSP GetSP() const
Definition: SBProcess.cpp:103
static lldb::StateType GetStateFromEvent(const lldb::SBEvent &event)
Definition: SBProcess.cpp:723
lldb::SBTarget GetTarget() const
Definition: SBProcess.cpp:234
size_t GetSTDOUT(char *dst, size_t dst_len) const
Definition: SBProcess.cpp:261
bool IsValid() const
Definition: SBProcess.cpp:113
size_t GetSTDERR(char *dst, size_t dst_len) const
Definition: SBProcess.cpp:274
lldb_private::Stream & ref()
Definition: SBStream.cpp:177
const char * GetData()
Definition: SBStream.cpp:44
bool GetDescription(lldb::SBStream &description, lldb::DescriptionLevel description_level)
Definition: SBTarget.cpp:1735
void SetSP(const lldb::TargetSP &target_sp)
Definition: SBTarget.cpp:587
lldb::TargetSP GetSP() const
Definition: SBTarget.cpp:585
lldb::TargetSP m_opaque_sp
Definition: SBTarget.h:977
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:348
llvm::Triple & GetTriple()
Architecture triple accessor.
Definition: ArchSpec.h:450
const char * GetArchitectureName() const
Returns a static string representing the current architecture.
Definition: ArchSpec.cpp:552
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.
Definition: ConstString.h:188
const char * GetCString() const
Get the string value as a C string.
Definition: ConstString.h:214
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)
A class to manage flag bits.
Definition: Debugger.h:79
static lldb::DebuggerSP FindDebuggerWithInstanceName(llvm::StringRef instance_name)
Definition: Debugger.cpp:783
static llvm::StringRef GetStaticBroadcasterClass()
Definition: Debugger.cpp:826
static lldb::DebuggerSP CreateInstance(lldb::LogOutputCallback log_callback=nullptr, void *baton=nullptr)
Definition: Debugger.cpp:734
static lldb::DebuggerSP FindDebuggerWithID(lldb::user_id_t id)
Definition: Debugger.cpp:1354
static void Destroy(lldb::DebuggerSP &debugger_sp)
Definition: Debugger.cpp:752
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.
Definition: Diagnostics.cpp:59
static Diagnostics & Instance()
Definition: Diagnostics.cpp:40
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
A file utility class.
Definition: FileSpec.h:56
bool Exists(const FileSpec &file_spec) const
Returns whether the given file exists.
static FileSystem & Instance()
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:128
static size_t RemoveOrphanSharedModules(bool mandatory)
Definition: ModuleList.cpp:784
void SetPlatformName(const char *platform_name)
void SetSelectedPlatform(const lldb::PlatformSP &platform_sp)
Definition: Platform.h:1068
lldb::PlatformSP GetOrCreate(llvm::StringRef name)
Definition: Platform.cpp:2168
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:261
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)
std::string GetMessage() const
virtual StructuredData::DictionarySP GetInterpreterInfo()
An error handling class.
Definition: Status.h:44
void SetErrorString(llvm::StringRef err_str)
Set the current error string to err_str.
Definition: Status.cpp:233
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)
Definition: StringList.cpp:152
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:2609
static void SetDefaultArchitecture(const ArchSpec &arch)
Definition: Target.cpp:2613
static bool XMLEnabled()
Definition: XML.cpp:83
#define LLDB_INVALID_UID
Definition: lldb-defines.h:88
#define UINT32_MAX
Definition: lldb-defines.h:19
A class that represents a running process on the host machine.
Definition: SBAttachInfo.h:14
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
Definition: Log.h:314
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
Definition: SBAddress.h:15
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.
std::shared_ptr< lldb_private::Platform > PlatformSP
Definition: lldb-forward.h:380
StateType
Process and Thread States.
LanguageType
Programming language type.
@ eLanguageTypeUnknown
Unknown or invalid language value.
std::shared_ptr< lldb_private::Process > ProcessSP
Definition: lldb-forward.h:381
std::shared_ptr< lldb_private::Debugger > DebuggerSP
Definition: lldb-forward.h:331
std::shared_ptr< lldb_private::Event > EventSP
Definition: lldb-forward.h:337
uint64_t pid_t
Definition: lldb-types.h:81
std::shared_ptr< lldb_private::Listener > ListenerSP
Definition: lldb-forward.h:360
std::shared_ptr< lldb_private::TypeCategoryImpl > TypeCategoryImplSP
Definition: lldb-forward.h:451
uint64_t user_id_t
Definition: lldb-types.h:80
void(* SBDebuggerDestroyCallback)(lldb::user_id_t debugger_id, void *baton)
Definition: SBDefines.h:139
void(* LogOutputCallback)(const char *, void *baton)
Definition: lldb-types.h:72
std::shared_ptr< lldb_private::Target > TargetSP
Definition: lldb-forward.h:436
std::shared_ptr< lldb_private::File > FileSP
Definition: lldb-forward.h:345
std::shared_ptr< lldb_private::OptionValue > OptionValueSP
Definition: lldb-forward.h:376
InputReaderGranularity
Token size/granularities for Input Readers.
static lldb::ScriptLanguage ToScriptLanguage(llvm::StringRef s, lldb::ScriptLanguage fail_value, bool *success_ptr)