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, "curl", LLVM_ENABLE_CURL,
780 "A boolean value that indicates if CURL support is enabled in LLDB");
782 *config_up, "curses", LLDB_ENABLE_CURSES,
783 "A boolean value that indicates if curses support is enabled in LLDB");
785 *config_up, "editline", LLDB_ENABLE_LIBEDIT,
786 "A boolean value that indicates if editline support is enabled in LLDB");
787 AddBoolConfigEntry(*config_up, "editline_wchar", LLDB_EDITLINE_USE_WCHAR,
788 "A boolean value that indicates if editline wide "
789 "characters support is enabled in LLDB");
791 *config_up, "lzma", LLDB_ENABLE_LZMA,
792 "A boolean value that indicates if lzma support is enabled in LLDB");
794 *config_up, "python", LLDB_ENABLE_PYTHON,
795 "A boolean value that indicates if python support is enabled in LLDB");
797 *config_up, "lua", LLDB_ENABLE_LUA,
798 "A boolean value that indicates if lua support is enabled in LLDB");
799 AddBoolConfigEntry(*config_up, "fbsdvmcore", LLDB_ENABLE_FBSDVMCORE,
800 "A boolean value that indicates if fbsdvmcore support is "
801 "enabled in LLDB");
802 AddLLVMTargets(*config_up);
803
805 data.m_impl_up->SetObjectSP(std::move(config_up));
806 return data;
807}
808
810 LLDB_INSTRUMENT_VA(state);
811
812 const bool result = lldb_private::StateIsRunningState(state);
813
814 return result;
815}
816
818 LLDB_INSTRUMENT_VA(state);
819
820 const bool result = lldb_private::StateIsStoppedState(state, false);
821
822 return result;
823}
824
826 const char *target_triple,
827 const char *platform_name,
828 bool add_dependent_modules,
829 lldb::SBError &sb_error) {
830 LLDB_INSTRUMENT_VA(this, filename, target_triple, platform_name,
831 add_dependent_modules, sb_error);
832
833 SBTarget sb_target;
834 TargetSP target_sp;
835 if (m_opaque_sp) {
836 sb_error.Clear();
837 OptionGroupPlatform platform_options(false);
838 platform_options.SetPlatformName(platform_name);
839
840 sb_error.ref() = m_opaque_sp->GetTargetList().CreateTarget(
841 *m_opaque_sp, filename, target_triple,
842 add_dependent_modules ? eLoadDependentsYes : eLoadDependentsNo,
843 &platform_options, target_sp);
844
845 if (sb_error.Success())
846 sb_target.SetSP(target_sp);
847 } else {
848 sb_error.SetErrorString("invalid debugger");
849 }
850
851 Log *log = GetLog(LLDBLog::API);
852 LLDB_LOGF(log,
853 "SBDebugger(%p)::CreateTarget (filename=\"%s\", triple=%s, "
854 "platform_name=%s, add_dependent_modules=%u, error=%s) => "
855 "SBTarget(%p)",
856 static_cast<void *>(m_opaque_sp.get()), filename, target_triple,
857 platform_name, add_dependent_modules, sb_error.GetCString(),
858 static_cast<void *>(target_sp.get()));
859
860 return sb_target;
861}
862
865 const char *target_triple) {
866 LLDB_INSTRUMENT_VA(this, filename, target_triple);
867
868 SBTarget sb_target;
869 TargetSP target_sp;
870 if (m_opaque_sp) {
871 const bool add_dependent_modules = true;
872 Status error(m_opaque_sp->GetTargetList().CreateTarget(
873 *m_opaque_sp, filename, target_triple,
874 add_dependent_modules ? eLoadDependentsYes : eLoadDependentsNo, nullptr,
875 target_sp));
876 sb_target.SetSP(target_sp);
877 }
878
879 Log *log = GetLog(LLDBLog::API);
880 LLDB_LOGF(log,
881 "SBDebugger(%p)::CreateTargetWithFileAndTargetTriple "
882 "(filename=\"%s\", triple=%s) => SBTarget(%p)",
883 static_cast<void *>(m_opaque_sp.get()), filename, target_triple,
884 static_cast<void *>(target_sp.get()));
885
886 return sb_target;
887}
888
890 const char *arch_cstr) {
891 LLDB_INSTRUMENT_VA(this, filename, arch_cstr);
892
893 Log *log = GetLog(LLDBLog::API);
894
895 SBTarget sb_target;
896 TargetSP target_sp;
897 if (m_opaque_sp) {
899 if (arch_cstr == nullptr) {
900 // The version of CreateTarget that takes an ArchSpec won't accept an
901 // empty ArchSpec, so when the arch hasn't been specified, we need to
902 // call the target triple version.
903 error = m_opaque_sp->GetTargetList().CreateTarget(
904 *m_opaque_sp, filename, arch_cstr, eLoadDependentsYes, nullptr,
905 target_sp);
906 } else {
907 PlatformSP platform_sp =
908 m_opaque_sp->GetPlatformList().GetSelectedPlatform();
909 ArchSpec arch =
910 Platform::GetAugmentedArchSpec(platform_sp.get(), arch_cstr);
911 if (arch.IsValid())
912 error = m_opaque_sp->GetTargetList().CreateTarget(
913 *m_opaque_sp, filename, arch, eLoadDependentsYes, platform_sp,
914 target_sp);
915 else
916 error.SetErrorStringWithFormat("invalid arch_cstr: %s", arch_cstr);
917 }
918 if (error.Success())
919 sb_target.SetSP(target_sp);
920 }
921
922 LLDB_LOGF(log,
923 "SBDebugger(%p)::CreateTargetWithFileAndArch (filename=\"%s\", "
924 "arch=%s) => SBTarget(%p)",
925 static_cast<void *>(m_opaque_sp.get()),
926 filename ? filename : "<unspecified>",
927 arch_cstr ? arch_cstr : "<unspecified>",
928 static_cast<void *>(target_sp.get()));
929
930 return sb_target;
931}
932
933SBTarget SBDebugger::CreateTarget(const char *filename) {
934 LLDB_INSTRUMENT_VA(this, filename);
935
936 SBTarget sb_target;
937 TargetSP target_sp;
938 if (m_opaque_sp) {
940 const bool add_dependent_modules = true;
941 error = m_opaque_sp->GetTargetList().CreateTarget(
942 *m_opaque_sp, filename, "",
943 add_dependent_modules ? eLoadDependentsYes : eLoadDependentsNo, nullptr,
944 target_sp);
945
946 if (error.Success())
947 sb_target.SetSP(target_sp);
948 }
949 Log *log = GetLog(LLDBLog::API);
950 LLDB_LOGF(log,
951 "SBDebugger(%p)::CreateTarget (filename=\"%s\") => SBTarget(%p)",
952 static_cast<void *>(m_opaque_sp.get()), filename,
953 static_cast<void *>(target_sp.get()));
954 return sb_target;
955}
956
958 LLDB_INSTRUMENT_VA(this);
959
960 SBTarget sb_target;
961 if (m_opaque_sp) {
962 sb_target.SetSP(m_opaque_sp->GetDummyTarget().shared_from_this());
963 }
964 Log *log = GetLog(LLDBLog::API);
965 LLDB_LOGF(log, "SBDebugger(%p)::GetDummyTarget() => SBTarget(%p)",
966 static_cast<void *>(m_opaque_sp.get()),
967 static_cast<void *>(sb_target.GetSP().get()));
968 return sb_target;
969}
970
972 LLDB_INSTRUMENT_VA(this, target);
973
974 bool result = false;
975 if (m_opaque_sp) {
976 TargetSP target_sp(target.GetSP());
977 if (target_sp) {
978 // No need to lock, the target list is thread safe
979 result = m_opaque_sp->GetTargetList().DeleteTarget(target_sp);
980 target_sp->Destroy();
981 target.Clear();
982 }
983 }
984
985 Log *log = GetLog(LLDBLog::API);
986 LLDB_LOGF(log, "SBDebugger(%p)::DeleteTarget (SBTarget(%p)) => %i",
987 static_cast<void *>(m_opaque_sp.get()),
988 static_cast<void *>(target.m_opaque_sp.get()), result);
989
990 return result;
991}
992
994 LLDB_INSTRUMENT_VA(this, idx);
995
996 SBTarget sb_target;
997 if (m_opaque_sp) {
998 // No need to lock, the target list is thread safe
999 sb_target.SetSP(m_opaque_sp->GetTargetList().GetTargetAtIndex(idx));
1000 }
1001 return sb_target;
1002}
1003
1005 LLDB_INSTRUMENT_VA(this, target);
1006
1007 lldb::TargetSP target_sp = target.GetSP();
1008 if (!target_sp)
1009 return UINT32_MAX;
1010
1011 if (!m_opaque_sp)
1012 return UINT32_MAX;
1013
1014 return m_opaque_sp->GetTargetList().GetIndexOfTarget(target.GetSP());
1015}
1016
1018 LLDB_INSTRUMENT_VA(this, pid);
1019
1020 SBTarget sb_target;
1021 if (m_opaque_sp) {
1022 // No need to lock, the target list is thread safe
1023 sb_target.SetSP(m_opaque_sp->GetTargetList().FindTargetWithProcessID(pid));
1024 }
1025 return sb_target;
1026}
1027
1029 const char *arch_name) {
1030 LLDB_INSTRUMENT_VA(this, filename, arch_name);
1031
1032 SBTarget sb_target;
1033 if (m_opaque_sp && filename && filename[0]) {
1034 // No need to lock, the target list is thread safe
1036 m_opaque_sp->GetPlatformList().GetSelectedPlatform().get(), arch_name);
1037 TargetSP target_sp(
1038 m_opaque_sp->GetTargetList().FindTargetWithExecutableAndArchitecture(
1039 FileSpec(filename), arch_name ? &arch : nullptr));
1040 sb_target.SetSP(target_sp);
1041 }
1042 return sb_target;
1043}
1044
1046 SBTarget sb_target;
1047 if (m_opaque_sp) {
1048 // No need to lock, the target list is thread safe
1049 sb_target.SetSP(
1050 m_opaque_sp->GetTargetList().FindTargetWithProcess(process_sp.get()));
1051 }
1052 return sb_target;
1053}
1054
1056 LLDB_INSTRUMENT_VA(this);
1057
1058 if (m_opaque_sp) {
1059 // No need to lock, the target list is thread safe
1060 return m_opaque_sp->GetTargetList().GetNumTargets();
1061 }
1062 return 0;
1063}
1064
1066 LLDB_INSTRUMENT_VA(this);
1067
1068 Log *log = GetLog(LLDBLog::API);
1069
1070 SBTarget sb_target;
1071 TargetSP target_sp;
1072 if (m_opaque_sp) {
1073 // No need to lock, the target list is thread safe
1074 target_sp = m_opaque_sp->GetTargetList().GetSelectedTarget();
1075 sb_target.SetSP(target_sp);
1076 }
1077
1078 if (log) {
1079 SBStream sstr;
1080 sb_target.GetDescription(sstr, eDescriptionLevelBrief);
1081 LLDB_LOGF(log, "SBDebugger(%p)::GetSelectedTarget () => SBTarget(%p): %s",
1082 static_cast<void *>(m_opaque_sp.get()),
1083 static_cast<void *>(target_sp.get()), sstr.GetData());
1084 }
1085
1086 return sb_target;
1087}
1088
1090 LLDB_INSTRUMENT_VA(this, sb_target);
1091
1092 Log *log = GetLog(LLDBLog::API);
1093
1094 TargetSP target_sp(sb_target.GetSP());
1095 if (m_opaque_sp) {
1096 m_opaque_sp->GetTargetList().SetSelectedTarget(target_sp);
1097 }
1098 if (log) {
1099 SBStream sstr;
1100 sb_target.GetDescription(sstr, eDescriptionLevelBrief);
1101 LLDB_LOGF(log, "SBDebugger(%p)::SetSelectedTarget () => SBTarget(%p): %s",
1102 static_cast<void *>(m_opaque_sp.get()),
1103 static_cast<void *>(target_sp.get()), sstr.GetData());
1104 }
1105}
1106
1108 LLDB_INSTRUMENT_VA(this);
1109
1110 Log *log = GetLog(LLDBLog::API);
1111
1112 SBPlatform sb_platform;
1113 DebuggerSP debugger_sp(m_opaque_sp);
1114 if (debugger_sp) {
1115 sb_platform.SetSP(debugger_sp->GetPlatformList().GetSelectedPlatform());
1116 }
1117 LLDB_LOGF(log, "SBDebugger(%p)::GetSelectedPlatform () => SBPlatform(%p): %s",
1118 static_cast<void *>(m_opaque_sp.get()),
1119 static_cast<void *>(sb_platform.GetSP().get()),
1120 sb_platform.GetName());
1121 return sb_platform;
1122}
1123
1125 LLDB_INSTRUMENT_VA(this, sb_platform);
1126
1127 Log *log = GetLog(LLDBLog::API);
1128
1129 DebuggerSP debugger_sp(m_opaque_sp);
1130 if (debugger_sp) {
1131 debugger_sp->GetPlatformList().SetSelectedPlatform(sb_platform.GetSP());
1132 }
1133
1134 LLDB_LOGF(log, "SBDebugger(%p)::SetSelectedPlatform (SBPlatform(%p) %s)",
1135 static_cast<void *>(m_opaque_sp.get()),
1136 static_cast<void *>(sb_platform.GetSP().get()),
1137 sb_platform.GetName());
1138}
1139
1141 LLDB_INSTRUMENT_VA(this);
1142
1143 if (m_opaque_sp) {
1144 // No need to lock, the platform list is thread safe
1145 return m_opaque_sp->GetPlatformList().GetSize();
1146 }
1147 return 0;
1148}
1149
1151 LLDB_INSTRUMENT_VA(this, idx);
1152
1153 SBPlatform sb_platform;
1154 if (m_opaque_sp) {
1155 // No need to lock, the platform list is thread safe
1156 sb_platform.SetSP(m_opaque_sp->GetPlatformList().GetAtIndex(idx));
1157 }
1158 return sb_platform;
1159}
1160
1162 LLDB_INSTRUMENT_VA(this);
1163
1164 uint32_t idx = 0;
1165 while (true) {
1167 break;
1168 }
1169 ++idx;
1170 }
1171 // +1 for the host platform, which should always appear first in the list.
1172 return idx + 1;
1173}
1174
1176 LLDB_INSTRUMENT_VA(this, idx);
1177
1179 auto platform_dict = std::make_unique<StructuredData::Dictionary>();
1180 llvm::StringRef name_str("name"), desc_str("description");
1181
1182 if (idx == 0) {
1183 PlatformSP host_platform_sp(Platform::GetHostPlatform());
1184 platform_dict->AddStringItem(name_str, host_platform_sp->GetPluginName());
1185 platform_dict->AddStringItem(
1186 desc_str, llvm::StringRef(host_platform_sp->GetDescription()));
1187 } else if (idx > 0) {
1188 llvm::StringRef plugin_name =
1190 if (plugin_name.empty()) {
1191 return data;
1192 }
1193 platform_dict->AddStringItem(name_str, llvm::StringRef(plugin_name));
1194
1195 llvm::StringRef plugin_desc =
1197 platform_dict->AddStringItem(desc_str, llvm::StringRef(plugin_desc));
1198 }
1199
1200 data.m_impl_up->SetObjectSP(
1201 StructuredData::ObjectSP(platform_dict.release()));
1202 return data;
1203}
1204
1205void SBDebugger::DispatchInput(void *baton, const void *data, size_t data_len) {
1206 LLDB_INSTRUMENT_VA(this, baton, data, data_len);
1207
1209}
1210
1211void SBDebugger::DispatchInput(const void *data, size_t data_len) {
1213
1214 // Log *log(GetLog (LLDBLog::API));
1215 //
1216 // if (log)
1217 // LLDB_LOGF(log, "SBDebugger(%p)::DispatchInput (data=\"%.*s\",
1218 // size_t=%" PRIu64 ")",
1219 // m_opaque_sp.get(),
1220 // (int) data_len,
1221 // (const char *) data,
1222 // (uint64_t)data_len);
1223 //
1224 // if (m_opaque_sp)
1225 // m_opaque_sp->DispatchInput ((const char *) data, data_len);
1226}
1227
1229 LLDB_INSTRUMENT_VA(this);
1230
1231 if (m_opaque_sp)
1232 m_opaque_sp->DispatchInputInterrupt();
1233}
1234
1236 LLDB_INSTRUMENT_VA(this);
1237
1238 if (m_opaque_sp)
1239 m_opaque_sp->DispatchInputEndOfFile();
1240}
1241
1243 LLDB_INSTRUMENT_VA(this, reader);
1244}
1245
1246void SBDebugger::RunCommandInterpreter(bool auto_handle_events,
1247 bool spawn_thread) {
1248 LLDB_INSTRUMENT_VA(this, auto_handle_events, spawn_thread);
1249
1250 if (m_opaque_sp) {
1252 options.SetAutoHandleEvents(auto_handle_events);
1253 options.SetSpawnThread(spawn_thread);
1254 m_opaque_sp->GetCommandInterpreter().RunCommandInterpreter(options);
1255 }
1256}
1257
1258void SBDebugger::RunCommandInterpreter(bool auto_handle_events,
1259 bool spawn_thread,
1261 int &num_errors, bool &quit_requested,
1262 bool &stopped_for_crash)
1263
1264{
1265 LLDB_INSTRUMENT_VA(this, auto_handle_events, spawn_thread, options,
1266 num_errors, quit_requested, stopped_for_crash);
1267
1268 if (m_opaque_sp) {
1269 options.SetAutoHandleEvents(auto_handle_events);
1270 options.SetSpawnThread(spawn_thread);
1271 CommandInterpreter &interp = m_opaque_sp->GetCommandInterpreter();
1273 interp.RunCommandInterpreter(options.ref());
1274 num_errors = result.GetNumErrors();
1275 quit_requested =
1277 stopped_for_crash =
1279 }
1280}
1281
1283 const SBCommandInterpreterRunOptions &options) {
1284 LLDB_INSTRUMENT_VA(this, options);
1285
1286 if (!m_opaque_sp)
1288
1289 CommandInterpreter &interp = m_opaque_sp->GetCommandInterpreter();
1291 interp.RunCommandInterpreter(options.ref());
1292
1293 return SBCommandInterpreterRunResult(result);
1294}
1295
1297 const char *repl_options) {
1298 LLDB_INSTRUMENT_VA(this, language, repl_options);
1299
1300 SBError error;
1301 if (m_opaque_sp)
1302 error.ref() = m_opaque_sp->RunREPL(language, repl_options);
1303 else
1304 error.SetErrorString("invalid debugger");
1305 return error;
1306}
1307
1308void SBDebugger::reset(const DebuggerSP &debugger_sp) {
1309 m_opaque_sp = debugger_sp;
1310}
1311
1312Debugger *SBDebugger::get() const { return m_opaque_sp.get(); }
1313
1315 assert(m_opaque_sp.get());
1316 return *m_opaque_sp;
1317}
1318
1320
1323
1324 // No need to lock, the debugger list is thread safe
1325 SBDebugger sb_debugger;
1326 DebuggerSP debugger_sp = Debugger::FindDebuggerWithID(id);
1327 if (debugger_sp)
1328 sb_debugger.reset(debugger_sp);
1329 return sb_debugger;
1330}
1331
1333 LLDB_INSTRUMENT_VA(this);
1334
1335 if (!m_opaque_sp)
1336 return nullptr;
1337
1338 return ConstString(m_opaque_sp->GetInstanceName()).AsCString();
1339}
1340
1341SBError SBDebugger::SetInternalVariable(const char *var_name, const char *value,
1342 const char *debugger_instance_name) {
1343 LLDB_INSTRUMENT_VA(var_name, value, debugger_instance_name);
1344
1345 SBError sb_error;
1346 DebuggerSP debugger_sp(
1347 Debugger::FindDebuggerWithInstanceName(debugger_instance_name));
1348 Status error;
1349 if (debugger_sp) {
1350 ExecutionContext exe_ctx(
1351 debugger_sp->GetCommandInterpreter().GetExecutionContext());
1352 error = debugger_sp->SetPropertyValue(&exe_ctx, eVarSetOperationAssign,
1353 var_name, value);
1354 } else {
1355 error.SetErrorStringWithFormat("invalid debugger instance name '%s'",
1356 debugger_instance_name);
1357 }
1358 if (error.Fail())
1359 sb_error.SetError(error);
1360 return sb_error;
1361}
1362
1365 const char *debugger_instance_name) {
1366 LLDB_INSTRUMENT_VA(var_name, debugger_instance_name);
1367
1368 DebuggerSP debugger_sp(
1369 Debugger::FindDebuggerWithInstanceName(debugger_instance_name));
1370 Status error;
1371 if (debugger_sp) {
1372 ExecutionContext exe_ctx(
1373 debugger_sp->GetCommandInterpreter().GetExecutionContext());
1374 lldb::OptionValueSP value_sp(
1375 debugger_sp->GetPropertyValue(&exe_ctx, var_name, error));
1376 if (value_sp) {
1377 StreamString value_strm;
1378 value_sp->DumpValue(&exe_ctx, value_strm, OptionValue::eDumpOptionValue);
1379 const std::string &value_str = std::string(value_strm.GetString());
1380 if (!value_str.empty()) {
1381 StringList string_list;
1382 string_list.SplitIntoLines(value_str);
1383 return SBStringList(&string_list);
1384 }
1385 }
1386 }
1387 return SBStringList();
1388}
1389
1391 LLDB_INSTRUMENT_VA(this);
1392
1393 return (m_opaque_sp ? m_opaque_sp->GetTerminalWidth() : 0);
1394}
1395
1396void SBDebugger::SetTerminalWidth(uint32_t term_width) {
1397 LLDB_INSTRUMENT_VA(this, term_width);
1398
1399 if (m_opaque_sp)
1400 m_opaque_sp->SetTerminalWidth(term_width);
1401}
1402
1403const char *SBDebugger::GetPrompt() const {
1404 LLDB_INSTRUMENT_VA(this);
1405
1406 Log *log = GetLog(LLDBLog::API);
1407
1408 LLDB_LOG(log, "SBDebugger({0:x})::GetPrompt () => \"{1}\"",
1409 static_cast<void *>(m_opaque_sp.get()),
1410 (m_opaque_sp ? m_opaque_sp->GetPrompt() : ""));
1411
1412 return (m_opaque_sp ? ConstString(m_opaque_sp->GetPrompt()).GetCString()
1413 : nullptr);
1414}
1415
1416void SBDebugger::SetPrompt(const char *prompt) {
1417 LLDB_INSTRUMENT_VA(this, prompt);
1418
1419 if (m_opaque_sp)
1420 m_opaque_sp->SetPrompt(llvm::StringRef(prompt));
1421}
1422
1424 LLDB_INSTRUMENT_VA(this);
1425
1426 return "GetReproducerPath has been deprecated";
1427}
1428
1430 LLDB_INSTRUMENT_VA(this);
1431
1432 return (m_opaque_sp ? m_opaque_sp->GetScriptLanguage() : eScriptLanguageNone);
1433}
1434
1436 LLDB_INSTRUMENT_VA(this, script_lang);
1437
1438 if (m_opaque_sp) {
1439 m_opaque_sp->SetScriptLanguage(script_lang);
1440 }
1441}
1442
1444 LLDB_INSTRUMENT_VA(this);
1445
1446 return (m_opaque_sp ? m_opaque_sp->GetREPLLanguage() : eLanguageTypeUnknown);
1447}
1448
1450 LLDB_INSTRUMENT_VA(this, repl_lang);
1451
1452 if (m_opaque_sp) {
1453 m_opaque_sp->SetREPLLanguage(repl_lang);
1454 }
1455}
1456
1458 LLDB_INSTRUMENT_VA(this, value);
1459
1460 return (m_opaque_sp ? m_opaque_sp->SetUseExternalEditor(value) : false);
1461}
1462
1464 LLDB_INSTRUMENT_VA(this);
1465
1466 return (m_opaque_sp ? m_opaque_sp->GetUseExternalEditor() : false);
1467}
1468
1469bool SBDebugger::SetUseColor(bool value) {
1470 LLDB_INSTRUMENT_VA(this, value);
1471
1472 return (m_opaque_sp ? m_opaque_sp->SetUseColor(value) : false);
1473}
1474
1476 LLDB_INSTRUMENT_VA(this);
1477
1478 return (m_opaque_sp ? m_opaque_sp->GetUseColor() : false);
1479}
1480
1482 LLDB_INSTRUMENT_VA(this, value);
1483
1484 return (m_opaque_sp ? m_opaque_sp->SetUseSourceCache(value) : false);
1485}
1486
1488 LLDB_INSTRUMENT_VA(this);
1489
1490 return (m_opaque_sp ? m_opaque_sp->GetUseSourceCache() : false);
1491}
1492
1494 LLDB_INSTRUMENT_VA(this, description);
1495
1496 Stream &strm = description.ref();
1497
1498 if (m_opaque_sp) {
1499 const char *name = m_opaque_sp->GetInstanceName().c_str();
1500 user_id_t id = m_opaque_sp->GetID();
1501 strm.Printf("Debugger (instance: \"%s\", id: %" PRIu64 ")", name, id);
1502 } else
1503 strm.PutCString("No value");
1504
1505 return true;
1506}
1507
1509 LLDB_INSTRUMENT_VA(this);
1510
1511 return (m_opaque_sp ? m_opaque_sp->GetID() : LLDB_INVALID_UID);
1512}
1513
1514SBError SBDebugger::SetCurrentPlatform(const char *platform_name_cstr) {
1515 LLDB_INSTRUMENT_VA(this, platform_name_cstr);
1516
1517 SBError sb_error;
1518 if (m_opaque_sp) {
1519 if (platform_name_cstr && platform_name_cstr[0]) {
1520 PlatformList &platforms = m_opaque_sp->GetPlatformList();
1521 if (PlatformSP platform_sp = platforms.GetOrCreate(platform_name_cstr))
1522 platforms.SetSelectedPlatform(platform_sp);
1523 else
1524 sb_error.ref().SetErrorString("platform not found");
1525 } else {
1526 sb_error.ref().SetErrorString("invalid platform name");
1527 }
1528 } else {
1529 sb_error.ref().SetErrorString("invalid debugger");
1530 }
1531 return sb_error;
1532}
1533
1534bool SBDebugger::SetCurrentPlatformSDKRoot(const char *sysroot) {
1535 LLDB_INSTRUMENT_VA(this, sysroot);
1536
1537 if (SBPlatform platform = GetSelectedPlatform()) {
1538 platform.SetSDKRoot(sysroot);
1539 return true;
1540 }
1541 return false;
1542}
1543
1545 LLDB_INSTRUMENT_VA(this);
1546
1547 return false;
1548}
1549
1551 LLDB_INSTRUMENT_VA(this, b);
1552}
1553
1554SBTypeCategory SBDebugger::GetCategory(const char *category_name) {
1555 LLDB_INSTRUMENT_VA(this, category_name);
1556
1557 if (!category_name || *category_name == 0)
1558 return SBTypeCategory();
1559
1560 TypeCategoryImplSP category_sp;
1561
1563 category_sp, false)) {
1564 return SBTypeCategory(category_sp);
1565 } else {
1566 return SBTypeCategory();
1567 }
1568}
1569
1571 LLDB_INSTRUMENT_VA(this, lang_type);
1572
1573 TypeCategoryImplSP category_sp;
1574 if (DataVisualization::Categories::GetCategory(lang_type, category_sp)) {
1575 return SBTypeCategory(category_sp);
1576 } else {
1577 return SBTypeCategory();
1578 }
1579}
1580
1581SBTypeCategory SBDebugger::CreateCategory(const char *category_name) {
1582 LLDB_INSTRUMENT_VA(this, category_name);
1583
1584 if (!category_name || *category_name == 0)
1585 return SBTypeCategory();
1586
1587 TypeCategoryImplSP category_sp;
1588
1590 category_sp, true)) {
1591 return SBTypeCategory(category_sp);
1592 } else {
1593 return SBTypeCategory();
1594 }
1595}
1596
1597bool SBDebugger::DeleteCategory(const char *category_name) {
1598 LLDB_INSTRUMENT_VA(this, category_name);
1599
1600 if (!category_name || *category_name == 0)
1601 return false;
1602
1604}
1605
1607 LLDB_INSTRUMENT_VA(this);
1608
1610}
1611
1613 LLDB_INSTRUMENT_VA(this, index);
1614
1615 return SBTypeCategory(
1617}
1618
1620 LLDB_INSTRUMENT_VA(this);
1621
1622 return GetCategory("default");
1623}
1624
1626 LLDB_INSTRUMENT_VA(this, type_name);
1627
1628 SBTypeCategory default_category_sb = GetDefaultCategory();
1629 if (default_category_sb.GetEnabled())
1630 return default_category_sb.GetFormatForType(type_name);
1631 return SBTypeFormat();
1632}
1633
1635 LLDB_INSTRUMENT_VA(this, type_name);
1636
1637 if (!type_name.IsValid())
1638 return SBTypeSummary();
1640}
1641
1643 LLDB_INSTRUMENT_VA(this, type_name);
1644
1645 if (!type_name.IsValid())
1646 return SBTypeFilter();
1648}
1649
1651 LLDB_INSTRUMENT_VA(this, type_name);
1652
1653 if (!type_name.IsValid())
1654 return SBTypeSynthetic();
1655 return SBTypeSynthetic(
1657}
1658
1659static llvm::ArrayRef<const char *> GetCategoryArray(const char **categories) {
1660 if (categories == nullptr)
1661 return {};
1662 size_t len = 0;
1663 while (categories[len] != nullptr)
1664 ++len;
1665 return llvm::ArrayRef(categories, len);
1666}
1667
1668bool SBDebugger::EnableLog(const char *channel, const char **categories) {
1669 LLDB_INSTRUMENT_VA(this, channel, categories);
1670
1671 if (m_opaque_sp) {
1672 uint32_t log_options =
1674 std::string error;
1675 llvm::raw_string_ostream error_stream(error);
1676 return m_opaque_sp->EnableLog(channel, GetCategoryArray(categories), "",
1677 log_options, /*buffer_size=*/0,
1678 eLogHandlerStream, error_stream);
1679 } else
1680 return false;
1681}
1682
1684 void *baton) {
1685 LLDB_INSTRUMENT_VA(this, log_callback, baton);
1686
1687 if (m_opaque_sp) {
1688 return m_opaque_sp->SetLoggingCallback(log_callback, baton);
1689 }
1690}
1691
1692void SBDebugger::SetDestroyCallback(
1693 lldb::SBDebuggerDestroyCallback destroy_callback, void *baton) {
1694 LLDB_INSTRUMENT_VA(this, destroy_callback, baton);
1695 if (m_opaque_sp) {
1696 return m_opaque_sp->SetDestroyCallback(
1697 destroy_callback, baton);
1698 }
1699}
1700
1703 void *baton) {
1704 LLDB_INSTRUMENT_VA(this, destroy_callback, baton);
1705
1706 if (m_opaque_sp)
1707 return m_opaque_sp->AddDestroyCallback(destroy_callback, baton);
1708
1710}
1711
1713 LLDB_INSTRUMENT_VA(this, token);
1714
1715 if (m_opaque_sp)
1716 return m_opaque_sp->RemoveDestroyCallback(token);
1717
1718 return false;
1719}
1720
1721SBTrace
1723 const SBFileSpec &trace_description_file) {
1724 LLDB_INSTRUMENT_VA(this, error, trace_description_file);
1725 return SBTrace::LoadTraceFromFile(error, *this, trace_description_file);
1726}
1727
1729 LLDB_INSTRUMENT_VA(this);
1730
1731 if (m_opaque_sp)
1732 m_opaque_sp->RequestInterrupt();
1733}
1735 LLDB_INSTRUMENT_VA(this);
1736
1737 if (m_opaque_sp)
1738 m_opaque_sp->CancelInterruptRequest();
1739}
1740
1742 LLDB_INSTRUMENT_VA(this);
1743
1744 if (m_opaque_sp)
1745 return m_opaque_sp->InterruptRequested();
1746 return false;
1747}
1748
1750 return TypeSystem::SupportsLanguageStatic(language);
1751}
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:359
#define LLDB_LOGF(log,...)
Definition: Log.h:366
#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:993
lldb::SBTarget CreateTarget(const char *filename, const char *target_triple, const char *platform_name, bool add_dependent_modules, lldb::SBError &error)
Definition: SBDebugger.cpp:825
SBError RunREPL(lldb::LanguageType language, const char *repl_options)
bool DeleteTarget(lldb::SBTarget &target)
Definition: SBDebugger.cpp:971
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:352
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:352
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:809
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
static bool SupportsLanguage(lldb::LanguageType language)
lldb::SBListener GetListener()
Definition: SBDebugger.cpp:599
void SetLoggingCallback(lldb::LogOutputCallback log_callback, void *baton)
lldb::DebuggerSP m_opaque_sp
Definition: SBDebugger.h:520
lldb::ScriptLanguage GetScriptLanguage() const
LLDB_DEPRECATED_FIXME("Use AddDestroyCallback and RemoveDestroyCallback", "AddDestroyCallback") void SetDestroyCallback(lldb lldb::callback_token_t AddDestroyCallback(lldb::SBDebuggerDestroyCallback destroy_callback, void *baton)
Clear all previously added callbacks and only add the given one.
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:889
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:223
static bool StateIsStoppedState(lldb::StateType state)
Definition: SBDebugger.cpp:817
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:957
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:864
bool RemoveDestroyCallback(lldb::callback_token_t token)
Remove the specified callback. Return true if successful.
static lldb::SBStructuredData GetDiagnosticFromEvent(const lldb::SBEvent &event)
Definition: SBDebugger.cpp:153
lldb::ScriptLanguage GetScriptingLanguage(const char *script_language_name)
Definition: SBDebugger.cpp:716
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:309
lldb::ProcessSP GetSP() const
Definition: SBProcess.cpp:106
static lldb::StateType GetStateFromEvent(const lldb::SBEvent &event)
Definition: SBProcess.cpp:723
lldb::SBTarget GetTarget() const
Definition: SBProcess.cpp:237
size_t GetSTDOUT(char *dst, size_t dst_len) const
Definition: SBProcess.cpp:264
bool IsValid() const
Definition: SBProcess.cpp:116
size_t GetSTDERR(char *dst, size_t dst_len) const
Definition: SBProcess.cpp:277
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:978
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:216
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:80
static lldb::DebuggerSP FindDebuggerWithInstanceName(llvm::StringRef instance_name)
Definition: Debugger.cpp:796
static llvm::StringRef GetStaticBroadcasterClass()
Definition: Debugger.cpp:839
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:1367
static void Destroy(lldb::DebuggerSP &debugger_sp)
Definition: Debugger.cpp:765
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:1085
lldb::PlatformSP GetOrCreate(llvm::StringRef name)
Definition: Platform.cpp:2094
static ArchSpec GetAugmentedArchSpec(Platform *platform, llvm::StringRef triple)
Augments the triple either with information from platform or the host system (if platform is null).
Definition: Platform.cpp:227
static lldb::PlatformSP GetHostPlatform()
Get the native host platform plug-in.
Definition: Platform.cpp:134
static llvm::StringRef GetPlatformPluginDescriptionAtIndex(uint32_t idx)
static llvm::StringRef GetPlatformPluginNameAtIndex(uint32_t idx)
static const ProgressEventData * GetEventDataFromEvent(const Event *event_ptr)
static StructuredData::DictionarySP GetAsStructuredData(const Event *event_ptr)
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:232
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:2615
static void SetDefaultArchitecture(const ArchSpec &arch)
Definition: Target.cpp:2619
static bool SupportsLanguageStatic(lldb::LanguageType language)
Definition: TypeSystem.cpp:339
static bool XMLEnabled()
Definition: XML.cpp:83
#define LLDB_INVALID_UID
Definition: lldb-defines.h:88
#define UINT32_MAX
Definition: lldb-defines.h:19
#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:331
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:386
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:387
std::shared_ptr< lldb_private::Debugger > DebuggerSP
Definition: lldb-forward.h:337
std::shared_ptr< lldb_private::Event > EventSP
Definition: lldb-forward.h:343
uint64_t pid_t
Definition: lldb-types.h:83
std::shared_ptr< lldb_private::Listener > ListenerSP
Definition: lldb-forward.h:366
int32_t callback_token_t
Definition: lldb-types.h:81
std::shared_ptr< lldb_private::TypeCategoryImpl > TypeCategoryImplSP
Definition: lldb-forward.h:459
uint64_t user_id_t
Definition: lldb-types.h:82
void(* SBDebuggerDestroyCallback)(lldb::user_id_t debugger_id, void *baton)
Definition: SBDefines.h:142
void(* LogOutputCallback)(const char *, void *baton)
Definition: lldb-types.h:73
std::shared_ptr< lldb_private::Target > TargetSP
Definition: lldb-forward.h:444
std::shared_ptr< lldb_private::File > FileSP
Definition: lldb-forward.h:351
std::shared_ptr< lldb_private::OptionValue > OptionValueSP
Definition: lldb-forward.h:382
InputReaderGranularity
Token size/granularities for Input Readers.
static lldb::ScriptLanguage ToScriptLanguage(llvm::StringRef s, lldb::ScriptLanguage fail_value, bool *success_ptr)