62#include "llvm/ADT/STLExtras.h"
63#include "llvm/ADT/StringRef.h"
64#include "llvm/ADT/iterator.h"
65#include "llvm/Support/DynamicLibrary.h"
66#include "llvm/Support/FileSystem.h"
67#include "llvm/Support/Process.h"
68#include "llvm/Support/ThreadPool.h"
69#include "llvm/Support/Threading.h"
70#include "llvm/Support/raw_ostream.h"
81#include <system_error>
101#pragma mark Static Functions
113 "Never show disassembly when displaying a stop context.",
118 "Show disassembly when there is no debug information.",
123 "Show disassembly when there is no source information, or the source "
125 "is missing when displaying a stop context.",
130 "Always show disassembly when displaying a stop context.",
138 "Disable scripting languages.",
143 "Select python as the default scripting language.",
148 "Select the lldb default as the default scripting language.",
154 "Use no verbosity when running dwim-print."},
156 "Use partial verbosity when running dwim-print - display a message when "
157 "`expression` evaluation is used."},
159 "Use full verbosity when running dwim-print."},
166 "Highlight the stop column with ANSI terminal codes when color/ANSI "
167 "mode is enabled; otherwise, fall back to using a text-only caret (^) "
168 "as if \"caret-only\" mode was selected.",
173 "Highlight the stop column with ANSI terminal codes when running LLDB "
174 "with color/ANSI enabled.",
179 "Highlight the stop column with a caret character (^) underneath the "
180 "stop column. This method introduces a new line in source listings "
181 "that display thread stop locations.",
186 "Do not highlight the stop column.",
190#define LLDB_PROPERTIES_debugger
191#include "CoreProperties.inc"
194#define LLDB_PROPERTIES_debugger
195#include "CorePropertiesEnum.inc"
202 llvm::StringRef property_path,
203 llvm::StringRef value) {
204 bool is_load_script =
205 (property_path ==
"target.load-script-from-symbol-file");
207 bool invalidate_data_vis = (property_path ==
"escape-non-printables");
208 invalidate_data_vis |=
209 (property_path ==
"target.max-zero-padding-in-float-format");
210 if (invalidate_data_vis) {
216 if (is_load_script && exe_ctx && exe_ctx->
GetTargetSP()) {
218 load_script_old_value =
219 target_sp->TargetProperties::GetLoadScriptFromSymbolFile();
222 if (
error.Success()) {
224 if (property_path == g_debugger_properties[ePropertyPrompt].name) {
225 llvm::StringRef new_prompt =
GetPrompt();
231 auto bytes = std::make_unique<EventDataBytes>(new_prompt);
232 auto prompt_change_event_sp = std::make_shared<Event>(
235 }
else if (property_path == g_debugger_properties[ePropertyUseColor].name) {
239 }
else if (property_path ==
240 g_debugger_properties[ePropertyPromptAnsiPrefix].name ||
242 g_debugger_properties[ePropertyPromptAnsiSuffix].name) {
246 }
else if (property_path ==
247 g_debugger_properties[ePropertyUseSourceCache].name) {
253 }
else if (is_load_script && target_sp &&
255 if (target_sp->TargetProperties::GetLoadScriptFromSymbolFile() ==
257 std::list<Status> errors;
259 if (!target_sp->LoadScriptingResources(errors, feedback_stream)) {
261 for (
auto &
error : errors) {
274 constexpr uint32_t idx = ePropertyAutoConfirm;
275 return GetPropertyAtIndexAs<bool>(
276 idx, g_debugger_properties[idx].default_uint_value != 0);
280 constexpr uint32_t idx = ePropertyDisassemblyFormat;
281 return GetPropertyAtIndexAs<const FormatEntity::Entry *>(idx);
285 constexpr uint32_t idx = ePropertyFrameFormat;
286 return GetPropertyAtIndexAs<const FormatEntity::Entry *>(idx);
290 constexpr uint32_t idx = ePropertyFrameFormatUnique;
291 return GetPropertyAtIndexAs<const FormatEntity::Entry *>(idx);
295 constexpr uint32_t idx = ePropertyStopDisassemblyMaxSize;
296 return GetPropertyAtIndexAs<uint64_t>(
297 idx, g_debugger_properties[idx].default_uint_value);
301 constexpr uint32_t idx = ePropertyNotiftVoid;
302 return GetPropertyAtIndexAs<uint64_t>(
303 idx, g_debugger_properties[idx].default_uint_value != 0);
307 constexpr uint32_t idx = ePropertyPrompt;
308 return GetPropertyAtIndexAs<llvm::StringRef>(
309 idx, g_debugger_properties[idx].default_cstr_value);
313 const uint32_t idx = ePropertyPromptAnsiPrefix;
314 return GetPropertyAtIndexAs<llvm::StringRef>(
315 idx, g_debugger_properties[idx].default_cstr_value);
319 const uint32_t idx = ePropertyPromptAnsiSuffix;
320 return GetPropertyAtIndexAs<llvm::StringRef>(
321 idx, g_debugger_properties[idx].default_cstr_value);
325 constexpr uint32_t idx = ePropertyPrompt;
327 llvm::StringRef new_prompt =
GetPrompt();
336 constexpr uint32_t idx = ePropertyThreadFormat;
337 return GetPropertyAtIndexAs<const FormatEntity::Entry *>(idx);
341 constexpr uint32_t idx = ePropertyThreadStopFormat;
342 return GetPropertyAtIndexAs<const FormatEntity::Entry *>(idx);
346 const uint32_t idx = ePropertyScriptLanguage;
347 return GetPropertyAtIndexAs<lldb::ScriptLanguage>(
349 g_debugger_properties[idx].default_uint_value));
353 const uint32_t idx = ePropertyScriptLanguage;
358 const uint32_t idx = ePropertyREPLLanguage;
359 return GetPropertyAtIndexAs<LanguageType>(idx, {});
363 const uint32_t idx = ePropertyREPLLanguage;
368 const uint32_t idx = ePropertyTerminalWidth;
369 return GetPropertyAtIndexAs<uint64_t>(
370 idx, g_debugger_properties[idx].default_uint_value);
374 const uint32_t idx = ePropertyTerminalWidth;
378 handler_sp->TerminalSizeChanged();
384 const uint32_t idx = ePropertyTerminalHeight;
385 return GetPropertyAtIndexAs<uint64_t>(
386 idx, g_debugger_properties[idx].default_uint_value);
390 const uint32_t idx = ePropertyTerminalHeight;
394 handler_sp->TerminalSizeChanged();
400 const uint32_t idx = ePropertyUseExternalEditor;
401 return GetPropertyAtIndexAs<bool>(
402 idx, g_debugger_properties[idx].default_uint_value != 0);
406 const uint32_t idx = ePropertyUseExternalEditor;
411 const uint32_t idx = ePropertyExternalEditor;
412 return GetPropertyAtIndexAs<llvm::StringRef>(
413 idx, g_debugger_properties[idx].default_cstr_value);
417 const uint32_t idx = ePropertyExternalEditor;
422 const uint32_t idx = ePropertyUseColor;
423 return GetPropertyAtIndexAs<bool>(
424 idx, g_debugger_properties[idx].default_uint_value != 0);
428 const uint32_t idx = ePropertyUseColor;
435 const uint32_t idx = ePropertyShowProgress;
436 return GetPropertyAtIndexAs<bool>(
437 idx, g_debugger_properties[idx].default_uint_value != 0);
441 const uint32_t idx = ePropertyShowProgress;
446 const uint32_t idx = ePropertyShowProgressAnsiPrefix;
447 return GetPropertyAtIndexAs<llvm::StringRef>(
448 idx, g_debugger_properties[idx].default_cstr_value);
452 const uint32_t idx = ePropertyShowProgressAnsiSuffix;
453 return GetPropertyAtIndexAs<llvm::StringRef>(
454 idx, g_debugger_properties[idx].default_cstr_value);
458 const uint32_t idx = ePropertyShowAutosuggestion;
459 return GetPropertyAtIndexAs<bool>(
460 idx, g_debugger_properties[idx].default_uint_value != 0);
464 const uint32_t idx = ePropertyShowAutosuggestionAnsiPrefix;
465 return GetPropertyAtIndexAs<llvm::StringRef>(
466 idx, g_debugger_properties[idx].default_cstr_value);
470 const uint32_t idx = ePropertyShowAutosuggestionAnsiSuffix;
471 return GetPropertyAtIndexAs<llvm::StringRef>(
472 idx, g_debugger_properties[idx].default_cstr_value);
476 const uint32_t idx = ePropertyShowRegexMatchAnsiPrefix;
477 return GetPropertyAtIndexAs<llvm::StringRef>(
478 idx, g_debugger_properties[idx].default_cstr_value);
482 const uint32_t idx = ePropertyShowRegexMatchAnsiSuffix;
483 return GetPropertyAtIndexAs<llvm::StringRef>(
484 idx, g_debugger_properties[idx].default_cstr_value);
488 const uint32_t idx = ePropertyShowDontUsePoHint;
489 return GetPropertyAtIndexAs<bool>(
490 idx, g_debugger_properties[idx].default_uint_value != 0);
494 const uint32_t idx = ePropertyUseSourceCache;
495 return GetPropertyAtIndexAs<bool>(
496 idx, g_debugger_properties[idx].default_uint_value != 0);
500 const uint32_t idx = ePropertyUseSourceCache;
508 const uint32_t idx = ePropertyHighlightSource;
509 return GetPropertyAtIndexAs<bool>(
510 idx, g_debugger_properties[idx].default_uint_value != 0);
514 const uint32_t idx = ePropertyStopShowColumn;
515 return GetPropertyAtIndexAs<lldb::StopShowColumn>(
517 g_debugger_properties[idx].default_uint_value));
521 const uint32_t idx = ePropertyStopShowColumnAnsiPrefix;
522 return GetPropertyAtIndexAs<llvm::StringRef>(
523 idx, g_debugger_properties[idx].default_cstr_value);
527 const uint32_t idx = ePropertyStopShowColumnAnsiSuffix;
528 return GetPropertyAtIndexAs<llvm::StringRef>(
529 idx, g_debugger_properties[idx].default_cstr_value);
533 const uint32_t idx = ePropertyStopShowLineMarkerAnsiPrefix;
534 return GetPropertyAtIndexAs<llvm::StringRef>(
535 idx, g_debugger_properties[idx].default_cstr_value);
539 const uint32_t idx = ePropertyStopShowLineMarkerAnsiSuffix;
540 return GetPropertyAtIndexAs<llvm::StringRef>(
541 idx, g_debugger_properties[idx].default_cstr_value);
546 before ? ePropertyStopLineCountBefore : ePropertyStopLineCountAfter;
547 return GetPropertyAtIndexAs<uint64_t>(
548 idx, g_debugger_properties[idx].default_uint_value);
552 const uint32_t idx = ePropertyStopDisassemblyDisplay;
553 return GetPropertyAtIndexAs<Debugger::StopDisassemblyType>(
555 g_debugger_properties[idx].default_uint_value));
559 const uint32_t idx = ePropertyStopDisassemblyCount;
560 return GetPropertyAtIndexAs<uint64_t>(
561 idx, g_debugger_properties[idx].default_uint_value);
565 const uint32_t idx = ePropertyAutoOneLineSummaries;
566 return GetPropertyAtIndexAs<bool>(
567 idx, g_debugger_properties[idx].default_uint_value != 0);
571 const uint32_t idx = ePropertyEscapeNonPrintables;
572 return GetPropertyAtIndexAs<bool>(
573 idx, g_debugger_properties[idx].default_uint_value != 0);
577 const uint32_t idx = ePropertyAutoIndent;
578 return GetPropertyAtIndexAs<bool>(
579 idx, g_debugger_properties[idx].default_uint_value != 0);
583 const uint32_t idx = ePropertyAutoIndent;
588 const uint32_t idx = ePropertyPrintDecls;
589 return GetPropertyAtIndexAs<bool>(
590 idx, g_debugger_properties[idx].default_uint_value != 0);
594 const uint32_t idx = ePropertyPrintDecls;
599 const uint32_t idx = ePropertyTabSize;
600 return GetPropertyAtIndexAs<uint64_t>(
601 idx, g_debugger_properties[idx].default_uint_value);
605 const uint32_t idx = ePropertyTabSize;
610 const uint32_t idx = ePropertyDWIMPrintVerbosity;
611 return GetPropertyAtIndexAs<lldb::DWIMPrintVerbosity>(
613 g_debugger_properties[idx].default_uint_value != 0));
617 const uint32_t idx = ePropertyShowInlineDiagnostics;
618 return GetPropertyAtIndexAs<bool>(
619 idx, g_debugger_properties[idx].default_uint_value);
623 const uint32_t idx = ePropertyShowInlineDiagnostics;
638 "Debugger::Initialize called more than once!");
641 g_thread_pool =
new llvm::DefaultThreadPool(llvm::optimal_concurrency());
647 "Debugger::Terminate called without a matching Debugger::Initialize!");
652 debugger->HandleDestroyCallback();
677 llvm::sys::DynamicLibrary dynlib =
679 if (dynlib.isValid()) {
694 llvm::StringRef path) {
697 static constexpr llvm::StringLiteral g_dylibext(
".dylib");
698 static constexpr llvm::StringLiteral g_solibext(
".so");
705 namespace fs = llvm::sys::fs;
710 if (ft == fs::file_type::regular_file || ft == fs::file_type::symlink_file ||
711 ft == fs::file_type::type_unknown) {
721 debugger->
LoadPlugin(plugin_file_spec, plugin_load_error);
724 }
else if (ft == fs::file_type::directory_file ||
725 ft == fs::file_type::symlink_file ||
726 ft == fs::file_type::type_unknown) {
738 const bool find_directories =
true;
739 const bool find_files =
true;
740 const bool find_other =
true;
742 if (
FileSpec dir_spec = HostInfo::GetSystemPluginDir()) {
744 dir_spec.GetPath(dir_path,
sizeof(dir_path))) {
746 find_files, find_other,
751 if (
FileSpec dir_spec = HostInfo::GetUserPluginDir()) {
753 dir_spec.GetPath(dir_path,
sizeof(dir_path))) {
755 find_files, find_other,
770 debugger_sp->InstanceInitialize();
798 debugger_sp->HandleDestroyCallback();
805 (*debugger_sp->GetAsyncOutputStream())
808 (*debugger_sp->GetAsyncErrorStream()) << result.
GetErrorString() <<
'\n';
811 debugger_sp->Clear();
817 if ((*pos).get() == debugger_sp.get()) {
835 if (llvm::StringRef(debugger_sp->GetInstanceName()) == instance_name)
847 target_sp = (*pos)->GetTargetList().FindTargetWithProcessID(pid);
861 target_sp = (*pos)->GetTargetList().FindTargetWithProcess(process);
870 static constexpr llvm::StringLiteral class_name(
"lldb.debugger");
877 m_input_file_sp(std::make_shared<
NativeFile>(stdin, false)),
878 m_output_stream_sp(std::make_shared<
StreamFile>(stdout, false)),
879 m_error_stream_sp(std::make_shared<
StreamFile>(stderr, false)),
880 m_input_recorder(nullptr),
882 m_terminal_state(), m_target_list(*this), m_platform_list(),
883 m_listener_sp(
Listener::MakeListener(
"lldb.Debugger")),
884 m_source_manager_up(), m_source_file_cache(),
885 m_command_interpreter_up(
887 m_io_handler_stack(),
888 m_instance_name(
llvm::formatv(
"debugger_{0}", GetID()).str()),
889 m_loaded_plugins(), m_event_handler_thread(), m_io_handler_thread(),
890 m_sync_broadcaster(nullptr,
"lldb.debugger.sync"),
891 m_broadcaster(m_broadcaster_manager_sp,
892 GetStaticBroadcasterClass().str()),
893 m_forward_listener_sp(), m_clear_once() {
898 "target",
"Settings specify to debugging targets.",
true,
901 "platform",
"Platform settings.",
true,
904 "symbols",
"Symbol lookup and cache settings.",
true,
912 "Settings specify to the debugger's command interpreter.",
true,
917 std::make_shared<CallbackLogHandler>(log_callback, baton);
921 assert(default_platform_sp);
928 arch = HostInfo::GetArchitecture();
929 assert(arch.
IsValid() &&
"No valid default or host archspec");
930 const bool is_dummy_target =
true;
932 new Target(*
this, arch, default_platform_sp, is_dummy_target));
938 ePropertyTerminalWidth);
943 ePropertyTerminalHeight);
947 const char *term = getenv(
"TERM");
948 if (term && !strcmp(term,
"dumb"))
956 [
this](
const FileSpec &dir) -> llvm::Error {
958 llvm::StringRef log_path = entry.first();
959 llvm::StringRef file_name = llvm::sys::path::filename(log_path);
962 llvm::sys::fs::copy_file(log_path, destination.
GetPath());
964 return llvm::errorCodeToError(ec);
966 return llvm::Error::success();
970#if defined(_WIN32) && defined(ENABLE_VIRTUAL_TERMINAL_PROCESSING)
973 llvm::sys::Process::UseANSIEscapeCodes(
true);
995 if (
ProcessSP process_sp = target_sp->GetProcessSP())
996 process_sp->Finalize(
false );
997 target_sp->Destroy();
1024static inline int OpenPipe(
int fds[2], std::size_t size) {
1026 return _pipe(fds, size, O_BINARY);
1036 int fds[2] = {-1, -1};
1038 if (data ==
nullptr) {
1043 size_t size = strlen(data);
1051 "can't create pipe file descriptors for LLDB commands");
1055 int r = write(fds[
WRITE], data, size);
1059 llvm::sys::Process::SafelyCloseFileDescriptor(fds[
WRITE]);
1063 FILE *commands_file = fdopen(fds[
READ],
"rb");
1064 if (commands_file ==
nullptr) {
1066 "fdopen(%i, \"rb\") failed (errno = %i) "
1067 "when trying to open LLDB commands pipe",
1069 llvm::sys::Process::SafelyCloseFileDescriptor(fds[
READ]);
1078 assert(file_sp && file_sp->IsValid());
1086 assert(file_sp && file_sp->IsValid());
1091 assert(file_sp && file_sp->IsValid());
1104 bool adopt_selected =
true;
1113 reader_sp->Interrupt();
1120 reader_sp->GotEOF();
1142 std::lock_guard<std::recursive_mutex> guard(
1148 if (top_reader_sp && top_reader_sp->GetIsDone())
1165 while (top_reader_sp) {
1166 top_reader_sp->Run();
1169 if (top_reader_sp.get() == reader_sp.get()) {
1178 if (top_reader_sp && top_reader_sp->GetIsDone()) {
1181 if (top_reader_sp.get() == reader_sp.get())
1204 stream->Write(s, len);
1225 bool cancel_top_handler) {
1239 if (!in || !in->IsValid()) {
1241 in = top_reader_sp->GetInputFileSP();
1246 in = std::make_shared<NativeFile>(stdin,
false);
1249 if (!out || !out->GetFile().IsValid()) {
1251 out = top_reader_sp->GetOutputStreamFileSP();
1256 out = std::make_shared<StreamFile>(stdout,
false);
1259 if (!err || !err->GetFile().IsValid()) {
1261 err = top_reader_sp->GetErrorStreamFileSP();
1266 err = std::make_shared<StreamFile>(stderr,
false);
1271 bool cancel_top_handler) {
1281 if (reader_sp == top_reader_sp)
1286 reader_sp->Activate();
1290 if (top_reader_sp) {
1291 top_reader_sp->Deactivate();
1292 if (cancel_top_handler)
1293 top_reader_sp->Cancel();
1310 if (pop_reader_sp != reader_sp)
1313 reader_sp->Deactivate();
1314 reader_sp->Cancel();
1319 reader_sp->Activate();
1325 return std::make_shared<StreamAsynchronousIO>(*
this,
true,
GetUseColor());
1329 return std::make_shared<StreamAsynchronousIO>(*
this,
false,
GetUseColor());
1356 std::string function_name,
const llvm::formatv_object_base &payload)
1357 : m_function_name(std::move(function_name)),
1358 m_interrupt_time(std::chrono::system_clock::now()),
1359 m_thread_id(
llvm::get_threadid()) {
1361 desc << payload <<
"\n";
1375 if (debugger_sp->InterruptRequested())
1376 result.push_back(debugger_sp);
1395 if (index < g_debugger_list_ptr->size())
1409 if ((*pos)->GetID() ==
id) {
1425 if (format ==
nullptr) {
1428 if (format ==
nullptr) {
1430 format = &format_entry;
1433 bool function_changed =
false;
1434 bool initial_function =
false;
1440 function_changed =
true;
1444 function_changed =
true;
1454 initial_function =
true;
1457 function_changed, initial_function);
1461 llvm::StringRef backtrace,
1462 llvm::StringRef prompt) {
1464 llvm::formatv(
"{0}\n{1}{2}", message, backtrace, prompt).str());
1473 std::make_shared<CallbackLogHandler>(log_callback, baton);
1496 if (it->token == token) {
1505 std::string title, std::string details,
1506 uint64_t completed, uint64_t total,
1507 bool is_debugger_specific,
1508 uint32_t progress_broadcast_bit) {
1514 progress_broadcast_bit,
1516 completed, total, is_debugger_specific)));
1521 std::string details, uint64_t completed,
1523 std::optional<lldb::user_id_t> debugger_id,
1524 uint32_t progress_category_bit) {
1532 std::move(details), completed, total,
1534 progress_category_bit);
1545 progress_category_bit);
1550 std::string message,
1551 bool debugger_specific) {
1552 uint32_t event_type = 0;
1555 assert(
false &&
"eSeverityInfo should not be broadcast");
1572 event_data.
Dump(stream.get());
1575 EventSP event_sp = std::make_shared<Event>(
1582 std::optional<lldb::user_id_t> debugger_id,
1583 std::once_flag *once) {
1584 auto ReportDiagnosticLambda = [&]() {
1617 std::call_once(*once, ReportDiagnosticLambda);
1619 ReportDiagnosticLambda();
1623 std::optional<lldb::user_id_t> debugger_id,
1624 std::once_flag *once) {
1629 std::optional<lldb::user_id_t> debugger_id,
1630 std::once_flag *once) {
1635 std::optional<lldb::user_id_t> debugger_id,
1636 std::once_flag *once) {
1644 EventSP event_sp = std::make_shared<Event>(
1647 debugger_sp->GetBroadcaster().BroadcastEvent(event_sp);
1652static std::shared_ptr<LogHandler>
1654 size_t buffer_size) {
1655 switch (log_handler_kind) {
1657 return std::make_shared<StreamLogHandler>(fd, should_close, buffer_size);
1659 return std::make_shared<RotatingLogHandler>(buffer_size);
1661 return std::make_shared<SystemLogHandler>();
1669 llvm::ArrayRef<const char *> categories,
1670 llvm::StringRef log_file, uint32_t log_options,
1672 llvm::raw_ostream &error_stream) {
1674 std::shared_ptr<LogHandler> log_handler_sp;
1680 }
else if (log_file.empty()) {
1683 false, buffer_size);
1687 log_handler_sp = pos->second.lock();
1688 if (!log_handler_sp) {
1696 FileSpec(log_file), flags, lldb::eFilePermissionsFileDefault,
false);
1698 error_stream <<
"Unable to open log file '" << log_file
1699 <<
"': " << llvm::toString(file.takeError()) <<
"\n";
1709 assert(log_handler_sp);
1711 if (log_options == 0)
1720 std::optional<lldb::ScriptLanguage> language) {
1743 using namespace lldb;
1744 const uint32_t event_type =
1761 if (event_type & eBreakpointEventTypeLocationsAdded) {
1762 uint32_t num_new_locations =
1765 if (num_new_locations > 0) {
1770 output_sp->Printf(
"%d location%s added to breakpoint %d\n",
1771 num_new_locations, num_new_locations == 1 ?
"" :
"s",
1772 breakpoint->GetID());
1790 bool flush_stderr) {
1791 const auto &flush = [&](
Stream &stream,
1796 while ((len = (process.*get)(buffer,
sizeof(buffer),
error)) > 0)
1797 stream.
Write(buffer, len);
1810 using namespace lldb;
1811 const uint32_t event_type = event_sp->GetType();
1822 bool pop_process_io_handler =
false;
1825 bool state_is_stopped =
false;
1826 const bool got_state_changed =
1830 const bool got_structured_data =
1833 if (got_state_changed) {
1840 if (got_state_changed && !state_is_stopped) {
1845 pop_process_io_handler);
1850 got_stderr || got_state_changed);
1853 if (got_structured_data) {
1857 auto structured_data_sp =
1859 if (output_stream_sp) {
1862 plugin_sp->GetDescription(structured_data_sp, content_stream);
1863 if (
error.Success()) {
1864 if (!content_stream.
GetString().empty()) {
1867 content_stream.
Flush();
1870 output_stream_sp->PutCString(content_stream.
GetString());
1873 error_stream_sp->Format(
"Failed to print structured "
1874 "data with plugin {0}: {1}",
1875 plugin_sp->GetPluginName(),
error);
1882 if (got_state_changed && state_is_stopped) {
1885 pop_process_io_handler);
1888 output_stream_sp->Flush();
1889 error_stream_sp->Flush();
1891 if (pop_process_io_handler)
1892 process_sp->PopProcessIOHandler();
1899 using namespace lldb;
1900 const uint32_t event_type = event_sp->GetType();
1901 const bool stop_format =
true;
1932 broadcaster_class_process,
1943 process_event_spec);
1946 listener_sp->StartListeningForEvents(
1952 listener_sp->StartListeningForEvents(
1964 if (listener_sp->GetEvent(event_sp, std::nullopt)) {
1966 Broadcaster *broadcaster = event_sp->GetBroadcaster();
1968 uint32_t event_type = event_sp->GetType();
1970 if (broadcaster_class == broadcaster_class_process) {
1972 }
else if (broadcaster_class == broadcaster_class_target) {
1977 }
else if (broadcaster_class == broadcaster_class_thread) {
1983 }
else if (event_type &
1985 const char *data =
static_cast<const char *
>(
1987 if (data && data[0]) {
1990 error_sp->PutCString(data);
1995 eBroadcastBitAsynchronousOutputData) {
1996 const char *data =
static_cast<const char *
>(
1998 if (data && data[0]) {
2001 output_sp->PutCString(data);
2030 ConstString full_name(
"lldb.debugger.event-handler");
2035 llvm::StringRef thread_name =
2036 full_name.
GetLength() < llvm::get_max_thread_name_length()
2038 :
"dbg.evt-handler";
2041 llvm::Expected<HostThread> event_handler_thread =
2046 if (event_handler_thread) {
2050 "failed to launch host thread: {0}");
2059 listener_sp->GetEvent(event_sp, std::nullopt);
2085 const uint64_t
id = data->GetID();
2091 <<
static_cast<void *
>(
this) <<
" Debugger(" <<
GetID()
2092 <<
")::HandleProgressEvent( m_current_event_id = "
2094 data->Dump(&log_stream);
2095 log_stream <<
" } )";
2100 if (data->GetCompleted() == data->GetTotal())
2121 output->Printf(
"\r");
2123 if (data->GetCompleted() == data->GetTotal()) {
2125 output->Printf(
"\x1B[2K");
2131 std::string message = data->GetMessage();
2132 if (data->IsFinite())
2133 message = llvm::formatv(
"[{0}/{1}] {2}", data->GetCompleted(),
2134 data->GetTotal(), message)
2139 const uint32_t ellipsis = 3;
2140 if (message.size() + ellipsis >= term_width)
2141 message.resize(term_width - ellipsis);
2145 if (!ansi_prefix.empty())
2149 output->Printf(
"%s...", message.c_str());
2152 if (!ansi_suffix.empty())
2157 output->Printf(
"\x1B[K\r");
2169 data->Dump(stream.get());
2187 if (io_handler_thread) {
2191 "failed to launch host thread: {0}");
2219 if (!prefer_dummy) {
2237 language = *single_lang;
2238 }
else if (repl_languages.
Empty()) {
2240 "LLDB isn't configured with REPL support for any languages.");
2244 "Multiple possible REPL languages. Please specify a language.");
2260 "couldn't find a REPL for %s",
2265 repl_sp->SetCompilerOptions(repl_options);
2273 "Debugger::GetThreadPool called before Debugger::Initialize");
static llvm::raw_ostream & error(Stream &strm)
static std::recursive_mutex * g_debugger_list_mutex_ptr
static llvm::DefaultThreadPool * g_thread_pool
static constexpr OptionEnumValueElement g_show_disassembly_enum_values[]
static lldb::user_id_t g_unique_id
static constexpr OptionEnumValueElement g_language_enumerators[]
static void PrivateReportDiagnostic(Debugger &debugger, Severity severity, std::string message, bool debugger_specific)
static constexpr OptionEnumValueElement g_dwim_print_verbosities[]
static constexpr OptionEnumValueElement s_stop_show_column_values[]
static void PrivateReportProgress(Debugger &debugger, uint64_t progress_id, std::string title, std::string details, uint64_t completed, uint64_t total, bool is_debugger_specific, uint32_t progress_broadcast_bit)
static Debugger::DebuggerList * g_debugger_list_ptr
static int OpenPipe(int fds[2], std::size_t size)
static size_t g_debugger_event_thread_stack_bytes
static FileSystem::EnumerateDirectoryResult LoadPluginCallback(void *baton, llvm::sys::fs::file_type ft, llvm::StringRef path)
static std::shared_ptr< LogHandler > CreateLogHandler(LogHandlerKind log_handler_kind, int fd, bool should_close, size_t buffer_size)
#define LLDB_LOG(log,...)
The LLDB_LOG* macros defined below are the way to emit log messages.
#define LLDB_LOG_OPTION_APPEND
#define LLDB_LOG_ERROR(log, error,...)
#define LLDB_LOG_OPTION_PREPEND_TIMESTAMP
#define LLDB_LOG_OPTION_PREPEND_THREAD_NAME
A section + offset based address class.
An architecture specification class.
bool IsValid() const
Tests if this ArchSpec is valid.
static lldb::BreakpointEventType GetBreakpointEventTypeFromEvent(const lldb::EventSP &event_sp)
static lldb::BreakpointSP GetBreakpointFromEvent(const lldb::EventSP &event_sp)
static const BreakpointEventData * GetEventDataFromEvent(const Event *event_sp)
static size_t GetNumBreakpointLocationsFromEvent(const lldb::EventSP &event_sp)
An event broadcasting class.
bool EventTypeHasListeners(uint32_t event_type)
virtual llvm::StringRef GetBroadcasterClass() const
This needs to be filled in if you are going to register the broadcaster with the broadcaster manager ...
void BroadcastEvent(lldb::EventSP &event_sp)
Broadcast an event which has no associated data.
void UpdatePrompt(llvm::StringRef prompt)
@ eBroadcastBitAsynchronousOutputData
@ eBroadcastBitQuitCommandReceived
@ eBroadcastBitAsynchronousErrorData
@ eBroadcastBitResetPrompt
bool WasInterrupted() const
bool SaveTranscript(CommandReturnObject &result, std::optional< std::string > output_file=std::nullopt)
Save the current debugger session transcript to a file on disk.
bool GetSaveSessionOnQuit() const
std::string GetErrorString(bool with_diagnostics=true)
Return the errors as a string.
llvm::StringRef GetOutputString()
A uniqued constant string class.
const char * AsCString(const char *value_if_empty=nullptr) const
Get the string value as a C string.
size_t GetLength() const
Get the length in bytes of string value.
llvm::StringRef GetStringRef() const
Get the string value as a llvm::StringRef.
static void ForceUpdate()
InterruptionReport(std::string function_name, std::string description)
std::string m_description
A class to manage flag bits.
static void AssertCallback(llvm::StringRef message, llvm::StringRef backtrace, llvm::StringRef prompt)
llvm::StringRef GetAutosuggestionAnsiPrefix() const
repro::DataRecorder * GetInputRecorder()
lldb::StreamFileSP m_error_stream_sp
@ eBroadcastBitEventThreadIsListening
bool SetUseExternalEditor(bool use_external_editor_p)
PlatformList m_platform_list
HostThread m_event_handler_thread
static lldb::TargetSP FindTargetWithProcessID(lldb::pid_t pid)
uint64_t GetDisassemblyLineCount() const
lldb::TargetSP GetSelectedTarget()
uint64_t GetTerminalHeight() const
bool SetExternalEditor(llvm::StringRef editor)
void RequestInterrupt()
Interruption in LLDB:
void ReportInterruption(const InterruptionReport &report)
ExecutionContext GetSelectedExecutionContext()
void HandleProgressEvent(const lldb::EventSP &event_sp)
SourceManager & GetSourceManager()
bool SetShowProgress(bool show_progress)
lldb::StreamSP GetAsyncOutputStream()
bool StartEventHandlerThread()
Manually start the global event handler thread.
bool SetUseSourceCache(bool use_source_cache)
void StopEventHandlerThread()
Manually stop the debugger's default event handler.
static void ReportInfo(std::string message, std::optional< lldb::user_id_t > debugger_id=std::nullopt, std::once_flag *once=nullptr)
Report info events.
void SetAsyncExecution(bool async)
HostThread SetIOHandlerThread(HostThread &new_thread)
void CancelForwardEvents(const lldb::ListenerSP &listener_sp)
bool GetPrintDecls() const
lldb::FileSP GetInputFileSP()
void StopIOHandlerThread()
bool GetHighlightSource() const
llvm::StringMap< std::weak_ptr< LogHandler > > m_stream_handlers
CommandInterpreter & GetCommandInterpreter()
void SaveInputTerminalState()
LoadedPluginsList m_loaded_plugins
bool GetShowInlineDiagnostics() const
void InstanceInitialize()
bool SetTabSize(uint64_t tab_size)
void HandleDiagnosticEvent(const lldb::EventSP &event_sp)
bool StartIOHandlerThread()
static lldb::DebuggerSP GetDebuggerAtIndex(size_t index)
llvm::StringRef GetAutosuggestionAnsiSuffix() const
StreamFile & GetErrorStream()
lldb::ListenerSP m_listener_sp
void PushIOHandler(const lldb::IOHandlerSP &reader_sp, bool cancel_top_handler=true)
std::mutex m_destroy_callback_mutex
lldb::callback_token_t AddDestroyCallback(lldb_private::DebuggerDestroyCallback destroy_callback, void *baton)
Add a callback for when the debugger is destroyed.
lldb::thread_result_t IOHandlerThread()
static lldb::TargetSP FindTargetWithProcess(Process *process)
bool GetUseExternalEditor() const
TerminalState m_terminal_state
const FormatEntity::Entry * GetThreadStopFormat() const
bool InterruptRequested()
bool GetEscapeNonPrintables() const
lldb::TargetSP m_dummy_target_sp
llvm::SmallVector< DestroyCallbackInfo, 2 > m_destroy_callbacks
std::unique_ptr< CommandInterpreter > m_command_interpreter_up
static void ReportWarning(std::string message, std::optional< lldb::user_id_t > debugger_id=std::nullopt, std::once_flag *once=nullptr)
Report warning events.
static bool FormatDisassemblerAddress(const FormatEntity::Entry *format, const SymbolContext *sc, const SymbolContext *prev_sc, const ExecutionContext *exe_ctx, const Address *addr, Stream &s)
static void SettingsInitialize()
static llvm::ThreadPoolInterface & GetThreadPool()
Shared thread pool. Use only with ThreadPoolTaskGroup.
llvm::StringRef GetShowProgressAnsiSuffix() const
bool IsTopIOHandler(const lldb::IOHandlerSP &reader_sp)
bool HasIOHandlerThread() const
void DispatchInputEndOfFile()
bool IsIOHandlerThreadCurrentThread() const
lldb::ListenerSP m_forward_listener_sp
std::array< lldb::ScriptInterpreterSP, lldb::eScriptLanguageUnknown > m_script_interpreters
std::shared_ptr< CallbackLogHandler > m_callback_handler_sp
void SetDestroyCallback(lldb_private::DebuggerDestroyCallback destroy_callback, void *baton)
DEPRECATED: We used to only support one Destroy callback.
StopDisassemblyType GetStopDisassemblyDisplay() const
Broadcaster m_broadcaster
Public Debugger event broadcaster.
void DispatchInputInterrupt()
static void Initialize(LoadPluginCallbackType load_plugin_callback)
static lldb::DebuggerSP FindDebuggerWithInstanceName(llvm::StringRef instance_name)
uint64_t GetTerminalWidth() const
std::mutex m_interrupt_mutex
std::recursive_mutex m_io_handler_synchronous_mutex
bool RemoveIOHandler(const lldb::IOHandlerSP &reader_sp)
Remove the given IO handler if it's currently active.
Diagnostics::CallbackID m_diagnostics_callback_id
bool GetAutoOneLineSummaries() const
const char * GetIOHandlerCommandPrefix()
lldb::BroadcasterManagerSP m_broadcaster_manager_sp
Status RunREPL(lldb::LanguageType language, const char *repl_options)
bool PopIOHandler(const lldb::IOHandlerSP &reader_sp)
bool RemoveDestroyCallback(lldb::callback_token_t token)
Remove the specified callback. Return true if successful.
static LoadPluginCallbackType g_load_plugin_callback
std::recursive_mutex m_script_interpreter_mutex
void RunIOHandlerAsync(const lldb::IOHandlerSP &reader_sp, bool cancel_top_handler=true)
Run the given IO handler and return immediately.
void SetInputFile(lldb::FileSP file)
lldb::StreamFileSP GetErrorStreamSP()
void SetPrompt(llvm::StringRef p)
lldb::StreamSP GetAsyncErrorStream()
bool EnableLog(llvm::StringRef channel, llvm::ArrayRef< const char * > categories, llvm::StringRef log_file, uint32_t log_options, size_t buffer_size, LogHandlerKind log_handler_kind, llvm::raw_ostream &error_stream)
uint64_t GetStopDisassemblyMaxSize() const
bool SetTerminalHeight(uint64_t term_height)
Broadcaster m_sync_broadcaster
Private debugger synchronization.
void RestoreInputTerminalState()
bool GetUseSourceCache() const
HostThread m_io_handler_thread
llvm::StringRef GetRegexMatchAnsiSuffix() const
static llvm::StringRef GetStaticBroadcasterClass()
lldb::FileSP m_input_file_sp
bool SetREPLLanguage(lldb::LanguageType repl_lang)
const FormatEntity::Entry * GetDisassemblyFormat() const
bool GetAutoIndent() const
llvm::StringRef GetStopShowColumnAnsiSuffix() const
@ eStopDisassemblyTypeNever
@ eStopDisassemblyTypeNoDebugInfo
@ eStopDisassemblyTypeNoSource
@ eStopDisassemblyTypeAlways
Status SetPropertyValue(const ExecutionContext *exe_ctx, VarSetOperationType op, llvm::StringRef property_path, llvm::StringRef value) override
llvm::StringRef GetPromptAnsiSuffix() const
void SetErrorFile(lldb::FileSP file)
bool GetAutoConfirm() const
lldb::ScriptLanguage GetScriptLanguage() const
lldb::callback_token_t m_destroy_callback_next_token
std::unique_ptr< SourceManager > m_source_manager_up
static lldb::DebuggerSP CreateInstance(lldb::LogOutputCallback log_callback=nullptr, void *baton=nullptr)
lldb::StopShowColumn GetStopShowColumn() const
static void ReportSymbolChange(const ModuleSpec &module_spec)
static void ReportError(std::string message, std::optional< lldb::user_id_t > debugger_id=std::nullopt, std::once_flag *once=nullptr)
Report error events.
bool SetPrintDecls(bool b)
bool SetScriptLanguage(lldb::ScriptLanguage script_lang)
bool SetShowInlineDiagnostics(bool)
bool LoadPlugin(const FileSpec &spec, Status &error)
void SetOutputFile(lldb::FileSP file)
uint64_t GetStopSourceLineCount(bool before) const
void EnableForwardEvents(const lldb::ListenerSP &listener_sp)
static lldb::DebuggerSP FindDebuggerWithID(lldb::user_id_t id)
void HandleBreakpointEvent(const lldb::EventSP &event_sp)
void JoinIOHandlerThread()
bool CheckTopIOHandlerTypes(IOHandler::Type top_type, IOHandler::Type second_top_type)
Target & GetDummyTarget()
const FormatEntity::Entry * GetFrameFormat() const
lldb::ListenerSP GetListener()
static void Destroy(lldb::DebuggerSP &debugger_sp)
SourceManager::SourceFileCache m_source_file_cache
llvm::StringRef GetPromptAnsiPrefix() const
std::optional< uint64_t > m_current_event_id
void RunIOHandlerSync(const lldb::IOHandlerSP &reader_sp)
Run the given IO handler and block until it's complete.
const FormatEntity::Entry * GetThreadFormat() const
Broadcaster & GetBroadcaster()
Get the public broadcaster for this debugger.
llvm::StringRef GetStopShowLineMarkerAnsiPrefix() const
bool GetShowDontUsePoHint() const
uint64_t GetTabSize() const
lldb::StreamFileSP m_output_stream_sp
bool GetShowProgress() const
llvm::StringRef GetRegexMatchAnsiPrefix() const
void HandleDestroyCallback()
std::mutex m_output_flush_mutex
llvm::StringRef GetStopShowLineMarkerAnsiSuffix() const
bool SetUseColor(bool use_color)
const char * GetIOHandlerHelpPrologue()
Status SetInputString(const char *data)
bool GetUseAutosuggestion() const
Target & GetSelectedOrDummyTarget(bool prefer_dummy=false)
void HandleProcessEvent(const lldb::EventSP &event_sp)
IOHandlerStack m_io_handler_stack
repro::DataRecorder * m_input_recorder
Used for shadowing the input file when capturing a reproducer.
lldb::StreamFileSP GetOutputStreamSP()
llvm::once_flag m_clear_once
void AdoptTopIOHandlerFilesIfInvalid(lldb::FileSP &in, lldb::StreamFileSP &out, lldb::StreamFileSP &err)
static void SettingsTerminate()
static void ReportProgress(uint64_t progress_id, std::string title, std::string details, uint64_t completed, uint64_t total, std::optional< lldb::user_id_t > debugger_id, uint32_t progress_category_bit=lldb::eBroadcastBitProgress)
Report progress events.
lldb::LanguageType GetREPLLanguage() const
ScriptInterpreter * GetScriptInterpreter(bool can_create=true, std::optional< lldb::ScriptLanguage > language={})
void SetLoggingCallback(lldb::LogOutputCallback log_callback, void *baton)
bool SetTerminalWidth(uint64_t term_width)
Debugger(lldb::LogOutputCallback m_log_callback, void *baton)
llvm::StringRef GetExternalEditor() const
void HandleThreadEvent(const lldb::EventSP &event_sp)
static size_t GetNumDebuggers()
uint32_t m_interrupt_requested
Tracks interrupt requests.
lldb::DWIMPrintVerbosity GetDWIMPrintVerbosity() const
lldb::thread_result_t DefaultEventHandler()
void PrintAsync(const char *s, size_t len, bool is_stdout)
bool IsForwardingEvents()
llvm::StringRef GetPrompt() const
bool GetNotifyVoid() const
llvm::StringRef GetShowProgressAnsiPrefix() const
const FormatEntity::Entry * GetFrameFormatUnique() const
llvm::StringRef GetTopIOHandlerControlSequence(char ch)
void FlushProcessOutput(Process &process, bool flush_stdout, bool flush_stderr)
Force flushing the process's pending stdout and stderr to the debugger's asynchronous stdout and stde...
void CancelInterruptRequest()
Decrement the "interrupt requested" counter.
static void ReportDiagnosticImpl(lldb::Severity severity, std::string message, std::optional< lldb::user_id_t > debugger_id, std::once_flag *once)
std::vector< lldb::DebuggerSP > DebuggerList
bool SetAutoIndent(bool b)
llvm::StringRef GetStopShowColumnAnsiPrefix() const
static DebuggerList DebuggersRequestingInterruption()
void Dump(Stream *s) const override
static const DiagnosticEventData * GetEventDataFromEvent(const Event *event_ptr)
CallbackID AddCallback(Callback callback)
void Report(llvm::StringRef message)
void RemoveCallback(CallbackID id)
static Diagnostics & Instance()
static const void * GetBytesFromEvent(const Event *event_ptr)
static lldb::ProcessSP GetProcessFromEvent(const Event *event_ptr)
static lldb::StructuredDataPluginSP GetPluginFromEvent(const Event *event_ptr)
static StructuredData::ObjectSP GetObjectFromEvent(const Event *event_ptr)
Execution context objects refer to objects in the execution of the program that is being debugged.
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
const lldb::TargetSP & GetTargetSP() const
Get accessor to get the target shared pointer.
bool HasTargetScope() const
Returns true the ExecutionContext object contains a valid target.
Target & GetTargetRef() const
Returns a reference to the target object.
FileSpec CopyByAppendingPathComponent(llvm::StringRef component) const
size_t GetPath(char *path, size_t max_path_length, bool denormalize=true) const
Extract the full path to the file.
llvm::StringRef GetFileNameExtension() const
Extract the extension of the file.
void Resolve(llvm::SmallVectorImpl< char > &path)
Resolve path to make it canonical.
void EnumerateDirectory(llvm::Twine path, bool find_directories, bool find_files, bool find_other, EnumerateDirectoryCallbackType callback, void *callback_baton)
@ eEnumerateDirectoryResultEnter
Recurse into the current entry if it is a directory or symlink, or next if not.
@ eEnumerateDirectoryResultNext
Enumerate next entry in the current directory.
@ eEnumerateDirectoryResultQuit
Stop directory enumerations at any level.
int Open(const char *path, int flags, int mode=0600)
Wraps ::open in a platform-independent way.
static FileSystem & Instance()
An abstract base class for files.
static int kInvalidDescriptor
virtual int GetDescriptor() const
Get underlying OS file descriptor for this file, or kInvalidDescriptor.
bool GetIsTerminalWithColors()
Return true if this file is a terminal which supports colors.
Status Close() override
Flush any buffers and release any resources owned by the file.
bool GetIsInteractive()
Return true if this file is interactive.
const Mangled & GetMangled() const
Status Join(lldb::thread_result_t *result)
bool EqualsThread(lldb::thread_t thread) const
static void SystemLog(lldb::Severity severity, llvm::StringRef message)
Emit the given message to the operating system log.
static lldb::thread_t GetCurrentThread()
Get the thread token (the one returned by ThreadCreate when the thread was created) for the calling t...
const char * GetTopIOHandlerHelpPrologue()
bool PrintAsync(const char *s, size_t len, bool is_stdout)
llvm::StringRef GetTopIOHandlerControlSequence(char ch)
bool IsTop(const lldb::IOHandlerSP &io_handler_sp) const
void Push(const lldb::IOHandlerSP &sp)
std::recursive_mutex & GetMutex()
bool CheckTopIOHandlerTypes(IOHandler::Type top_type, IOHandler::Type second_top_type)
const char * GetTopIOHandlerCommandPrefix()
static llvm::StringRef GetSettingName()
static LanguageSet GetLanguagesSupportingREPLs()
static const char * GetNameForLanguageType(lldb::LanguageType language)
static LanguageProperties & GetGlobalLanguageProperties()
static lldb::ListenerSP MakeListener(const char *name)
static bool EnableLogChannel(const std::shared_ptr< LogHandler > &log_handler_sp, uint32_t log_options, llvm::StringRef channel, llvm::ArrayRef< const char * > categories, llvm::raw_ostream &error_stream)
void PutString(llvm::StringRef str)
static ModuleListProperties & GetGlobalModuleListProperties()
void SetMinimumValue(int64_t v)
static lldb::ScriptInterpreterSP GetScriptInterpreterForLanguage(lldb::ScriptLanguage script_lang, Debugger &debugger)
static void DebuggerInitialize(Debugger &debugger)
static lldb::ProcessSP GetProcessFromEvent(const Event *event_ptr)
static lldb::StateType GetStateFromEvent(const Event *event_ptr)
A plug-in interface definition class for debugging a process.
@ eBroadcastBitStructuredData
@ eBroadcastBitStateChanged
static bool HandleProcessStateChangedEvent(const lldb::EventSP &event_sp, Stream *stream, SelectMostRelevant select_most_relevant, bool &pop_process_io_handler)
Centralize the code that handles and prints descriptions for process state changes.
static llvm::StringRef GetStaticBroadcasterClass()
virtual size_t GetSTDERR(char *buf, size_t buf_size, Status &error)
Get any available STDERR.
virtual size_t GetSTDOUT(char *buf, size_t buf_size, Status &error)
Get any available STDOUT.
static const ProgressEventData * GetEventDataFromEvent(const Event *event_ptr)
lldb::OptionValuePropertiesSP m_collection_sp
virtual Status SetPropertyValue(const ExecutionContext *exe_ctx, VarSetOperationType op, llvm::StringRef property_path, llvm::StringRef value)
bool SetPropertyAtIndex(uint32_t idx, T t, const ExecutionContext *exe_ctx=nullptr) const
virtual lldb::OptionValuePropertiesSP GetValueProperties() const
static lldb::REPLSP Create(Status &Status, lldb::LanguageType language, Debugger *debugger, Target *target, const char *repl_options)
Get a REPL with an existing target (or, failing that, a debugger to use), and (optional) extra argume...
static Status FromErrorStringWithFormat(const char *format,...) __attribute__((format(printf
static Status FromErrorString(const char *str)
bool Success() const
Test for success condition.
void Flush() override
Flush the stream.
llvm::StringRef GetString() const
A stream class that can stream formatted output to a file.
size_t Write(const void *src, size_t src_len)
Output character bytes to the stream.
llvm::raw_ostream & AsRawOstream()
Returns a raw_ostream that forwards the data to this Stream object.
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
size_t PutCString(llvm::StringRef cstr)
Output a C string to the stream.
virtual void Flush()=0
Flush the stream.
Defines a symbol context baton that can be handed other debug core functions.
Function * function
The Function for a given query.
Symbol * symbol
The Symbol for a given query.
bool Compare(ConstString name, lldb::SymbolType type) const
ConstString GetName() const
lldb::SymbolType GetType() const
lldb::TargetSP GetSelectedTarget()
static void SettingsTerminate()
static llvm::StringRef GetStaticBroadcasterClass()
@ eBroadcastBitBreakpointChanged
static TargetProperties & GetGlobalProperties()
static ArchSpec GetDefaultArchitecture()
static void SettingsInitialize()
bool Save(Terminal term, bool save_process_group)
Save the TTY state for fd.
bool Restore() const
Restore the TTY state to the cached state.
static llvm::Expected< HostThread > LaunchThread(llvm::StringRef name, std::function< lldb::thread_result_t()> thread_function, size_t min_stack_byte_size=0)
static lldb::ThreadSP GetThreadFromEvent(const Event *event_ptr)
@ eBroadcastBitThreadSelected
@ eBroadcastBitStackChanged
static llvm::StringRef GetStaticBroadcasterClass()
@ SelectMostRelevantFrame
#define LLDB_INVALID_HOST_THREAD
std::string FormatAnsiTerminalCodes(llvm::StringRef format, bool do_color=true)
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.
@ eLoadScriptFromSymFileTrue
@ eLoadScriptFromSymFileFalse
@ eLoadScriptFromSymFileWarn
void(* DebuggerDestroyCallback)(lldb::user_id_t debugger_id, void *baton)
bool StateIsStoppedState(lldb::StateType state, bool must_exist)
Check if a state represents a state where the process or thread is stopped.
llvm::sys::DynamicLibrary(* LoadPluginCallbackType)(const lldb::DebuggerSP &debugger_sp, const FileSpec &spec, Status &error)
VarSetOperationType
Settable state variable types.
ScriptLanguage
Script interpreter types.
Severity
Used for expressing severity in logs and diagnostics.
std::shared_ptr< lldb_private::IOHandler > IOHandlerSP
std::shared_ptr< lldb_private::Thread > ThreadSP
std::shared_ptr< lldb_private::Platform > PlatformSP
DWIMPrintVerbosity
Enum to control the verbosity level of dwim-print execution.
@ eDWIMPrintVerbosityFull
Always print a message indicating how dwim-print is evaluating its expression.
@ eDWIMPrintVerbosityNone
Run dwim-print with no verbosity.
@ eDWIMPrintVerbosityExpression
Print a message when dwim-print uses expression evaluation.
StateType
Process and Thread States.
LanguageType
Programming language type.
@ eLanguageTypeUnknown
Unknown or invalid language value.
std::shared_ptr< lldb_private::Stream > StreamSP
std::shared_ptr< lldb_private::Breakpoint > BreakpointSP
std::shared_ptr< lldb_private::StructuredDataPlugin > StructuredDataPluginSP
std::shared_ptr< lldb_private::Process > ProcessSP
std::shared_ptr< lldb_private::Debugger > DebuggerSP
@ eStopShowColumnAnsiOrCaret
std::shared_ptr< lldb_private::Event > EventSP
std::shared_ptr< lldb_private::Listener > ListenerSP
std::shared_ptr< lldb_private::StreamFile > StreamFileSP
void(* LogOutputCallback)(const char *, void *baton)
std::shared_ptr< lldb_private::Target > TargetSP
std::shared_ptr< lldb_private::File > FileSP
std::shared_ptr< lldb_private::REPL > REPLSP
lldb_private::DebuggerDestroyCallback callback
A SmallBitVector that represents a set of source languages (lldb::LanguageType).
std::optional< lldb::LanguageType > GetSingularLanguage()
If the set contains a single language only, return it.
A mix in class that contains a generic user ID.
lldb::user_id_t GetID() const
Get accessor for the user ID.