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(nullptr);
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
171 if (m_opaque_sp)
172 return SBBroadcaster(&m_opaque_sp->GetBroadcaster(), false);
173
174 return SBBroadcaster();
175}
176
181
184
186 if (auto e = g_debugger_lifetime->Initialize(
187 std::make_unique<SystemInitializerFull>())) {
188 error.SetError(Status::FromError(std::move(e)));
189 }
190 return error;
191}
192
195
196 llvm::EnablePrettyStackTrace();
197 static std::string executable =
198 llvm::sys::fs::getMainExecutable(nullptr, nullptr);
199 llvm::sys::PrintStackTraceOnErrorSignal(executable);
200}
201
202static void DumpDiagnostics(void *cookie) {
203 Diagnostics::Instance().Dump(llvm::errs());
204}
205
208
209 llvm::sys::AddSignalHandler(&DumpDiagnostics, nullptr);
210}
211
214
215 g_debugger_lifetime->Terminate();
216}
217
219 LLDB_INSTRUMENT_VA(this);
220
221 if (m_opaque_sp)
222 m_opaque_sp->ClearIOHandlers();
223
224 m_opaque_sp.reset();
225}
226
229
230 return SBDebugger::Create(false, nullptr, nullptr);
231}
232
233SBDebugger SBDebugger::Create(bool source_init_files) {
234 LLDB_INSTRUMENT_VA(source_init_files);
235
236 return SBDebugger::Create(source_init_files, nullptr, nullptr);
237}
238
239SBDebugger SBDebugger::Create(bool source_init_files,
240 lldb::LogOutputCallback callback, void *baton)
241
242{
243 LLDB_INSTRUMENT_VA(source_init_files, callback, baton);
244
245 SBDebugger debugger;
246
247 // Currently we have issues if this function is called simultaneously on two
248 // different threads. The issues mainly revolve around the fact that the
249 // lldb_private::FormatManager uses global collections and having two threads
250 // parsing the .lldbinit files can cause mayhem. So to get around this for
251 // now we need to use a mutex to prevent bad things from happening.
252 static std::recursive_mutex g_mutex;
253 std::lock_guard<std::recursive_mutex> guard(g_mutex);
254
255 debugger.reset(Debugger::CreateInstance(callback, baton));
256
258 if (source_init_files) {
259 interp.get()->SkipLLDBInitFiles(false);
260 interp.get()->SkipAppInitFiles(false);
262 interp.SourceInitFileInGlobalDirectory(result);
263 interp.SourceInitFileInHomeDirectory(result, false);
264 } else {
265 interp.get()->SkipLLDBInitFiles(true);
266 interp.get()->SkipAppInitFiles(true);
267 }
268 return debugger;
269}
270
272 LLDB_INSTRUMENT_VA(debugger);
273
275
276 if (debugger.m_opaque_sp.get() != nullptr)
277 debugger.m_opaque_sp.reset();
278}
279
282
283 // Since this function can be call asynchronously, we allow it to be non-
284 // mandatory. We have seen deadlocks with this function when called so we
285 // need to safeguard against this until we can determine what is causing the
286 // deadlocks.
287
288 const bool mandatory = false;
289
291}
292
294 LLDB_INSTRUMENT_VA(this);
295 return this->operator bool();
296}
297SBDebugger::operator bool() const {
298 LLDB_INSTRUMENT_VA(this);
299
300 return m_opaque_sp.get() != nullptr;
301}
302
304 LLDB_INSTRUMENT_VA(this, b);
305
306 if (m_opaque_sp)
307 m_opaque_sp->SetAsyncExecution(b);
308}
309
311 LLDB_INSTRUMENT_VA(this);
312
313 return (m_opaque_sp ? m_opaque_sp->GetAsyncExecution() : false);
314}
315
317 LLDB_INSTRUMENT_VA(this, b);
318
319 if (m_opaque_sp)
320 m_opaque_sp->GetCommandInterpreter().SkipLLDBInitFiles(b);
321}
322
324 LLDB_INSTRUMENT_VA(this, b);
325
326 if (m_opaque_sp)
327 m_opaque_sp->GetCommandInterpreter().SkipAppInitFiles(b);
328}
329
330void SBDebugger::SetInputFileHandle(FILE *fh, bool transfer_ownership) {
331 LLDB_INSTRUMENT_VA(this, fh, transfer_ownership);
332 if (m_opaque_sp)
333 m_opaque_sp->SetInputFile((FileSP)std::make_shared<NativeFile>(
334 fh, File::eOpenOptionReadOnly, transfer_ownership));
335}
336
339 SBError sb_error;
340 if (data == nullptr) {
341 sb_error = Status::FromErrorString("String data is null");
342 return sb_error;
343 }
344
345 size_t size = strlen(data);
346 if (size == 0) {
347 sb_error = Status::FromErrorString("String data is empty");
348 return sb_error;
349 }
350
351 if (!m_opaque_sp) {
352 sb_error = Status::FromErrorString("invalid debugger");
353 return sb_error;
354 }
355
356 sb_error.SetError(m_opaque_sp->SetInputString(data));
357 return sb_error;
358}
359
360// Shouldn't really be settable after initialization as this could cause lots
361// of problems; don't want users trying to switch modes in the middle of a
362// debugging session.
364 LLDB_INSTRUMENT_VA(this, file);
365
367 if (!m_opaque_sp) {
368 error.ref() = Status::FromErrorString("invalid debugger");
369 return error;
370 }
371 if (!file) {
372 error.ref() = Status::FromErrorString("invalid file");
373 return error;
374 }
375 m_opaque_sp->SetInputFile(file.m_opaque_sp);
376 return error;
377}
378
380 LLDB_INSTRUMENT_VA(this, file_sp);
381 return SetInputFile(SBFile(file_sp));
382}
383
385 LLDB_INSTRUMENT_VA(this, file_sp);
386 return SetOutputFile(SBFile(file_sp));
387}
388
389void SBDebugger::SetOutputFileHandle(FILE *fh, bool transfer_ownership) {
390 LLDB_INSTRUMENT_VA(this, fh, transfer_ownership);
391 SetOutputFile((FileSP)std::make_shared<NativeFile>(
392 fh, File::eOpenOptionWriteOnly, transfer_ownership));
393}
394
396 LLDB_INSTRUMENT_VA(this, file);
398 if (!m_opaque_sp) {
399 error.ref() = Status::FromErrorString("invalid debugger");
400 return error;
401 }
402 if (!file) {
403 error.ref() = Status::FromErrorString("invalid file");
404 return error;
405 }
406 m_opaque_sp->SetOutputFile(file.m_opaque_sp);
407 return error;
408}
409
410void SBDebugger::SetErrorFileHandle(FILE *fh, bool transfer_ownership) {
411 LLDB_INSTRUMENT_VA(this, fh, transfer_ownership);
412 SetErrorFile((FileSP)std::make_shared<NativeFile>(
413 fh, File::eOpenOptionWriteOnly, transfer_ownership));
414}
415
417 LLDB_INSTRUMENT_VA(this, file_sp);
418 return SetErrorFile(SBFile(file_sp));
419}
420
422 LLDB_INSTRUMENT_VA(this, file);
424 if (!m_opaque_sp) {
425 error.ref() = Status::FromErrorString("invalid debugger");
426 return error;
427 }
428 if (!file) {
429 error.ref() = Status::FromErrorString("invalid file");
430 return error;
431 }
432 m_opaque_sp->SetErrorFile(file.m_opaque_sp);
433 return error;
434}
435
437 LLDB_INSTRUMENT_VA(this, setting);
438
440 if (!m_opaque_sp)
441 return data;
442
443 StreamString json_strm;
444 ExecutionContext exe_ctx(
445 m_opaque_sp->GetCommandInterpreter().GetExecutionContext());
446 if (setting && strlen(setting) > 0)
447 m_opaque_sp->DumpPropertyValue(&exe_ctx, json_strm, setting,
448 /*dump_mask*/ 0,
449 /*is_json*/ true);
450 else
451 m_opaque_sp->DumpAllPropertyValues(&exe_ctx, json_strm, /*dump_mask*/ 0,
452 /*is_json*/ true);
453
454 data.m_impl_up->SetObjectSP(StructuredData::ParseJSON(json_strm.GetString()));
455 return data;
456}
457
459 LLDB_INSTRUMENT_VA(this);
460 if (m_opaque_sp) {
461 File &file_sp = m_opaque_sp->GetInputFile();
462 return file_sp.GetStream();
463 }
464 return nullptr;
465}
466
468 LLDB_INSTRUMENT_VA(this);
469 if (m_opaque_sp) {
470 return SBFile(m_opaque_sp->GetInputFileSP());
471 }
472 return SBFile();
473}
474
476 LLDB_INSTRUMENT_VA(this);
477 if (m_opaque_sp)
478 return m_opaque_sp->GetOutputFileSP()->GetStream();
479 return nullptr;
480}
481
483 LLDB_INSTRUMENT_VA(this);
484 if (m_opaque_sp)
485 return SBFile(m_opaque_sp->GetOutputFileSP());
486 return SBFile();
487}
488
490 LLDB_INSTRUMENT_VA(this);
491
492 if (m_opaque_sp)
493 return m_opaque_sp->GetErrorFileSP()->GetStream();
494 return nullptr;
495}
496
498 LLDB_INSTRUMENT_VA(this);
499 SBFile file;
500 if (m_opaque_sp)
501 return SBFile(m_opaque_sp->GetErrorFileSP());
502 return SBFile();
503}
504
506 LLDB_INSTRUMENT_VA(this);
507
508 if (m_opaque_sp)
509 m_opaque_sp->SaveInputTerminalState();
510}
511
513 LLDB_INSTRUMENT_VA(this);
514
515 if (m_opaque_sp)
516 m_opaque_sp->RestoreInputTerminalState();
517}
519 LLDB_INSTRUMENT_VA(this);
520
521 SBCommandInterpreter sb_interpreter;
522 if (m_opaque_sp)
523 sb_interpreter.reset(&m_opaque_sp->GetCommandInterpreter());
524
525 return sb_interpreter;
526}
527
528void SBDebugger::HandleCommand(const char *command) {
529 LLDB_INSTRUMENT_VA(this, command);
530
531 if (m_opaque_sp) {
532 TargetSP target_sp(
533 m_opaque_sp->GetCommandInterpreter().GetSelectedTarget());
534 std::unique_lock<std::recursive_mutex> lock;
535 if (target_sp)
536 lock = std::unique_lock<std::recursive_mutex>(target_sp->GetAPIMutex());
537
540
541 sb_interpreter.HandleCommand(command, result, false);
542
543 result.PutError(m_opaque_sp->GetErrorFileSP());
544 result.PutOutput(m_opaque_sp->GetOutputFileSP());
545
546 if (!m_opaque_sp->GetAsyncExecution()) {
547 SBProcess process(GetCommandInterpreter().GetProcess());
548 ProcessSP process_sp(process.GetSP());
549 if (process_sp) {
550 EventSP event_sp;
551 ListenerSP lldb_listener_sp = m_opaque_sp->GetListener();
552 while (lldb_listener_sp->GetEventForBroadcaster(
553 process_sp.get(), event_sp, std::chrono::seconds(0))) {
554 SBEvent event(event_sp);
555 HandleProcessEvent(process, event, GetOutputFile(), GetErrorFile());
556 }
557 }
558 }
559 }
560}
561
563 LLDB_INSTRUMENT_VA(this);
564
565 SBListener sb_listener;
566 if (m_opaque_sp)
567 sb_listener.reset(m_opaque_sp->GetListener());
568
569 return sb_listener;
570}
571
572void SBDebugger::HandleProcessEvent(const SBProcess &process,
573 const SBEvent &event, SBFile out,
574 SBFile err) {
575 LLDB_INSTRUMENT_VA(this, process, event, out, err);
576
577 return HandleProcessEvent(process, event, out.m_opaque_sp, err.m_opaque_sp);
578}
579
580void SBDebugger::HandleProcessEvent(const SBProcess &process,
581 const SBEvent &event, FILE *out,
582 FILE *err) {
583 LLDB_INSTRUMENT_VA(this, process, event, out, err);
584
585 FileSP outfile =
586 std::make_shared<NativeFile>(out, File::eOpenOptionWriteOnly, false);
587 FileSP errfile =
588 std::make_shared<NativeFile>(err, File::eOpenOptionWriteOnly, false);
589 return HandleProcessEvent(process, event, outfile, errfile);
590}
591
592void SBDebugger::HandleProcessEvent(const SBProcess &process,
593 const SBEvent &event, FileSP out_sp,
594 FileSP err_sp) {
595
596 LLDB_INSTRUMENT_VA(this, process, event, out_sp, err_sp);
597
598 if (!process.IsValid())
599 return;
600
601 TargetSP target_sp(process.GetTarget().GetSP());
602 if (!target_sp)
603 return;
604
605 const uint32_t event_type = event.GetType();
606 char stdio_buffer[1024];
607 size_t len;
608
609 std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
610
611 if (event_type &
613 // Drain stdout when we stop just in case we have any bytes
614 while ((len = process.GetSTDOUT(stdio_buffer, sizeof(stdio_buffer))) > 0)
615 if (out_sp)
616 out_sp->Write(stdio_buffer, len);
617 }
618
619 if (event_type &
621 // Drain stderr when we stop just in case we have any bytes
622 while ((len = process.GetSTDERR(stdio_buffer, sizeof(stdio_buffer))) > 0)
623 if (err_sp)
624 err_sp->Write(stdio_buffer, len);
625 }
626
627 if (event_type & Process::eBroadcastBitStateChanged) {
628 StateType event_state = SBProcess::GetStateFromEvent(event);
629
630 if (event_state == eStateInvalid)
631 return;
632
633 bool is_stopped = StateIsStoppedState(event_state);
634 if (!is_stopped)
635 process.ReportEventState(event, out_sp);
636 }
637}
638
640 LLDB_INSTRUMENT_VA(this);
641
642 SBSourceManager sb_source_manager(*this);
643 return sb_source_manager;
644}
645
646bool SBDebugger::GetDefaultArchitecture(char *arch_name, size_t arch_name_len) {
647 LLDB_INSTRUMENT_VA(arch_name, arch_name_len);
648
649 if (arch_name && arch_name_len) {
651
652 if (default_arch.IsValid()) {
653 const std::string &triple_str = default_arch.GetTriple().str();
654 if (!triple_str.empty())
655 ::snprintf(arch_name, arch_name_len, "%s", triple_str.c_str());
656 else
657 ::snprintf(arch_name, arch_name_len, "%s",
658 default_arch.GetArchitectureName());
659 return true;
660 }
661 }
662 if (arch_name && arch_name_len)
663 arch_name[0] = '\0';
664 return false;
665}
666
667bool SBDebugger::SetDefaultArchitecture(const char *arch_name) {
668 LLDB_INSTRUMENT_VA(arch_name);
669
670 if (arch_name) {
671 ArchSpec arch(arch_name);
672 if (arch.IsValid()) {
674 return true;
675 }
676 }
677 return false;
678}
679
681SBDebugger::GetScriptingLanguage(const char *script_language_name) {
682 LLDB_INSTRUMENT_VA(this, script_language_name);
683
684 if (!script_language_name)
687 llvm::StringRef(script_language_name), eScriptLanguageDefault, nullptr);
688}
689
692 LLDB_INSTRUMENT_VA(this, language);
694 if (m_opaque_sp) {
696 m_opaque_sp->GetScriptInterpreter(language);
697 if (interp) {
698 data.m_impl_up->SetObjectSP(interp->GetInterpreterInfo());
699 }
700 }
701 return data;
702}
703
706
708}
709
711 LLDB_INSTRUMENT_VA(state);
712
713 return lldb_private::StateAsCString(state);
714}
715
723
725 LLDB_INSTRUMENT_VA(state);
726
727 const bool result = lldb_private::StateIsRunningState(state);
728
729 return result;
730}
731
733 LLDB_INSTRUMENT_VA(state);
734
735 const bool result = lldb_private::StateIsStoppedState(state, false);
736
737 return result;
738}
739
741 const char *target_triple,
742 const char *platform_name,
743 bool add_dependent_modules,
744 lldb::SBError &sb_error) {
745 LLDB_INSTRUMENT_VA(this, filename, target_triple, platform_name,
746 add_dependent_modules, sb_error);
747
748 SBTarget sb_target;
749 TargetSP target_sp;
750 if (m_opaque_sp) {
751 sb_error.Clear();
752 OptionGroupPlatform platform_options(false);
753 platform_options.SetPlatformName(platform_name);
754
755 sb_error.ref() = m_opaque_sp->GetTargetList().CreateTarget(
756 *m_opaque_sp, filename, target_triple,
757 add_dependent_modules ? eLoadDependentsYes : eLoadDependentsNo,
758 &platform_options, target_sp);
759
760 if (sb_error.Success())
761 sb_target.SetSP(target_sp);
762 } else {
763 sb_error = Status::FromErrorString("invalid debugger");
764 }
765
766 Log *log = GetLog(LLDBLog::API);
767 LLDB_LOGF(log,
768 "SBDebugger(%p)::CreateTarget (filename=\"%s\", triple=%s, "
769 "platform_name=%s, add_dependent_modules=%u, error=%s) => "
770 "SBTarget(%p)",
771 static_cast<void *>(m_opaque_sp.get()), filename, target_triple,
772 platform_name, add_dependent_modules, sb_error.GetCString(),
773 static_cast<void *>(target_sp.get()));
774
775 return sb_target;
776}
777
780 const char *target_triple) {
781 LLDB_INSTRUMENT_VA(this, filename, target_triple);
782
783 SBTarget sb_target;
784 TargetSP target_sp;
785 if (m_opaque_sp) {
786 const bool add_dependent_modules = true;
787 Status error(m_opaque_sp->GetTargetList().CreateTarget(
788 *m_opaque_sp, filename, target_triple,
789 add_dependent_modules ? eLoadDependentsYes : eLoadDependentsNo, nullptr,
790 target_sp));
791 sb_target.SetSP(target_sp);
792 }
793
794 Log *log = GetLog(LLDBLog::API);
795 LLDB_LOGF(log,
796 "SBDebugger(%p)::CreateTargetWithFileAndTargetTriple "
797 "(filename=\"%s\", triple=%s) => SBTarget(%p)",
798 static_cast<void *>(m_opaque_sp.get()), filename, target_triple,
799 static_cast<void *>(target_sp.get()));
800
801 return sb_target;
802}
803
805 const char *arch_cstr) {
806 LLDB_INSTRUMENT_VA(this, filename, arch_cstr);
807
808 Log *log = GetLog(LLDBLog::API);
809
810 SBTarget sb_target;
811 TargetSP target_sp;
812 if (m_opaque_sp) {
814 if (arch_cstr == nullptr) {
815 // The version of CreateTarget that takes an ArchSpec won't accept an
816 // empty ArchSpec, so when the arch hasn't been specified, we need to
817 // call the target triple version.
818 error = m_opaque_sp->GetTargetList().CreateTarget(
819 *m_opaque_sp, filename, arch_cstr, eLoadDependentsYes, nullptr,
820 target_sp);
821 } else {
822 PlatformSP platform_sp =
823 m_opaque_sp->GetPlatformList().GetSelectedPlatform();
824 ArchSpec arch =
825 Platform::GetAugmentedArchSpec(platform_sp.get(), arch_cstr);
826 if (arch.IsValid())
827 error = m_opaque_sp->GetTargetList().CreateTarget(
828 *m_opaque_sp, filename, arch, eLoadDependentsYes, platform_sp,
829 target_sp);
830 else
831 error = Status::FromErrorStringWithFormat("invalid arch_cstr: %s",
832 arch_cstr);
833 }
834 if (error.Success())
835 sb_target.SetSP(target_sp);
836 }
837
838 LLDB_LOGF(log,
839 "SBDebugger(%p)::CreateTargetWithFileAndArch (filename=\"%s\", "
840 "arch=%s) => SBTarget(%p)",
841 static_cast<void *>(m_opaque_sp.get()),
842 filename ? filename : "<unspecified>",
843 arch_cstr ? arch_cstr : "<unspecified>",
844 static_cast<void *>(target_sp.get()));
845
846 return sb_target;
847}
848
849SBTarget SBDebugger::CreateTarget(const char *filename) {
850 LLDB_INSTRUMENT_VA(this, filename);
851
852 SBTarget sb_target;
853 TargetSP target_sp;
854 if (m_opaque_sp) {
856 const bool add_dependent_modules = true;
857 error = m_opaque_sp->GetTargetList().CreateTarget(
858 *m_opaque_sp, filename, "",
859 add_dependent_modules ? eLoadDependentsYes : eLoadDependentsNo, nullptr,
860 target_sp);
861
862 if (error.Success())
863 sb_target.SetSP(target_sp);
864 }
865 Log *log = GetLog(LLDBLog::API);
866 LLDB_LOGF(log,
867 "SBDebugger(%p)::CreateTarget (filename=\"%s\") => SBTarget(%p)",
868 static_cast<void *>(m_opaque_sp.get()), filename,
869 static_cast<void *>(target_sp.get()));
870 return sb_target;
871}
872
874 LLDB_INSTRUMENT_VA(this);
875
876 SBTarget sb_target;
877 if (m_opaque_sp) {
878 sb_target.SetSP(m_opaque_sp->GetDummyTarget().shared_from_this());
879 }
880 Log *log = GetLog(LLDBLog::API);
881 LLDB_LOGF(log, "SBDebugger(%p)::GetDummyTarget() => SBTarget(%p)",
882 static_cast<void *>(m_opaque_sp.get()),
883 static_cast<void *>(sb_target.GetSP().get()));
884 return sb_target;
885}
886
888 LLDB_INSTRUMENT_VA(this);
889 if (m_opaque_sp) {
890 m_opaque_sp->DispatchClientTelemetry(*entry.m_impl_up);
891 } else {
892 Log *log = GetLog(LLDBLog::API);
893 LLDB_LOGF(log,
894 "Could not send telemetry from SBDebugger - debugger was null.");
895 }
896}
897
899 LLDB_INSTRUMENT_VA(this, target);
900
901 bool result = false;
902 if (m_opaque_sp) {
903 TargetSP target_sp(target.GetSP());
904 if (target_sp) {
905 // No need to lock, the target list is thread safe
906 result = m_opaque_sp->GetTargetList().DeleteTarget(target_sp);
907 target_sp->Destroy();
908 target.Clear();
909 }
910 }
911
912 Log *log = GetLog(LLDBLog::API);
913 LLDB_LOGF(log, "SBDebugger(%p)::DeleteTarget (SBTarget(%p)) => %i",
914 static_cast<void *>(m_opaque_sp.get()),
915 static_cast<void *>(target.m_opaque_sp.get()), result);
916
917 return result;
918}
919
921 LLDB_INSTRUMENT_VA(this, idx);
922
923 SBTarget sb_target;
924 if (m_opaque_sp) {
925 // No need to lock, the target list is thread safe
926 sb_target.SetSP(m_opaque_sp->GetTargetList().GetTargetAtIndex(idx));
927 }
928 return sb_target;
929}
930
932 LLDB_INSTRUMENT_VA(this, target);
933
934 lldb::TargetSP target_sp = target.GetSP();
935 if (!target_sp)
936 return UINT32_MAX;
937
938 if (!m_opaque_sp)
939 return UINT32_MAX;
940
941 return m_opaque_sp->GetTargetList().GetIndexOfTarget(target.GetSP());
942}
943
945 LLDB_INSTRUMENT_VA(this, id);
946 SBTarget sb_target;
947 if (m_opaque_sp) {
948 // No need to lock, the target list is thread safe
949 sb_target.SetSP(
950 m_opaque_sp->GetTargetList().FindTargetByGloballyUniqueID(id));
951 }
952 return sb_target;
953}
954
956 LLDB_INSTRUMENT_VA(this, pid);
957
958 SBTarget sb_target;
959 if (m_opaque_sp) {
960 // No need to lock, the target list is thread safe
961 sb_target.SetSP(m_opaque_sp->GetTargetList().FindTargetWithProcessID(pid));
962 }
963 return sb_target;
964}
965
967 const char *arch_name) {
968 LLDB_INSTRUMENT_VA(this, filename, arch_name);
969
970 SBTarget sb_target;
971 if (m_opaque_sp && filename && filename[0]) {
972 // No need to lock, the target list is thread safe
974 m_opaque_sp->GetPlatformList().GetSelectedPlatform().get(), arch_name);
975 TargetSP target_sp(
976 m_opaque_sp->GetTargetList().FindTargetWithExecutableAndArchitecture(
977 FileSpec(filename), arch_name ? &arch : nullptr));
978 sb_target.SetSP(target_sp);
979 }
980 return sb_target;
981}
982
984 SBTarget sb_target;
985 if (m_opaque_sp) {
986 // No need to lock, the target list is thread safe
987 sb_target.SetSP(
988 m_opaque_sp->GetTargetList().FindTargetWithProcess(process_sp.get()));
989 }
990 return sb_target;
991}
992
994 LLDB_INSTRUMENT_VA(this);
995
996 if (m_opaque_sp) {
997 // No need to lock, the target list is thread safe
998 return m_opaque_sp->GetTargetList().GetNumTargets();
999 }
1000 return 0;
1001}
1002
1004 LLDB_INSTRUMENT_VA(this);
1005
1006 Log *log = GetLog(LLDBLog::API);
1007
1008 SBTarget sb_target;
1009 TargetSP target_sp;
1010 if (m_opaque_sp) {
1011 // No need to lock, the target list is thread safe
1012 target_sp = m_opaque_sp->GetTargetList().GetSelectedTarget();
1013 sb_target.SetSP(target_sp);
1014 }
1015
1016 if (log) {
1017 SBStream sstr;
1018 sb_target.GetDescription(sstr, eDescriptionLevelBrief);
1019 LLDB_LOGF(log, "SBDebugger(%p)::GetSelectedTarget () => SBTarget(%p): %s",
1020 static_cast<void *>(m_opaque_sp.get()),
1021 static_cast<void *>(target_sp.get()), sstr.GetData());
1022 }
1023
1024 return sb_target;
1025}
1026
1028 LLDB_INSTRUMENT_VA(this, sb_target);
1029
1030 Log *log = GetLog(LLDBLog::API);
1031
1032 TargetSP target_sp(sb_target.GetSP());
1033 if (m_opaque_sp) {
1034 m_opaque_sp->GetTargetList().SetSelectedTarget(target_sp);
1035 }
1036 if (log) {
1037 SBStream sstr;
1038 sb_target.GetDescription(sstr, eDescriptionLevelBrief);
1039 LLDB_LOGF(log, "SBDebugger(%p)::SetSelectedTarget () => SBTarget(%p): %s",
1040 static_cast<void *>(m_opaque_sp.get()),
1041 static_cast<void *>(target_sp.get()), sstr.GetData());
1042 }
1043}
1044
1046 LLDB_INSTRUMENT_VA(this);
1047
1048 Log *log = GetLog(LLDBLog::API);
1049
1050 SBPlatform sb_platform;
1051 DebuggerSP debugger_sp(m_opaque_sp);
1052 if (debugger_sp) {
1053 sb_platform.SetSP(debugger_sp->GetPlatformList().GetSelectedPlatform());
1054 }
1055 LLDB_LOGF(log, "SBDebugger(%p)::GetSelectedPlatform () => SBPlatform(%p): %s",
1056 static_cast<void *>(m_opaque_sp.get()),
1057 static_cast<void *>(sb_platform.GetSP().get()),
1058 sb_platform.GetName());
1059 return sb_platform;
1060}
1061
1063 LLDB_INSTRUMENT_VA(this, sb_platform);
1064
1065 Log *log = GetLog(LLDBLog::API);
1066
1067 DebuggerSP debugger_sp(m_opaque_sp);
1068 if (debugger_sp) {
1069 debugger_sp->GetPlatformList().SetSelectedPlatform(sb_platform.GetSP());
1070 }
1071
1072 LLDB_LOGF(log, "SBDebugger(%p)::SetSelectedPlatform (SBPlatform(%p) %s)",
1073 static_cast<void *>(m_opaque_sp.get()),
1074 static_cast<void *>(sb_platform.GetSP().get()),
1075 sb_platform.GetName());
1076}
1077
1079 LLDB_INSTRUMENT_VA(this);
1080
1081 if (m_opaque_sp) {
1082 // No need to lock, the platform list is thread safe
1083 return m_opaque_sp->GetPlatformList().GetSize();
1084 }
1085 return 0;
1086}
1087
1089 LLDB_INSTRUMENT_VA(this, idx);
1090
1091 SBPlatform sb_platform;
1092 if (m_opaque_sp) {
1093 // No need to lock, the platform list is thread safe
1094 sb_platform.SetSP(m_opaque_sp->GetPlatformList().GetAtIndex(idx));
1095 }
1096 return sb_platform;
1097}
1098
1100 LLDB_INSTRUMENT_VA(this);
1101
1102 uint32_t idx = 0;
1103 while (true) {
1105 break;
1106 }
1107 ++idx;
1108 }
1109 // +1 for the host platform, which should always appear first in the list.
1110 return idx + 1;
1111}
1112
1114 LLDB_INSTRUMENT_VA(this, idx);
1115
1117 auto platform_dict = std::make_unique<StructuredData::Dictionary>();
1118 llvm::StringRef name_str("name"), desc_str("description");
1119
1120 if (idx == 0) {
1121 PlatformSP host_platform_sp(Platform::GetHostPlatform());
1122 platform_dict->AddStringItem(name_str, host_platform_sp->GetPluginName());
1123 platform_dict->AddStringItem(
1124 desc_str, llvm::StringRef(host_platform_sp->GetDescription()));
1125 } else if (idx > 0) {
1126 llvm::StringRef plugin_name =
1128 if (plugin_name.empty()) {
1129 return data;
1130 }
1131 platform_dict->AddStringItem(name_str, llvm::StringRef(plugin_name));
1132
1133 llvm::StringRef plugin_desc =
1135 platform_dict->AddStringItem(desc_str, llvm::StringRef(plugin_desc));
1136 }
1137
1138 data.m_impl_up->SetObjectSP(
1139 StructuredData::ObjectSP(platform_dict.release()));
1140 return data;
1141}
1142
1143void SBDebugger::DispatchInput(void *baton, const void *data, size_t data_len) {
1144 LLDB_INSTRUMENT_VA(this, baton, data, data_len);
1145
1147}
1148
1149void SBDebugger::DispatchInput(const void *data, size_t data_len) {
1151
1152 // Log *log(GetLog (LLDBLog::API));
1153 //
1154 // if (log)
1155 // LLDB_LOGF(log, "SBDebugger(%p)::DispatchInput (data=\"%.*s\",
1156 // size_t=%" PRIu64 ")",
1157 // m_opaque_sp.get(),
1158 // (int) data_len,
1159 // (const char *) data,
1160 // (uint64_t)data_len);
1161 //
1162 // if (m_opaque_sp)
1163 // m_opaque_sp->DispatchInput ((const char *) data, data_len);
1164}
1165
1167 LLDB_INSTRUMENT_VA(this);
1168
1169 if (m_opaque_sp)
1170 m_opaque_sp->DispatchInputInterrupt();
1171}
1172
1174 LLDB_INSTRUMENT_VA(this);
1175
1176 if (m_opaque_sp)
1177 m_opaque_sp->DispatchInputEndOfFile();
1178}
1179
1181 LLDB_INSTRUMENT_VA(this, reader);
1182}
1183
1184void SBDebugger::RunCommandInterpreter(bool auto_handle_events,
1185 bool spawn_thread) {
1186 LLDB_INSTRUMENT_VA(this, auto_handle_events, spawn_thread);
1187
1188 if (m_opaque_sp) {
1190 options.SetAutoHandleEvents(auto_handle_events);
1191 options.SetSpawnThread(spawn_thread);
1192 m_opaque_sp->GetCommandInterpreter().RunCommandInterpreter(options);
1193 }
1194}
1195
1196void SBDebugger::RunCommandInterpreter(bool auto_handle_events,
1197 bool spawn_thread,
1199 int &num_errors, bool &quit_requested,
1200 bool &stopped_for_crash)
1201
1202{
1203 LLDB_INSTRUMENT_VA(this, auto_handle_events, spawn_thread, options,
1204 num_errors, quit_requested, stopped_for_crash);
1205
1206 if (m_opaque_sp) {
1207 options.SetAutoHandleEvents(auto_handle_events);
1208 options.SetSpawnThread(spawn_thread);
1209 CommandInterpreter &interp = m_opaque_sp->GetCommandInterpreter();
1211 interp.RunCommandInterpreter(options.ref());
1212 num_errors = result.GetNumErrors();
1213 quit_requested =
1215 stopped_for_crash =
1217 }
1218}
1219
1221 const SBCommandInterpreterRunOptions &options) {
1222 LLDB_INSTRUMENT_VA(this, options);
1223
1224 if (!m_opaque_sp)
1226
1227 CommandInterpreter &interp = m_opaque_sp->GetCommandInterpreter();
1229 interp.RunCommandInterpreter(options.ref());
1230
1231 return SBCommandInterpreterRunResult(result);
1232}
1233
1235 const char *repl_options) {
1236 LLDB_INSTRUMENT_VA(this, language, repl_options);
1237
1238 SBError error;
1239 if (m_opaque_sp)
1240 error.ref() = m_opaque_sp->RunREPL(language, repl_options);
1241 else
1242 error = Status::FromErrorString("invalid debugger");
1243 return error;
1244}
1245
1246void SBDebugger::reset(const DebuggerSP &debugger_sp) {
1247 m_opaque_sp = debugger_sp;
1248}
1249
1250Debugger *SBDebugger::get() const { return m_opaque_sp.get(); }
1251
1253 assert(m_opaque_sp.get());
1254 return *m_opaque_sp;
1255}
1256
1258
1261
1262 // No need to lock, the debugger list is thread safe
1263 SBDebugger sb_debugger;
1264 DebuggerSP debugger_sp = Debugger::FindDebuggerWithID(id);
1265 if (debugger_sp)
1266 sb_debugger.reset(debugger_sp);
1267 return sb_debugger;
1268}
1269
1271 LLDB_INSTRUMENT_VA(this);
1272
1273 if (!m_opaque_sp)
1274 return nullptr;
1275
1276 return ConstString(m_opaque_sp->GetInstanceName()).AsCString(nullptr);
1277}
1278
1279SBError SBDebugger::SetInternalVariable(const char *var_name, const char *value,
1280 const char *debugger_instance_name) {
1281 LLDB_INSTRUMENT_VA(var_name, value, debugger_instance_name);
1282
1283 SBError sb_error;
1284 DebuggerSP debugger_sp(
1285 Debugger::FindDebuggerWithInstanceName(debugger_instance_name));
1286 Status error;
1287 if (debugger_sp) {
1288 ExecutionContext exe_ctx(
1289 debugger_sp->GetCommandInterpreter().GetExecutionContext());
1290 error = debugger_sp->SetPropertyValue(&exe_ctx, eVarSetOperationAssign,
1291 var_name, value);
1292 } else {
1294 "invalid debugger instance name '%s'", debugger_instance_name);
1295 }
1296 if (error.Fail())
1297 sb_error.SetError(std::move(error));
1298 return sb_error;
1299}
1300
1303 const char *debugger_instance_name) {
1304 LLDB_INSTRUMENT_VA(var_name, debugger_instance_name);
1305
1306 DebuggerSP debugger_sp(
1307 Debugger::FindDebuggerWithInstanceName(debugger_instance_name));
1308 Status error;
1309 if (debugger_sp) {
1310 ExecutionContext exe_ctx(
1311 debugger_sp->GetCommandInterpreter().GetExecutionContext());
1312 lldb::OptionValueSP value_sp(
1313 debugger_sp->GetPropertyValue(&exe_ctx, var_name, error));
1314 if (value_sp) {
1315 StreamString value_strm;
1316 value_sp->DumpValue(&exe_ctx, value_strm, OptionValue::eDumpOptionValue);
1317 const std::string &value_str = std::string(value_strm.GetString());
1318 if (!value_str.empty()) {
1319 StringList string_list;
1320 string_list.SplitIntoLines(value_str);
1321 return SBStringList(&string_list);
1322 }
1323 }
1324 }
1325 return SBStringList();
1326}
1327
1329 LLDB_INSTRUMENT_VA(this);
1330
1331 return (m_opaque_sp ? m_opaque_sp->GetTerminalWidth() : 0);
1332}
1333
1334void SBDebugger::SetTerminalWidth(uint32_t term_width) {
1335 LLDB_INSTRUMENT_VA(this, term_width);
1336
1337 if (m_opaque_sp)
1338 m_opaque_sp->SetTerminalWidth(term_width);
1339}
1340
1342 LLDB_INSTRUMENT_VA(this);
1343
1344 return (m_opaque_sp ? m_opaque_sp->GetTerminalHeight() : 0);
1345}
1346
1347void SBDebugger::SetTerminalHeight(uint32_t term_height) {
1348 LLDB_INSTRUMENT_VA(this, term_height);
1349
1350 if (m_opaque_sp)
1351 m_opaque_sp->SetTerminalHeight(term_height);
1352}
1353
1354void SBDebugger::SetTerminalDimensions(uint32_t term_width,
1355 uint32_t term_height) {
1356 LLDB_INSTRUMENT_VA(this, term_width, term_height);
1357
1358 if (m_opaque_sp)
1359 m_opaque_sp->SetTerminalDimensions(term_width, term_height);
1360}
1361
1362const char *SBDebugger::GetPrompt() const {
1363 LLDB_INSTRUMENT_VA(this);
1364
1365 Log *log = GetLog(LLDBLog::API);
1366
1367 LLDB_LOG(log, "SBDebugger({0:x})::GetPrompt () => \"{1}\"",
1368 static_cast<void *>(m_opaque_sp.get()),
1369 (m_opaque_sp ? m_opaque_sp->GetPrompt() : ""));
1370
1371 return (m_opaque_sp ? ConstString(m_opaque_sp->GetPrompt()).GetCString()
1372 : nullptr);
1373}
1374
1375void SBDebugger::SetPrompt(const char *prompt) {
1376 LLDB_INSTRUMENT_VA(this, prompt);
1377
1378 if (m_opaque_sp)
1379 m_opaque_sp->SetPrompt(llvm::StringRef(prompt));
1380}
1381
1383 LLDB_INSTRUMENT_VA(this);
1384
1385 return "GetReproducerPath has been deprecated";
1386}
1387
1389 LLDB_INSTRUMENT_VA(this);
1390
1391 return (m_opaque_sp ? m_opaque_sp->GetScriptLanguage() : eScriptLanguageNone);
1392}
1393
1395 LLDB_INSTRUMENT_VA(this, script_lang);
1396
1397 if (m_opaque_sp) {
1398 m_opaque_sp->SetScriptLanguage(script_lang);
1399 }
1400}
1401
1403 LLDB_INSTRUMENT_VA(this);
1404
1405 return (m_opaque_sp ? m_opaque_sp->GetREPLLanguage() : eLanguageTypeUnknown);
1406}
1407
1409 LLDB_INSTRUMENT_VA(this, repl_lang);
1410
1411 if (m_opaque_sp) {
1412 m_opaque_sp->SetREPLLanguage(repl_lang);
1413 }
1414}
1415
1417 LLDB_INSTRUMENT_VA(this, value);
1418
1419 return (m_opaque_sp ? m_opaque_sp->SetUseExternalEditor(value) : false);
1420}
1421
1423 LLDB_INSTRUMENT_VA(this);
1424
1425 return (m_opaque_sp ? m_opaque_sp->GetUseExternalEditor() : false);
1426}
1427
1428bool SBDebugger::SetUseColor(bool value) {
1429 LLDB_INSTRUMENT_VA(this, value);
1430
1431 return (m_opaque_sp ? m_opaque_sp->SetUseColor(value) : false);
1432}
1433
1435 LLDB_INSTRUMENT_VA(this);
1436
1437 return (m_opaque_sp ? m_opaque_sp->GetUseColor() : false);
1438}
1439
1441 LLDB_INSTRUMENT_VA(this, value);
1442
1443 return (m_opaque_sp ? m_opaque_sp->SetShowInlineDiagnostics(value) : false);
1444}
1445
1447 LLDB_INSTRUMENT_VA(this, value);
1448
1449 return (m_opaque_sp ? m_opaque_sp->SetUseSourceCache(value) : false);
1450}
1451
1453 LLDB_INSTRUMENT_VA(this);
1454
1455 return (m_opaque_sp ? m_opaque_sp->GetUseSourceCache() : false);
1456}
1457
1459 LLDB_INSTRUMENT_VA(this, description);
1460
1461 Stream &strm = description.ref();
1462
1463 if (m_opaque_sp) {
1464 const char *name = m_opaque_sp->GetInstanceName().c_str();
1465 user_id_t id = m_opaque_sp->GetID();
1466 strm.Printf("Debugger (instance: \"%s\", id: %" PRIu64 ")", name, id);
1467 } else
1468 strm.PutCString("No value");
1469
1470 return true;
1471}
1472
1474 LLDB_INSTRUMENT_VA(this);
1475
1476 return (m_opaque_sp ? m_opaque_sp->GetID() : LLDB_INVALID_UID);
1477}
1478
1479SBError SBDebugger::SetCurrentPlatform(const char *platform_name_cstr) {
1480 LLDB_INSTRUMENT_VA(this, platform_name_cstr);
1481
1482 SBError sb_error;
1483 if (m_opaque_sp) {
1484 if (platform_name_cstr && platform_name_cstr[0]) {
1485 PlatformList &platforms = m_opaque_sp->GetPlatformList();
1486 if (PlatformSP platform_sp = platforms.GetOrCreate(platform_name_cstr))
1487 platforms.SetSelectedPlatform(platform_sp);
1488 else
1489 sb_error.ref() = Status::FromErrorString("platform not found");
1490 } else {
1491 sb_error.ref() = Status::FromErrorString("invalid platform name");
1492 }
1493 } else {
1494 sb_error.ref() = Status::FromErrorString("invalid debugger");
1495 }
1496 return sb_error;
1497}
1498
1499bool SBDebugger::SetCurrentPlatformSDKRoot(const char *sysroot) {
1500 LLDB_INSTRUMENT_VA(this, sysroot);
1501
1502 if (SBPlatform platform = GetSelectedPlatform()) {
1503 platform.SetSDKRoot(sysroot);
1504 return true;
1505 }
1506 return false;
1507}
1508
1510 LLDB_INSTRUMENT_VA(this);
1511
1512 return false;
1513}
1514
1516 LLDB_INSTRUMENT_VA(this, b);
1517}
1518
1519SBTypeCategory SBDebugger::GetCategory(const char *category_name) {
1520 LLDB_INSTRUMENT_VA(this, category_name);
1521
1522 if (!category_name || *category_name == 0)
1523 return SBTypeCategory();
1524
1525 TypeCategoryImplSP category_sp;
1526
1528 category_sp, false)) {
1529 return SBTypeCategory(category_sp);
1530 } else {
1531 return SBTypeCategory();
1532 }
1533}
1534
1536 LLDB_INSTRUMENT_VA(this, lang_type);
1537
1538 TypeCategoryImplSP category_sp;
1539 if (DataVisualization::Categories::GetCategory(lang_type, category_sp)) {
1540 return SBTypeCategory(category_sp);
1541 } else {
1542 return SBTypeCategory();
1543 }
1544}
1545
1546SBTypeCategory SBDebugger::CreateCategory(const char *category_name) {
1547 LLDB_INSTRUMENT_VA(this, category_name);
1548
1549 if (!category_name || *category_name == 0)
1550 return SBTypeCategory();
1551
1552 TypeCategoryImplSP category_sp;
1553
1555 category_sp, true)) {
1556 return SBTypeCategory(category_sp);
1557 } else {
1558 return SBTypeCategory();
1559 }
1560}
1561
1562bool SBDebugger::DeleteCategory(const char *category_name) {
1563 LLDB_INSTRUMENT_VA(this, category_name);
1564
1565 if (!category_name || *category_name == 0)
1566 return false;
1567
1569}
1570
1576
1583
1585 LLDB_INSTRUMENT_VA(this);
1586
1587 return GetCategory("default");
1588}
1589
1591 LLDB_INSTRUMENT_VA(this, type_name);
1592
1593 SBTypeCategory default_category_sb = GetDefaultCategory();
1594 if (default_category_sb.GetEnabled())
1595 return default_category_sb.GetFormatForType(type_name);
1596 return SBTypeFormat();
1597}
1598
1600 LLDB_INSTRUMENT_VA(this, type_name);
1601
1602 if (!type_name.IsValid())
1603 return SBTypeSummary();
1605}
1606
1608 LLDB_INSTRUMENT_VA(this, type_name);
1609
1610 if (!type_name.IsValid())
1611 return SBTypeFilter();
1613}
1614
1616 LLDB_INSTRUMENT_VA(this, type_name);
1617
1618 if (!type_name.IsValid())
1619 return SBTypeSynthetic();
1620 return SBTypeSynthetic(
1622}
1623
1629
1630static llvm::ArrayRef<const char *> GetCategoryArray(const char **categories) {
1631 if (categories == nullptr)
1632 return {};
1633 size_t len = 0;
1634 while (categories[len] != nullptr)
1635 ++len;
1636 return llvm::ArrayRef(categories, len);
1637}
1638
1639bool SBDebugger::EnableLog(const char *channel, const char **categories) {
1640 LLDB_INSTRUMENT_VA(this, channel, categories);
1641
1642 if (m_opaque_sp) {
1643 uint32_t log_options =
1645 std::string error;
1646 llvm::raw_string_ostream error_stream(error);
1647 return m_opaque_sp->EnableLog(channel, GetCategoryArray(categories), "",
1648 log_options, /*buffer_size=*/0,
1649 eLogHandlerStream, error_stream);
1650 } else
1651 return false;
1652}
1653
1655 void *baton) {
1656 LLDB_INSTRUMENT_VA(this, log_callback, baton);
1657
1658 if (m_opaque_sp) {
1659 return m_opaque_sp->SetLoggingCallback(log_callback, baton);
1660 }
1661}
1662
1663void SBDebugger::SetDestroyCallback(
1664 lldb::SBDebuggerDestroyCallback destroy_callback, void *baton) {
1665 LLDB_INSTRUMENT_VA(this, destroy_callback, baton);
1666 if (m_opaque_sp) {
1667 return m_opaque_sp->SetDestroyCallback(
1668 destroy_callback, baton);
1669 }
1670}
1671
1674 void *baton) {
1675 LLDB_INSTRUMENT_VA(this, destroy_callback, baton);
1676
1677 if (m_opaque_sp)
1678 return m_opaque_sp->AddDestroyCallback(destroy_callback, baton);
1679
1681}
1682
1684 LLDB_INSTRUMENT_VA(this, token);
1685
1686 if (m_opaque_sp)
1687 return m_opaque_sp->RemoveDestroyCallback(token);
1688
1689 return false;
1690}
1691
1692SBTrace
1694 const SBFileSpec &trace_description_file) {
1695 LLDB_INSTRUMENT_VA(this, error, trace_description_file);
1696 return SBTrace::LoadTraceFromFile(error, *this, trace_description_file);
1697}
1698
1700 LLDB_INSTRUMENT_VA(this);
1701
1702 if (m_opaque_sp)
1703 m_opaque_sp->RequestInterrupt();
1704}
1706 LLDB_INSTRUMENT_VA(this);
1707
1708 if (m_opaque_sp)
1709 m_opaque_sp->CancelInterruptRequest();
1710}
1711
1713 LLDB_INSTRUMENT_VA(this);
1714
1715 if (m_opaque_sp)
1716 return m_opaque_sp->InterruptRequested();
1717 return false;
1718}
1719
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:364
#define LLDB_LOGF(log,...)
Definition Log.h:378
#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 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:480
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:691
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:480
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:689
SBTypeSummary GetSummaryForType(SBTypeNameSpecifier type_name_spec)
Get the summary for a type.
void HandleCommand(const char *command)
Execute a command in the command interpreter.
lldb::SBCommandInterpreter GetCommandInterpreter()
Get the command interpreter for this debugger.
SBFile GetInputFile()
Get the input file for the debugger.
const char * GetPrompt() const
Get the command prompt string.
void SetTerminalDimensions(uint32_t term_width, uint32_t term_height)
Set the terminal width and height together.
friend class SBInputReader
Definition SBDebugger.h:687
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:693
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:707
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:688
SBTypeSynthetic GetSyntheticForType(SBTypeNameSpecifier type_name_spec)
Get the synthetic for a type.
void DispatchClientTelemetry(const lldb::SBStructuredData &data)
Dispatch telemetry data from client to server.
SBTypeCategory GetCategoryAtIndex(uint32_t index)
Get a type category by index.
lldb::SBPlatform GetSelectedPlatform()
Get the selected platform.
static const char * GetBroadcasterClass()
Get the broadcaster class name.
lldb::SBTarget CreateTargetWithFileAndArch(const char *filename, const char *archname)
Create a target with the specified file and architecture.
bool IsValid() const
Check if this is a valid SBDebugger object.
static void Initialize()
Initialize LLDB and its subsystems.
static bool StateIsStoppedState(lldb::StateType state)
Check if a state is a stopped state.
lldb::SBError SetCurrentPlatform(const char *platform_name)
Set the current platform by name.
lldb::SBSourceManager GetSourceManager()
Get the source manager for this debugger.
SBTypeCategory GetCategory(const char *category_name)
Get a type category by name.
void ResetStatistics()
Clear collected statistics for targets belonging to this debugger.
void SetREPLLanguage(lldb::LanguageType repl_lang)
Set the current REPL language.
SBStructuredData GetScriptInterpreterInfo(ScriptLanguage language)
Get information about a script interpreter as structured data.
static SBDebugger FindDebuggerWithID(int id)
Find a debugger by ID. Returns an invalid debugger if not found.
bool SetShowInlineDiagnostics(bool b)
Set whether to show inline diagnostics.
uint32_t GetNumPlatforms()
Get the number of currently active platforms.
void DispatchInputEndOfFile()
Signal end-of-file to the current input dispatch.
uint32_t GetTerminalWidth() const
Get the terminal width.
bool InterruptRequested()
Check if an interrupt has been requested.
lldb::SBTarget FindTargetWithFileAndArch(const char *filename, const char *arch)
Find a target with the specified file and architecture.
static lldb::SBStructuredData GetProgressDataFromEvent(const lldb::SBEvent &event)
Get progress data from an event.
static const char * StateAsCString(lldb::StateType state)
Convert a state type to a string.
void PushInputReader(lldb::SBInputReader &reader)
Push an input reader onto the IO handler stack.
static const char * GetProgressFromEvent(const lldb::SBEvent &event, uint64_t &progress_id, uint64_t &completed, uint64_t &total, bool &is_debugger_specific)
Get progress data from a SBEvent whose type is eBroadcastBitProgress.
lldb::SBTarget GetDummyTarget()
Get the dummy target.
bool EnableLog(const char *channel, const char **categories)
Enable logging for a specific channel and category.
static bool SetDefaultArchitecture(const char *arch_name)
Set the default architecture.
lldb_private::Debugger * get() const
void RestoreInputTerminalState()
Restore the previously saved terminal state.
SBFile GetOutputFile()
Get the output file for the debugger.
lldb::SBBroadcaster GetBroadcaster()
Get the broadcaster that allows subscribing to events from this debugger.
void SetSelectedTarget(SBTarget &target)
Set the selected target.
SBTypeCategory GetDefaultCategory()
Get the default type category.
bool GetUseSourceCache() const
Get whether the source cache is being used.
SBFile GetErrorFile()
Get the error file for the debugger.
uint32_t GetTerminalHeight() const
Get the terminal height.
LLDB_DEPRECATED_FIXME("Use HandleProcessEvent(const SBProcess &, const SBEvent &, SBFile, " "SBFile) or HandleProcessEvent(const SBProcess &, const SBEvent &, " "FileSP, FileSP)", "HandleProcessEvent(const SBProcess &, const SBEvent &, SBFile, SBFile)") void HandleProcessEvent(const lldb voi HandleProcessEvent)(const lldb::SBProcess &process, const lldb::SBEvent &event, SBFile out, SBFile err)
Handle a process event (deprecated).
Definition SBDebugger.h:306
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:690
void reset(const lldb::DebuggerSP &debugger_sp)
friend class SBPlatform
Definition SBDebugger.h:692
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:686
lldb::user_id_t GetID()
Get the unique ID of this debugger.
lldb::SBTarget CreateTargetWithFileAndTargetTriple(const char *filename, const char *target_triple)
Create a target with the specified file and target triple.
SBDebugger()
Default constructor creates an invalid SBDebugger instance.
bool RemoveDestroyCallback(lldb::callback_token_t token)
Remove a destroy callback.
static lldb::SBStructuredData GetDiagnosticFromEvent(const lldb::SBEvent &event)
Get diagnostic information from an event.
lldb::ScriptLanguage GetScriptingLanguage(const char *script_language_name)
Get the scripting language by name.
lldb::SBTarget FindTargetByGloballyUniqueID(lldb::user_id_t id) const
Find a target with the specified unique ID.
static void Destroy(lldb::SBDebugger &debugger)
Destroy a debugger instance.
void RequestInterrupt()
Request an interrupt of the current operation.
bool Success() const
Definition SBError.cpp:81
void SetError(uint32_t err, lldb::ErrorType type)
Definition SBError.cpp:124
lldb_private::Status & ref()
Definition SBError.cpp:191
const char * GetCString() const
Get the error string as a NULL terminated UTF8 c-string.
Definition SBError.cpp:55
void Clear()
Definition SBError.cpp:63
lldb_private::Event * get() const
Definition SBEvent.cpp:134
FileSP m_opaque_sp
Definition SBFile.h:54
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:178
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:597
lldb::TargetSP GetSP() const
Definition SBTarget.cpp:595
lldb::TargetSP m_opaque_sp
Definition SBTarget.h:1081
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:32
bool IsValid() const
Tests if this ArchSpec is valid.
Definition ArchSpec.h:370
llvm::Triple & GetTriple()
Architecture triple accessor.
Definition ArchSpec.h:460
const char * GetArchitectureName() const
Returns a static string representing the current architecture.
Definition ArchSpec.cpp:557
void SetAutoHandleEvents(bool auto_handle_events)
bool IsResult(lldb::CommandInterpreterResult result)
void SkipAppInitFiles(bool skip_app_init_files)
void SkipLLDBInitFiles(bool skip_lldbinit_files)
CommandInterpreterRunResult RunCommandInterpreter(CommandInterpreterRunOptions &options)
A uniqued constant string class.
Definition ConstString.h:40
const char * GetCString() const
Get the string value as a C string.
const char * AsCString(const char *value_if_empty) 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:100
static lldb::DebuggerSP FindDebuggerWithInstanceName(llvm::StringRef instance_name)
Definition Debugger.cpp:995
static StructuredData::DictionarySP GetBuildConfiguration()
Get the build configuration as structured data.
static llvm::StringRef GetStaticBroadcasterClass()
static lldb::DebuggerSP CreateInstance(lldb::LogOutputCallback log_callback=nullptr, void *baton=nullptr)
Definition Debugger.cpp:919
static lldb::DebuggerSP FindDebuggerWithID(lldb::user_id_t id)
static void Destroy(lldb::DebuggerSP &debugger_sp)
Definition Debugger.cpp:963
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 FileBase.h:34
virtual FILE * GetStream()
Get the underlying libc stream for this file, or NULL.
Definition File.cpp:121
static size_t RemoveOrphanSharedModules(bool mandatory)
void SetPlatformName(const char *platform_name)
void SetSelectedPlatform(const lldb::PlatformSP &platform_sp)
Definition Platform.h:1193
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:321
static lldb::PlatformSP GetHostPlatform()
Get the native host platform plug-in.
Definition Platform.cpp:139
static llvm::StringRef GetPlatformPluginDescriptionAtIndex(uint32_t idx)
static llvm::StringRef GetPlatformPluginNameAtIndex(uint32_t idx)
static const ProgressEventData * GetEventDataFromEvent(const Event *event_ptr)
static StructuredData::DictionarySP GetAsStructuredData(const Event *event_ptr)
virtual StructuredData::DictionarySP GetInterpreterInfo()
An error handling class.
Definition Status.h:118
static Status FromErrorStringWithFormat(const char *format,...) __attribute__((format(printf
Definition Status.cpp:106
static Status FromErrorString(const char *str)
Definition Status.h:141
static Status FromError(llvm::Error error)
Avoid using this in new code. Migrate APIs to llvm::Expected instead.
Definition Status.cpp:136
llvm::StringRef GetString() const
A stream class that can stream formatted output to a file.
Definition Stream.h:28
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
Definition Stream.cpp:134
size_t PutCString(llvm::StringRef cstr)
Output a C string to the stream.
Definition Stream.cpp:63
size_t SplitIntoLines(const std::string &lines)
std::shared_ptr< Dictionary > DictionarySP
std::shared_ptr< Object > ObjectSP
static ObjectSP ParseJSON(llvm::StringRef json_text)
static ArchSpec GetDefaultArchitecture()
Definition Target.cpp:2865
static void SetDefaultArchitecture(const ArchSpec &arch)
Definition Target.cpp:2869
static bool SupportsLanguageStatic(lldb::LanguageType language)
#define LLDB_INVALID_UID
#define UINT32_MAX
#define LLDB_INVALID_CALLBACK_TOKEN
Definition lldb-types.h:71
A class that represents a running process on the host machine.
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
Definition Log.h:327
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
class LLDB_API SBBroadcaster
Definition SBDefines.h:55
@ 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:122
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:125
class LLDB_API SBTypeFormat
Definition SBDefines.h:126
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:110
void(* SBDebuggerDestroyCallback)(lldb::user_id_t debugger_id, void *baton)
Definition SBDefines.h:146
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:133
class LLDB_API SBCommandInterpreterRunResult
Definition SBDefines.h:59
InputReaderGranularity
Token size/granularities for Input Readers.
class LLDB_API SBTypeSummary
Definition SBDefines.h:131
static lldb::ScriptLanguage ToScriptLanguage(llvm::StringRef s, lldb::ScriptLanguage fail_value, bool *success_ptr)