44#include "lldb/Host/Config.h"
58#include "llvm/ADT/STLExtras.h"
59#include "llvm/ADT/StringRef.h"
60#include "llvm/Config/llvm-config.h"
61#include "llvm/Support/DynamicLibrary.h"
62#include "llvm/Support/ManagedStatic.h"
63#include "llvm/Support/PrettyStackTrace.h"
64#include "llvm/Support/Signals.h"
120 uint64_t &progress_id,
123 bool &is_debugger_specific) {
128 if (progress_data ==
nullptr)
130 progress_id = progress_data->
GetID();
149 data.m_impl_up->SetObjectSP(std::move(dictionary_sp));
164 data.m_impl_up->SetObjectSP(std::move(dictionary_sp));
184 std::make_unique<SystemInitializerFull>())) {
193 llvm::EnablePrettyStackTrace();
194 static std::string executable =
195 llvm::sys::fs::getMainExecutable(
nullptr,
nullptr);
196 llvm::sys::PrintStackTraceOnErrorSignal(executable);
249 static std::recursive_mutex g_mutex;
250 std::lock_guard<std::recursive_mutex> guard(g_mutex);
255 if (source_init_files) {
285 const bool mandatory =
false;
292 return this->
operator bool();
294SBDebugger::operator
bool()
const {
317 m_opaque_sp->GetCommandInterpreter().SkipLLDBInitFiles(b);
324 m_opaque_sp->GetCommandInterpreter().SkipAppInitFiles(b);
331 (
FileSP)std::make_shared<NativeFile>(fh, transfer_ownership));
337 if (
data ==
nullptr) {
342 size_t size = strlen(
data);
440 m_opaque_sp->GetCommandInterpreter().GetExecutionContext());
441 if (setting && strlen(setting) > 0)
442 m_opaque_sp->DumpPropertyValue(&exe_ctx, json_strm, setting,
446 m_opaque_sp->DumpAllPropertyValues(&exe_ctx, json_strm, 0,
473 return m_opaque_sp->GetOutputFileSP()->GetStream();
520 return sb_interpreter;
528 std::unique_lock<std::recursive_mutex> lock;
530 lock = std::unique_lock<std::recursive_mutex>(target_sp->GetAPIMutex());
546 while (lldb_listener_sp->GetEventForBroadcaster(
547 process_sp.get(), event_sp, std::chrono::seconds(0))) {
575 const SBEvent &event, FILE *out,
579 FileSP outfile = std::make_shared<NativeFile>(out,
false);
580 FileSP errfile = std::make_shared<NativeFile>(err,
false);
597 const uint32_t event_type =
event.GetType();
598 char stdio_buffer[1024];
601 std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
606 while ((len = process.
GetSTDOUT(stdio_buffer,
sizeof(stdio_buffer))) > 0)
608 out_sp->Write(stdio_buffer, len);
614 while ((len = process.
GetSTDERR(stdio_buffer,
sizeof(stdio_buffer))) > 0)
616 err_sp->Write(stdio_buffer, len);
635 return sb_source_manager;
641 if (arch_name && arch_name_len) {
645 const std::string &triple_str = default_arch.
GetTriple().str();
646 if (!triple_str.empty())
647 ::snprintf(arch_name, arch_name_len,
"%s", triple_str.c_str());
649 ::snprintf(arch_name, arch_name_len,
"%s",
654 if (arch_name && arch_name_len)
676 if (!script_language_name)
709 llvm::StringRef name,
bool value,
710 llvm::StringRef description) {
711 auto entry_up = std::make_unique<StructuredData::Dictionary>();
712 entry_up->AddBooleanItem(
"value", value);
713 entry_up->AddStringItem(
"description", description);
714 dict.
AddItem(name, std::move(entry_up));
718 auto array_up = std::make_unique<StructuredData::Array>();
719#define LLVM_TARGET(target) \
720 array_up->AddItem(std::make_unique<StructuredData::String>(#target));
721#include "llvm/Config/Targets.def"
722 auto entry_up = std::make_unique<StructuredData::Dictionary>();
723 entry_up->AddItem(
"value", std::move(array_up));
724 entry_up->AddStringItem(
"description",
"A list of configured LLVM targets.");
725 dict.
AddItem(
"targets", std::move(entry_up));
731 auto config_up = std::make_unique<StructuredData::Dictionary>();
734 "A boolean value that indicates if XML support is enabled in LLDB");
736 *config_up,
"curl", LLVM_ENABLE_CURL,
737 "A boolean value that indicates if CURL support is enabled in LLDB");
739 *config_up,
"curses", LLDB_ENABLE_CURSES,
740 "A boolean value that indicates if curses support is enabled in LLDB");
742 *config_up,
"editline", LLDB_ENABLE_LIBEDIT,
743 "A boolean value that indicates if editline support is enabled in LLDB");
745 "A boolean value that indicates if editline wide "
746 "characters support is enabled in LLDB");
748 *config_up,
"lzma", LLDB_ENABLE_LZMA,
749 "A boolean value that indicates if lzma support is enabled in LLDB");
751 *config_up,
"python", LLDB_ENABLE_PYTHON,
752 "A boolean value that indicates if python support is enabled in LLDB");
754 *config_up,
"lua", LLDB_ENABLE_LUA,
755 "A boolean value that indicates if lua support is enabled in LLDB");
757 "A boolean value that indicates if fbsdvmcore support is "
762 data.m_impl_up->SetObjectSP(std::move(config_up));
783 const char *target_triple,
784 const char *platform_name,
785 bool add_dependent_modules,
788 add_dependent_modules, sb_error);
800 &platform_options, target_sp);
803 sb_target.
SetSP(target_sp);
810 "SBDebugger(%p)::CreateTarget (filename=\"%s\", triple=%s, "
811 "platform_name=%s, add_dependent_modules=%u, error=%s) => "
813 static_cast<void *
>(
m_opaque_sp.get()), filename, target_triple,
814 platform_name, add_dependent_modules, sb_error.
GetCString(),
815 static_cast<void *
>(target_sp.get()));
822 const char *target_triple) {
828 const bool add_dependent_modules =
true;
833 sb_target.
SetSP(target_sp);
838 "SBDebugger(%p)::CreateTargetWithFileAndTargetTriple "
839 "(filename=\"%s\", triple=%s) => SBTarget(%p)",
840 static_cast<void *
>(
m_opaque_sp.get()), filename, target_triple,
841 static_cast<void *
>(target_sp.get()));
847 const char *arch_cstr) {
856 if (arch_cstr ==
nullptr) {
865 m_opaque_sp->GetPlatformList().GetSelectedPlatform();
877 sb_target.
SetSP(target_sp);
881 "SBDebugger(%p)::CreateTargetWithFileAndArch (filename=\"%s\", "
882 "arch=%s) => SBTarget(%p)",
884 filename ? filename :
"<unspecified>",
885 arch_cstr ? arch_cstr :
"<unspecified>",
886 static_cast<void *
>(target_sp.get()));
898 const bool add_dependent_modules =
true;
905 sb_target.
SetSP(target_sp);
909 "SBDebugger(%p)::CreateTarget (filename=\"%s\") => SBTarget(%p)",
911 static_cast<void *
>(target_sp.get()));
923 LLDB_LOGF(log,
"SBDebugger(%p)::GetDummyTarget() => SBTarget(%p)",
925 static_cast<void *
>(sb_target.
GetSP().get()));
936 "Could not send telemetry from SBDebugger - debugger was null.");
948 result =
m_opaque_sp->GetTargetList().DeleteTarget(target_sp);
949 target_sp->Destroy();
955 LLDB_LOGF(log,
"SBDebugger(%p)::DeleteTarget (SBTarget(%p)) => %i",
957 static_cast<void *
>(target.
m_opaque_sp.get()), result);
998 const char *arch_name) {
1005 m_opaque_sp->GetPlatformList().GetSelectedPlatform().get(), arch_name);
1007 m_opaque_sp->GetTargetList().FindTargetWithExecutableAndArchitecture(
1008 FileSpec(filename), arch_name ? &arch :
nullptr));
1009 sb_target.
SetSP(target_sp);
1019 m_opaque_sp->GetTargetList().FindTargetWithProcess(process_sp.get()));
1029 return m_opaque_sp->GetTargetList().GetNumTargets();
1043 target_sp =
m_opaque_sp->GetTargetList().GetSelectedTarget();
1044 sb_target.
SetSP(target_sp);
1050 LLDB_LOGF(log,
"SBDebugger(%p)::GetSelectedTarget () => SBTarget(%p): %s",
1052 static_cast<void *
>(target_sp.get()), sstr.
GetData());
1065 m_opaque_sp->GetTargetList().SetSelectedTarget(target_sp);
1070 LLDB_LOGF(log,
"SBDebugger(%p)::SetSelectedTarget () => SBTarget(%p): %s",
1072 static_cast<void *
>(target_sp.get()), sstr.
GetData());
1084 sb_platform.
SetSP(debugger_sp->GetPlatformList().GetSelectedPlatform());
1086 LLDB_LOGF(log,
"SBDebugger(%p)::GetSelectedPlatform () => SBPlatform(%p): %s",
1088 static_cast<void *
>(sb_platform.
GetSP().get()),
1100 debugger_sp->GetPlatformList().SetSelectedPlatform(sb_platform.
GetSP());
1103 LLDB_LOGF(log,
"SBDebugger(%p)::SetSelectedPlatform (SBPlatform(%p) %s)",
1105 static_cast<void *
>(sb_platform.
GetSP().get()),
1148 auto platform_dict = std::make_unique<StructuredData::Dictionary>();
1149 llvm::StringRef name_str(
"name"), desc_str(
"description");
1153 platform_dict->AddStringItem(name_str, host_platform_sp->GetPluginName());
1154 platform_dict->AddStringItem(
1155 desc_str, llvm::StringRef(host_platform_sp->GetDescription()));
1156 }
else if (idx > 0) {
1157 llvm::StringRef plugin_name =
1159 if (plugin_name.empty()) {
1162 platform_dict->AddStringItem(name_str, llvm::StringRef(plugin_name));
1164 llvm::StringRef plugin_desc =
1166 platform_dict->AddStringItem(desc_str, llvm::StringRef(plugin_desc));
1169 data.m_impl_up->SetObjectSP(
1216 bool spawn_thread) {
1223 m_opaque_sp->GetCommandInterpreter().RunCommandInterpreter(options);
1230 int &num_errors,
bool &quit_requested,
1231 bool &stopped_for_crash)
1235 num_errors, quit_requested, stopped_for_crash);
1266 const char *repl_options) {
1297 sb_debugger.
reset(debugger_sp);
1311 const char *debugger_instance_name) {
1320 debugger_sp->GetCommandInterpreter().GetExecutionContext());
1325 "invalid debugger instance name '%s'", debugger_instance_name);
1334 const char *debugger_instance_name) {
1342 debugger_sp->GetCommandInterpreter().GetExecutionContext());
1344 debugger_sp->GetPropertyValue(&exe_ctx, var_name,
error));
1348 const std::string &value_str = std::string(value_strm.
GetString());
1349 if (!value_str.empty()) {
1390 LLDB_LOG(log,
"SBDebugger({0:x})::GetPrompt () => \"{1}\"",
1408 return "GetReproducerPath has been deprecated";
1487 const char *name =
m_opaque_sp->GetInstanceName().c_str();
1489 strm.
Printf(
"Debugger (instance: \"%s\", id: %" PRIu64
")", name,
id);
1507 if (platform_name_cstr && platform_name_cstr[0]) {
1526 platform.SetSDKRoot(sysroot);
1545 if (!category_name || *category_name == 0)
1551 category_sp,
false)) {
1572 if (!category_name || *category_name == 0)
1578 category_sp,
true)) {
1588 if (!category_name || *category_name == 0)
1654 if (categories ==
nullptr)
1657 while (categories[len] !=
nullptr)
1659 return llvm::ArrayRef(categories, len);
1666 uint32_t log_options =
1669 llvm::raw_string_ostream error_stream(
error);
1682 return m_opaque_sp->SetLoggingCallback(log_callback, baton);
1686void SBDebugger::SetDestroyCallback(
1691 destroy_callback, baton);
1701 return m_opaque_sp->AddDestroyCallback(destroy_callback, baton);
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.
#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 void AddBoolConfigEntry(StructuredData::Dictionary &dict, llvm::StringRef name, bool value, llvm::StringRef description)
static void AddLLVMTargets(StructuredData::Dictionary &dict)
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.
void SetTerminalWidth(uint32_t term_width)
Set the terminal width.
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.
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.
void SetTerminalHeight(uint32_t term_height)
Set the terminal height.
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.
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
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 * AsCString(const char *value_if_empty=nullptr) const
Get the string value as a C string.
const char * GetCString() const
Get the string value as a C string.
static bool Delete(ConstString category)
static lldb::TypeCategoryImplSP GetCategoryAtIndex(size_t)
static bool GetCategory(ConstString category, lldb::TypeCategoryImplSP &entry, bool allow_create=true)
static 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 lldb::DebuggerSP FindDebuggerWithInstanceName(llvm::StringRef instance_name)
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)
Gather diagnostics and print a message to the given output stream.
static Diagnostics & Instance()
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
An abstract base class for files.
virtual FILE * GetStream()
Get the underlying libc stream for this file, or NULL.
static size_t RemoveOrphanSharedModules(bool mandatory)
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)
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()
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.
const char * GetVersion()
Retrieves a string representing the complete LLDB version, which includes the lldb version number,...
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.
@ eCommandInterpreterResultInferiorCrash
Stopped because the corresponding option was set and the inferior crashed.
@ eCommandInterpreterResultQuitRequested
Stopped because quit was requested.
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)