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