46#include "lldb/Host/Config.h"
60#include "llvm/ADT/STLExtras.h"
61#include "llvm/ADT/StringRef.h"
62#include "llvm/Config/llvm-config.h"
63#include "llvm/Support/DynamicLibrary.h"
64#include "llvm/Support/ManagedStatic.h"
65#include "llvm/Support/PrettyStackTrace.h"
66#include "llvm/Support/Signals.h"
127 uint64_t &progress_id,
130 bool &is_debugger_specific) {
135 if (progress_data ==
nullptr)
137 progress_id = progress_data->
GetID();
156 data.m_impl_up->SetObjectSP(std::move(dictionary_sp));
171 data.m_impl_up->SetObjectSP(std::move(dictionary_sp));
200 std::make_unique<SystemInitializerFull>(options.
ref()))) {
209 llvm::EnablePrettyStackTrace();
210 static std::string executable =
211 llvm::sys::fs::getMainExecutable(
nullptr,
nullptr);
212 llvm::sys::PrintStackTraceOnErrorSignal(executable);
265 static std::recursive_mutex g_mutex;
266 std::lock_guard<std::recursive_mutex> guard(g_mutex);
271 if (source_init_files) {
301 const bool mandatory =
false;
308 return this->
operator bool();
310SBDebugger::operator
bool()
const {
333 m_opaque_sp->GetCommandInterpreter().SkipLLDBInitFiles(b);
340 m_opaque_sp->GetCommandInterpreter().SkipAppInitFiles(b);
353 if (
data ==
nullptr) {
358 size_t size = strlen(
data);
458 m_opaque_sp->GetCommandInterpreter().GetExecutionContext());
459 if (setting && strlen(setting) > 0)
460 m_opaque_sp->DumpPropertyValue(&exe_ctx, json_strm, setting,
464 m_opaque_sp->DumpAllPropertyValues(&exe_ctx, json_strm, 0,
491 return m_opaque_sp->GetOutputFileSP()->GetStream();
538 return sb_interpreter;
546 m_opaque_sp->GetCommandInterpreter().GetSelectedTarget());
548 std::unique_lock<TargetAPIMutex> guard;
551 guard = std::unique_lock<TargetAPIMutex>(api_lock);
568 while (lldb_listener_sp->GetEventForBroadcaster(
569 process_sp.get(), event_sp, std::chrono::seconds(0))) {
597 const SBEvent &event, FILE *out,
621 const uint32_t event_type =
event.GetType();
622 char stdio_buffer[1024];
625 TargetAPIMutex api_lock = target_sp->GetAPIMutex();
626 std::lock_guard<TargetAPIMutex> guard(api_lock);
631 while ((len = process.
GetSTDOUT(stdio_buffer,
sizeof(stdio_buffer))) > 0)
633 out_sp->Write(stdio_buffer, len);
639 while ((len = process.
GetSTDERR(stdio_buffer,
sizeof(stdio_buffer))) > 0)
641 err_sp->Write(stdio_buffer, len);
660 return sb_source_manager;
666 if (arch_name && arch_name_len) {
670 const std::string &triple_str = default_arch.
GetTriple().str();
671 if (!triple_str.empty())
672 ::snprintf(arch_name, arch_name_len,
"%s", triple_str.c_str());
674 ::snprintf(arch_name, arch_name_len,
"%s",
679 if (arch_name && arch_name_len)
701 if (!script_language_name)
759 const char *target_triple,
760 const char *platform_name,
761 bool add_dependent_modules,
764 add_dependent_modules, sb_error);
776 &platform_options, target_sp);
779 sb_target.
SetSP(target_sp);
786 "SBDebugger(%p)::CreateTarget (filename=\"%s\", triple=%s, "
787 "platform_name=%s, add_dependent_modules=%u, error=%s) => "
789 static_cast<void *
>(
m_opaque_sp.get()), filename, target_triple,
790 platform_name, add_dependent_modules, sb_error.
GetCString(),
791 static_cast<void *
>(target_sp.get()));
798 const char *target_triple) {
804 const bool add_dependent_modules =
true;
809 sb_target.
SetSP(target_sp);
814 "SBDebugger(%p)::CreateTargetWithFileAndTargetTriple "
815 "(filename=\"%s\", triple=%s) => SBTarget(%p)",
816 static_cast<void *
>(
m_opaque_sp.get()), filename, target_triple,
817 static_cast<void *
>(target_sp.get()));
823 const char *arch_cstr) {
832 if (arch_cstr ==
nullptr) {
841 m_opaque_sp->GetPlatformList().GetSelectedPlatform();
853 sb_target.
SetSP(target_sp);
857 "SBDebugger(%p)::CreateTargetWithFileAndArch (filename=\"%s\", "
858 "arch=%s) => SBTarget(%p)",
860 filename ? filename :
"<unspecified>",
861 arch_cstr ? arch_cstr :
"<unspecified>",
862 static_cast<void *
>(target_sp.get()));
874 const bool add_dependent_modules =
true;
881 sb_target.
SetSP(target_sp);
885 "SBDebugger(%p)::CreateTarget (filename=\"%s\") => SBTarget(%p)",
887 static_cast<void *
>(target_sp.get()));
899 LLDB_LOGF(log,
"SBDebugger(%p)::GetDummyTarget() => SBTarget(%p)",
901 static_cast<void *
>(sb_target.
GetSP().get()));
912 "Could not send telemetry from SBDebugger - debugger was null.");
924 result =
m_opaque_sp->GetTargetList().DeleteTarget(target_sp);
925 target_sp->Destroy();
931 LLDB_LOGF(log,
"SBDebugger(%p)::DeleteTarget (SBTarget(%p)) => %i",
933 static_cast<void *
>(target.
m_opaque_sp.get()), result);
968 m_opaque_sp->GetTargetList().FindTargetByGloballyUniqueID(
id));
985 const char *arch_name) {
992 m_opaque_sp->GetPlatformList().GetSelectedPlatform().get(), arch_name);
994 m_opaque_sp->GetTargetList().FindTargetWithExecutableAndArchitecture(
995 FileSpec(filename), arch_name ? &arch :
nullptr));
996 sb_target.
SetSP(target_sp);
1006 m_opaque_sp->GetTargetList().FindTargetWithProcess(process_sp.get()));
1016 return m_opaque_sp->GetTargetList().GetNumTargets();
1030 target_sp =
m_opaque_sp->GetTargetList().GetSelectedTarget();
1031 sb_target.
SetSP(target_sp);
1037 LLDB_LOGF(log,
"SBDebugger(%p)::GetSelectedTarget () => SBTarget(%p): %s",
1039 static_cast<void *
>(target_sp.get()), sstr.
GetData());
1052 m_opaque_sp->GetTargetList().SetSelectedTarget(target_sp);
1057 LLDB_LOGF(log,
"SBDebugger(%p)::SetSelectedTarget () => SBTarget(%p): %s",
1059 static_cast<void *
>(target_sp.get()), sstr.
GetData());
1071 sb_platform.
SetSP(debugger_sp->GetPlatformList().GetSelectedPlatform());
1073 LLDB_LOGF(log,
"SBDebugger(%p)::GetSelectedPlatform () => SBPlatform(%p): %s",
1075 static_cast<void *
>(sb_platform.
GetSP().get()),
1087 debugger_sp->GetPlatformList().SetSelectedPlatform(sb_platform.
GetSP());
1090 LLDB_LOGF(log,
"SBDebugger(%p)::SetSelectedPlatform (SBPlatform(%p) %s)",
1092 static_cast<void *
>(sb_platform.
GetSP().get()),
1135 auto platform_dict = std::make_unique<StructuredData::Dictionary>();
1136 llvm::StringRef name_str(
"name"), desc_str(
"description");
1140 platform_dict->AddStringItem(name_str, host_platform_sp->GetPluginName());
1141 platform_dict->AddStringItem(
1142 desc_str, llvm::StringRef(host_platform_sp->GetDescription()));
1143 }
else if (idx > 0) {
1144 llvm::StringRef plugin_name =
1146 if (plugin_name.empty()) {
1149 platform_dict->AddStringItem(name_str, llvm::StringRef(plugin_name));
1151 llvm::StringRef plugin_desc =
1153 platform_dict->AddStringItem(desc_str, llvm::StringRef(plugin_desc));
1156 data.m_impl_up->SetObjectSP(
1203 bool spawn_thread) {
1210 m_opaque_sp->GetCommandInterpreter().RunCommandInterpreter(options);
1217 int &num_errors,
bool &quit_requested,
1218 bool &stopped_for_crash)
1222 num_errors, quit_requested, stopped_for_crash);
1253 const char *repl_options) {
1284 sb_debugger.
reset(debugger_sp);
1294 return m_opaque_sp->GetStringPool().InternNonEmpty(
1299 const char *debugger_instance_name) {
1308 debugger_sp->GetCommandInterpreter().GetExecutionContext());
1313 if (
error.Success())
1314 if (std::optional<std::string>
warning =
1315 debugger_sp->GetDeprecationWarning(var_name))
1319 "invalid debugger instance name '%s'", debugger_instance_name);
1328 const char *debugger_instance_name) {
1336 debugger_sp->GetCommandInterpreter().GetExecutionContext());
1338 debugger_sp->GetPropertyValue(&exe_ctx, var_name,
error));
1342 value_sp->DumpValue(&exe_ctx, value_strm,
1345 const std::string &value_str = std::string(value_strm.
GetString());
1346 if (!value_str.empty()) {
1362void SBDebugger::SetTerminalWidth(uint32_t term_width) {
1375void SBDebugger::SetTerminalHeight(uint32_t term_height) {
1383 uint32_t term_height) {
1387 m_opaque_sp->SetTerminalDimensions(term_width, term_height);
1395 LLDB_LOG(log,
"SBDebugger({0:x})::GetPrompt () => \"{1}\"",
1414 return "GetReproducerPath has been deprecated";
1493 const char *name =
m_opaque_sp->GetInstanceName().c_str();
1495 strm.
Printf(
"Debugger (instance: \"%s\", id: %" PRIu64
")", name,
id);
1513 if (platform_name_cstr && platform_name_cstr[0]) {
1532 platform.SetSDKRoot(sysroot);
1551 if (!category_name || *category_name == 0)
1557 category_sp,
false)) {
1578 if (!category_name || *category_name == 0)
1584 category_sp,
true)) {
1594 if (!category_name || *category_name == 0)
1660 if (categories ==
nullptr)
1663 while (categories[len] !=
nullptr)
1665 return llvm::ArrayRef(categories, len);
1672 uint32_t log_options =
1677 bool succeeded = !
bool(err);
1678 llvm::consumeError(std::move(err));
1689 return m_opaque_sp->SetLoggingCallback(log_callback, baton);
1693void SBDebugger::SetDestroyCallback(
1698 destroy_callback, baton);
1708 return m_opaque_sp->AddDestroyCallback(destroy_callback, baton);
static llvm::raw_ostream & error(Stream &strm)
static llvm::raw_ostream & warning(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.
#define LLDB_LOGF(log,...)
#define LLDB_LOG_OPTION_PREPEND_TIMESTAMP
#define LLDB_LOG_OPTION_PREPEND_THREAD_NAME
static llvm::ArrayRef< const char * > GetCategoryArray(const char **categories)
static void DumpDiagnostics(void *cookie)
static llvm::ManagedStatic< SystemLifetimeManager > g_debugger_lifetime
void SetAutoHandleEvents(bool)
void SetSpawnThread(bool)
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)
size_t PutOutput(SBFile file)
size_t PutError(SBFile file)
static lldb::SBError SetInternalVariable(const char *var_name, const char *value, const char *debugger_instance_name)
Set an internal variable.
bool DeleteCategory(const char *category_name)
Delete a type category.
lldb::LanguageType GetREPLLanguage() const
Get the current REPL language.
lldb::SBTarget GetTargetAtIndex(uint32_t idx)
Get a target by index.
lldb::SBTarget CreateTarget(const char *filename, const char *target_triple, const char *platform_name, bool add_dependent_modules, lldb::SBError &error)
Create a target with the specified parameters.
SBTypeFilter GetFilterForType(SBTypeNameSpecifier type_name_spec)
Get the filter for a type.
SBError RunREPL(lldb::LanguageType language, const char *repl_options)
Run a REPL (Read-Eval-Print Loop) for the specified language.
bool DeleteTarget(lldb::SBTarget &target)
Delete a target from the debugger.
void SkipAppInitFiles(bool b)
Set whether to skip loading application-specific .lldbinit files.
lldb::SBDebugger & operator=(const lldb::SBDebugger &rhs)
Assignment operator.
static void Terminate()
Terminate LLDB and its subsystems.
lldb::SBPlatform GetPlatformAtIndex(uint32_t idx)
Get one of the currently active platforms.
void SkipLLDBInitFiles(bool b)
Set whether to skip loading .lldbinit files.
void SetAsync(bool b)
Set whether the debugger should run in asynchronous mode.
bool SetUseExternalEditor(bool input)
Set whether to use an external editor.
bool GetCloseInputOnEOF() const
Get whether to close input on EOF (deprecated).
static bool GetDefaultArchitecture(char *arch_name, size_t arch_name_len)
Get the default architecture.
static void MemoryPressureDetected()
Notify the debugger that system memory pressure has been detected.
void SetPrompt(const char *prompt)
Set the command prompt string.
bool GetDescription(lldb::SBStream &description)
Get a description of this debugger.
void DispatchInput(const void *data, size_t data_len)
Dispatch input to the debugger.
friend class SBStructuredData
bool GetUseExternalEditor()
Get whether an external editor is being used.
static void PrintStackTraceOnError()
Configure LLDB to print a stack trace when it crashes.
static lldb::SBDebugger Create()
Create a new debugger instance (deprecated).
void SetInputFileHandle(FILE *f, bool transfer_ownership)
Set the input file handle for the debugger.
void RunCommandInterpreter(bool auto_handle_events, bool spawn_thread)
Run the command interpreter.
static const char * GetVersionString()
Get the LLDB version string.
lldb_private::Debugger & ref() const
lldb::SBStructuredData GetSetting(const char *setting=nullptr)
Get debugger settings as structured data.
const void size_t data_len
const char * GetReproducerPath() const
Get the path to the reproducer.
void SetOutputFileHandle(FILE *f, bool transfer_ownership)
Set the output file handle for the debugger.
static lldb::SBError InitializeWithErrorHandling()
Initialize the LLDB debugger subsystem with error handling.
SBTypeSummary GetSummaryForType(SBTypeNameSpecifier type_name_spec)
Get the summary for a type.
void HandleCommand(const char *command)
Execute a command in the command interpreter.
lldb::SBCommandInterpreter GetCommandInterpreter()
Get the command interpreter for this debugger.
SBFile GetInputFile()
Get the input file for the debugger.
const char * GetPrompt() const
Get the command prompt string.
void SetTerminalDimensions(uint32_t term_width, uint32_t term_height)
Set the terminal width and height together.
friend class SBInputReader
bool SetUseColor(bool use_color)
Set whether to use color in output.
bool GetAsync()
Get whether the debugger is running in asynchronous mode.
const lldb::DebuggerSP & get_sp() const
static bool StateIsRunningState(lldb::StateType state)
Check if a state is a running state.
SBError SetErrorFile(SBFile file)
Set the error file for the debugger.
bool SetUseSourceCache(bool use_source_cache)
Set whether to use the source cache.
uint32_t GetNumCategories()
Get the number of type categories.
static lldb::SBStringList GetInternalVariableValue(const char *var_name, const char *debugger_instance_name)
Get the value of an internal variable.
void Clear()
Clear this debugger instance.
SBTypeFormat GetFormatForType(SBTypeNameSpecifier type_name_spec)
Get the format for a type.
bool GetUseColor() const
Get whether color is being used in output.
static bool SupportsLanguage(lldb::LanguageType language)
Check if a specific language is supported by LLDB.
lldb::SBListener GetListener()
Get the listener associated with this debugger.
void SetLoggingCallback(lldb::LogOutputCallback log_callback, void *baton)
Set a callback for log output.
lldb::DebuggerSP m_opaque_sp
lldb::ScriptLanguage GetScriptLanguage() const
Get the current scripting language.
LLDB_DEPRECATED_FIXME("Use AddDestroyCallback and RemoveDestroyCallback", "AddDestroyCallback") void SetDestroyCallback(lldb lldb::callback_token_t AddDestroyCallback(lldb::SBDebuggerDestroyCallback destroy_callback, void *baton)
Set a callback for when the debugger is destroyed (deprecated).
void SetScriptLanguage(lldb::ScriptLanguage script_lang)
Set the current scripting language.
uint32_t GetNumAvailablePlatforms()
Get the number of available platforms.
lldb::SBTarget FindTargetWithLLDBProcess(const lldb::ProcessSP &processSP)
SBTypeSynthetic GetSyntheticForType(SBTypeNameSpecifier type_name_spec)
Get the synthetic for a type.
void DispatchClientTelemetry(const lldb::SBStructuredData &data)
Dispatch telemetry data from client to server.
SBTypeCategory GetCategoryAtIndex(uint32_t index)
Get a type category by index.
lldb::SBPlatform GetSelectedPlatform()
Get the selected platform.
static const char * GetBroadcasterClass()
Get the broadcaster class name.
lldb::SBTarget CreateTargetWithFileAndArch(const char *filename, const char *archname)
Create a target with the specified file and architecture.
bool IsValid() const
Check if this is a valid SBDebugger object.
static void Initialize()
Initialize LLDB and its subsystems.
static bool StateIsStoppedState(lldb::StateType state)
Check if a state is a stopped state.
lldb::SBError SetCurrentPlatform(const char *platform_name)
Set the current platform by name.
lldb::SBSourceManager GetSourceManager()
Get the source manager for this debugger.
SBTypeCategory GetCategory(const char *category_name)
Get a type category by name.
void ResetStatistics()
Clear collected statistics for targets belonging to this debugger.
void SetREPLLanguage(lldb::LanguageType repl_lang)
Set the current REPL language.
SBStructuredData GetScriptInterpreterInfo(ScriptLanguage language)
Get information about a script interpreter as structured data.
static SBDebugger FindDebuggerWithID(int id)
Find a debugger by ID. Returns an invalid debugger if not found.
bool SetShowInlineDiagnostics(bool b)
Set whether to show inline diagnostics.
uint32_t GetNumPlatforms()
Get the number of currently active platforms.
void DispatchInputEndOfFile()
Signal end-of-file to the current input dispatch.
uint32_t GetTerminalWidth() const
Get the terminal width.
bool InterruptRequested()
Check if an interrupt has been requested.
lldb::SBTarget FindTargetWithFileAndArch(const char *filename, const char *arch)
Find a target with the specified file and architecture.
static lldb::SBStructuredData GetProgressDataFromEvent(const lldb::SBEvent &event)
Get progress data from an event.
static const char * StateAsCString(lldb::StateType state)
Convert a state type to a string.
void PushInputReader(lldb::SBInputReader &reader)
Push an input reader onto the IO handler stack.
static const char * GetProgressFromEvent(const lldb::SBEvent &event, uint64_t &progress_id, uint64_t &completed, uint64_t &total, bool &is_debugger_specific)
Get progress data from a SBEvent whose type is eBroadcastBitProgress.
lldb::SBTarget GetDummyTarget()
Get the dummy target.
bool EnableLog(const char *channel, const char **categories)
Enable logging for a specific channel and category.
static bool SetDefaultArchitecture(const char *arch_name)
Set the default architecture.
lldb_private::Debugger * get() const
void RestoreInputTerminalState()
Restore the previously saved terminal state.
SBFile GetOutputFile()
Get the output file for the debugger.
lldb::SBBroadcaster GetBroadcaster()
Get the broadcaster that allows subscribing to events from this debugger.
void SetSelectedTarget(SBTarget &target)
Set the selected target.
SBTypeCategory GetDefaultCategory()
Get the default type category.
bool GetUseSourceCache() const
Get whether the source cache is being used.
SBFile GetErrorFile()
Get the error file for the debugger.
uint32_t GetTerminalHeight() const
Get the terminal height.
LLDB_DEPRECATED_FIXME("Use HandleProcessEvent(const SBProcess &, const SBEvent &, SBFile, " "SBFile) or HandleProcessEvent(const SBProcess &, const SBEvent &, " "FileSP, FileSP)", "HandleProcessEvent(const SBProcess &, const SBEvent &, SBFile, SBFile)") void HandleProcessEvent(const lldb voi HandleProcessEvent)(const lldb::SBProcess &process, const lldb::SBEvent &event, SBFile out, SBFile err)
Handle a process event (deprecated).
lldb::SBStructuredData GetAvailablePlatformInfoAtIndex(uint32_t idx)
Get information about the available platform at the given index as structured data.
static SBStructuredData GetBuildConfiguration()
Get the build configuration as structured data.
SBTypeCategory CreateCategory(const char *category_name)
Create a new type category.
bool SetCurrentPlatformSDKRoot(const char *sysroot)
Set the SDK root for the current platform.
void SetErrorFileHandle(FILE *f, bool transfer_ownership)
Set the error file handle for the debugger.
SBTrace LoadTraceFromFile(SBError &error, const SBFileSpec &trace_description_file)
Load a trace from a trace description file.
void CancelInterruptRequest()
Cancel a previously requested interrupt.
uint32_t GetNumTargets()
Get the number of targets in the debugger.
FILE * GetInputFileHandle()
Get the input file handle for the debugger.
SBError SetInputFile(SBFile file)
Set the input file for the debugger.
void DispatchInputInterrupt()
Interrupt the current input dispatch.
SBError SetInputString(const char *data)
Set the input from a string.
uint32_t GetIndexOfTarget(lldb::SBTarget target)
Get the index of a target.
SBError SetOutputFile(SBFile file)
Set the output file for the debugger.
lldb::SBTarget GetSelectedTarget()
Get the currently selected target.
void SaveInputTerminalState()
Save the current terminal state.
FILE * GetErrorFileHandle()
Get the error file handle for the debugger.
void SetSelectedPlatform(lldb::SBPlatform &platform)
Set the selected platform.
friend class SBSourceManager
void reset(const lldb::DebuggerSP &debugger_sp)
FILE * GetOutputFileHandle()
Get the output file handle for the debugger.
const char * GetInstanceName()
Get the instance name of this debugger.
lldb::SBTarget FindTargetWithProcessID(lldb::pid_t pid)
Find a target with the specified process ID.
static void PrintDiagnosticsOnError()
Configure LLDB to print diagnostic information when it crashes.
void SetCloseInputOnEOF(bool b)
Set whether to close input on EOF (deprecated).
friend class SBCommandInterpreter
lldb::user_id_t GetID()
Get the unique ID of this debugger.
lldb::SBTarget CreateTargetWithFileAndTargetTriple(const char *filename, const char *target_triple)
Create a target with the specified file and target triple.
SBDebugger()
Default constructor creates an invalid SBDebugger instance.
bool RemoveDestroyCallback(lldb::callback_token_t token)
Remove a destroy callback.
static lldb::SBStructuredData GetDiagnosticFromEvent(const lldb::SBEvent &event)
Get diagnostic information from an event.
lldb::ScriptLanguage GetScriptingLanguage(const char *script_language_name)
Get the scripting language by name.
lldb::SBTarget FindTargetByGloballyUniqueID(lldb::user_id_t id) const
Find a target with the specified unique ID.
static void Destroy(lldb::SBDebugger &debugger)
Destroy a debugger instance.
void RequestInterrupt()
Request an interrupt of the current operation.
void SetError(uint32_t err, lldb::ErrorType type)
lldb_private::Status & ref()
const char * GetCString() const
Get the error string as a null-terminated UTF8 c-string.
lldb_private::Event * get() const
Options for SBDebugger::Initialize. They apply to the whole process.
const lldb_private::InitializationOptions & ref() const
void reset(lldb::ListenerSP listener_sp)
void ReportEventState(const lldb::SBEvent &event, FILE *out) const
lldb::ProcessSP GetSP() const
static lldb::StateType GetStateFromEvent(const lldb::SBEvent &event)
lldb::SBTarget GetTarget() const
size_t GetSTDOUT(char *dst, size_t dst_len) const
size_t GetSTDERR(char *dst, size_t dst_len) const
lldb_private::Stream & ref()
StructuredDataImplUP m_impl_up
bool GetDescription(lldb::SBStream &description, lldb::DescriptionLevel description_level)
void SetSP(const lldb::TargetSP &target_sp)
lldb::TargetSP GetSP() const
lldb::TargetSP m_opaque_sp
static SBTrace LoadTraceFromFile(SBError &error, SBDebugger &debugger, const SBFileSpec &trace_description_file)
See SBDebugger::LoadTraceFromFile.
SBTypeFormat GetFormatForType(SBTypeNameSpecifier)
lldb::TypeNameSpecifierImplSP GetSP()
An architecture specification class.
bool IsValid() const
Tests if this ArchSpec is valid.
llvm::Triple & GetTriple()
Architecture triple accessor.
const char * GetArchitectureName() const
Returns a static string representing the current architecture.
void SetSpawnThread(bool spawn_thread)
void SetAutoHandleEvents(bool auto_handle_events)
bool IsResult(lldb::CommandInterpreterResult result)
uint32_t GetNumErrors() const
void SkipAppInitFiles(bool skip_app_init_files)
void SkipLLDBInitFiles(bool skip_lldbinit_files)
CommandInterpreterRunResult RunCommandInterpreter(CommandInterpreterRunOptions &options)
A uniqued constant string class.
const char * GetCString() const
Get the string value as a C string.
static bool GetCategory(llvm::StringRef category, lldb::TypeCategoryImplSP &entry, bool allow_create=true)
static lldb::TypeCategoryImplSP GetCategoryAtIndex(size_t)
static bool Delete(llvm::StringRef category)
static uint32_t GetCount()
static lldb::ScriptedSyntheticChildrenSP GetSyntheticForType(lldb::TypeNameSpecifierImplSP type_sp)
static lldb::TypeFilterImplSP GetFilterForType(lldb::TypeNameSpecifierImplSP type_sp)
static lldb::TypeSummaryImplSP GetSummaryForType(lldb::TypeNameSpecifierImplSP type_sp)
static void ResetStatistics(Debugger &debugger, Target *target)
Reset metrics associated with one or all targets in a debugger.
A class to manage flag bits.
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 lldb::DebuggerSP FindDebuggerWithInstanceName(llvm::StringRef instance_name)
static StructuredData::DictionarySP GetBuildConfiguration()
Get the build configuration as structured data.
static llvm::StringRef GetStaticBroadcasterClass()
static lldb::DebuggerSP CreateInstance(lldb::LogOutputCallback log_callback=nullptr, void *baton=nullptr)
static lldb::DebuggerSP FindDebuggerWithID(lldb::user_id_t id)
static void Destroy(lldb::DebuggerSP &debugger_sp)
static StructuredData::DictionarySP GetAsStructuredData(const Event *event_ptr)
bool Dump(llvm::raw_ostream &stream)
Write the diagnostic log into a directory and print a message to the given output stream.
static Diagnostics & Instance()
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
An abstract base class for files.
virtual FILE * GetStream()
Get the underlying libc stream for this file, or NULL.
static std::string GetVersionWithLanguageInfo()
Returns lldb_private::GetVersion(), followed by the GetVersionInfo() of each registered language plug...
static size_t RemoveOrphanSharedModules(bool mandatory)
@ eDumpOptionIncludeDeprecated
Also dump deprecated settings that still have their default value.
static llvm::StringRef GetPlatformPluginDescriptionAtIndex(uint32_t idx)
static llvm::StringRef GetPlatformPluginNameAtIndex(uint32_t idx)
@ eBroadcastBitStateChanged
static const ProgressEventData * GetEventDataFromEvent(const Event *event_ptr)
bool IsDebuggerSpecific() const
static StructuredData::DictionarySP GetAsStructuredData(const Event *event_ptr)
uint64_t GetCompleted() const
uint64_t GetTotal() const
std::string GetMessage() const
virtual StructuredData::DictionarySP GetInterpreterInfo()
static Status FromErrorStringWithFormat(const char *format,...) __attribute__((format(printf
static Status FromErrorString(const char *str)
static Status FromError(llvm::Error error)
Avoid using this in new code. Migrate APIs to llvm::Expected instead.
llvm::StringRef GetString() const
A stream class that can stream formatted output to a file.
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.
size_t SplitIntoLines(const std::string &lines)
const char * InternNonEmpty(llvm::StringRef str) const
Like Intern, but an empty string yields nullptr.
static StringPoolRef GetSystemPool()
The system pool. Only valid between Initialize and Terminate.
std::shared_ptr< Dictionary > DictionarySP
std::shared_ptr< Object > ObjectSP
static ObjectSP ParseJSON(llvm::StringRef json_text)
A Lockable handle over a Target's API mutex, returned by Target::GetAPIMutex() and backing the public...
static ArchSpec GetDefaultArchitecture()
static void SetDefaultArchitecture(const ArchSpec &arch)
static bool SupportsLanguageStatic(lldb::LanguageType language)
#define LLDB_INVALID_CALLBACK_TOKEN
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.
bool StateIsStoppedState(lldb::StateType state, bool must_exist)
Check if a state represents a state where the process or thread is stopped.
bool StateIsRunningState(lldb::StateType state)
Check if a state represents a state where the process or thread is running.
const char * StateAsCString(lldb::StateType state)
Converts a StateType to a C string.
ScriptLanguage
Script interpreter types.
class LLDB_API SBBroadcaster
@ eCommandInterpreterResultInferiorCrash
Stopped because the corresponding option was set and the inferior crashed.
@ eCommandInterpreterResultQuitRequested
Stopped because quit was requested.
class LLDB_API SBInitializationOptions
class LLDB_API SBTypeCategory
std::shared_ptr< lldb_private::Platform > PlatformSP
StateType
Process and Thread States.
LanguageType
Programming language type.
@ eLanguageTypeUnknown
Unknown or invalid language value.
class LLDB_API SBTypeFilter
class LLDB_API SBTypeFormat
std::shared_ptr< lldb_private::Process > ProcessSP
std::shared_ptr< lldb_private::Debugger > DebuggerSP
std::shared_ptr< lldb_private::Event > EventSP
std::shared_ptr< lldb_private::Listener > ListenerSP
std::shared_ptr< lldb_private::TypeCategoryImpl > TypeCategoryImplSP
class LLDB_API SBStringList
void(* SBDebuggerDestroyCallback)(lldb::user_id_t debugger_id, void *baton)
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::OptionValue > OptionValueSP
class LLDB_API SBTypeSynthetic
class LLDB_API SBCommandInterpreterRunResult
InputReaderGranularity
Token size/granularities for Input Readers.
class LLDB_API SBTypeSummary
static lldb::ScriptLanguage ToScriptLanguage(llvm::StringRef s, lldb::ScriptLanguage fail_value, bool *success_ptr)