Go to the documentation of this file.
9 #ifndef LLDB_CORE_DEBUGGER_H
10 #define LLDB_CORE_DEBUGGER_H
41 #include "llvm/ADT/ArrayRef.h"
42 #include "llvm/ADT/StringMap.h"
43 #include "llvm/ADT/StringRef.h"
44 #include "llvm/Support/DynamicLibrary.h"
45 #include "llvm/Support/Threading.h"
58 class CallbackLogHandler;
59 class CommandInterpreter;
75 class Debugger :
public std::enable_shared_from_this<Debugger>,
97 static lldb::DebuggerSP
99 void *baton =
nullptr);
105 static void Initialize(LoadPluginCallbackType load_plugin_callback);
113 static void Destroy(lldb::DebuggerSP &debugger_sp);
117 static lldb::DebuggerSP
177 std::optional<lldb::ScriptLanguage> language = {});
211 lldb::StreamFileSP &out,
212 lldb::StreamFileSP &err);
216 bool cancel_top_handler =
true);
229 void PrintAsync(
const char *s,
size_t len,
bool is_stdout);
244 llvm::ArrayRef<const char *> categories,
245 llvm::StringRef log_file,
uint32_t log_options,
247 llvm::raw_ostream &error_stream);
261 llvm::StringRef value)
override;
406 std::optional<lldb::user_id_t> debugger_id = std::nullopt,
407 std::once_flag *once =
nullptr);
428 std::optional<lldb::user_id_t> debugger_id = std::nullopt,
429 std::once_flag *once =
nullptr);
448 std::optional<lldb::user_id_t> debugger_id = std::nullopt,
449 std::once_flag *once =
nullptr);
488 uint64_t completed, uint64_t total,
489 std::optional<lldb::user_id_t> debugger_id);
493 std::optional<lldb::user_id_t> debugger_id,
494 std::once_flag *once);
503 bool cancel_top_handler =
true);
571 std::array<lldb::ScriptInterpreterSP, lldb::eScriptLanguageUnknown>
609 #endif // LLDB_CORE_DEBUGGER_H
static void SettingsTerminate()
Broadcaster & GetBroadcaster()
Get the public broadcaster for this debugger.
bool CheckTopIOHandlerTypes(IOHandler::Type top_type, IOHandler::Type second_top_type)
const char * GetIOHandlerCommandPrefix()
void RunIOHandlerSync(const lldb::IOHandlerSP &reader_sp)
Run the given IO handler and block until it's complete.
void SetCloseInputOnEOF(bool b)
ScriptLanguage
Script interpreter types.
uint32_t GetDisassemblyLineCount() const
lldb::StreamFileSP m_output_stream_sp
ExecutionContext GetSelectedExecutionContext()
void AdoptTopIOHandlerFilesIfInvalid(lldb::FileSP &in, lldb::StreamFileSP &out, lldb::StreamFileSP &err)
void PrintProgress(const ProgressEventData &data)
Status SetPropertyValue(const ExecutionContext *exe_ctx, VarSetOperationType op, llvm::StringRef property_path, llvm::StringRef value) override
bool GetHighlightSource() const
ScriptInterpreter * GetScriptInterpreter(bool can_create=true, std::optional< lldb::ScriptLanguage > language={})
bool GetAutoConfirm() const
lldb::LanguageType GetREPLLanguage() const
void DispatchInputEndOfFile()
const Debugger & operator=(const Debugger &)=delete
CommandInterpreter & GetCommandInterpreter()
void HandleThreadEvent(const lldb::EventSP &event_sp)
Status RunREPL(lldb::LanguageType language, const char *repl_options)
static lldb::DebuggerSP GetDebuggerAtIndex(size_t index)
void(* LogOutputCallback)(const char *, void *baton)
llvm::once_flag m_clear_once
void SetPrompt(llvm::StringRef p)
bool GetShowProgress() const
Target & GetDummyTarget()
Debugger(lldb::LogOutputCallback m_log_callback, void *baton)
void SetOutputFile(lldb::FileSP file)
static llvm::ThreadPool & GetThreadPool()
Shared thread poll. Use only with ThreadPoolTaskGroup.
static LoadPluginCallbackType g_load_plugin_callback
llvm::StringRef GetStopShowColumnAnsiSuffix() const
bool GetUseSourceCache() const
std::shared_ptr< CallbackLogHandler > m_callback_handler_sp
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)
bool GetPrintDecls() const
void RunIOHandlerAsync(const lldb::IOHandlerSP &reader_sp, bool cancel_top_handler=true)
Run the given IO handler and return immediately.
void StopEventHandlerThread()
bool StartEventHandlerThread()
LanguageType
Programming language type.
StreamFile & GetOutputStream()
bool StartIOHandlerThread()
static lldb::DebuggerSP CreateInstance(lldb::LogOutputCallback log_callback=nullptr, void *baton=nullptr)
bool SetAutoIndent(bool b)
lldb::StreamFileSP GetOutputStreamSP()
ConstString GetTopIOHandlerControlSequence(char ch)
bool IsForwardingEvents()
lldb::ScriptLanguage GetScriptLanguage() const
@ eStopDisassemblyTypeNever
repro::DataRecorder * m_input_recorder
Used for shadowing the input file when capturing a reproducer.
bool GetUseExternalEditor() const
lldb::ListenerSP GetListener()
HostThread m_io_handler_thread
uint32_t GetStopDisassemblyMaxSize() const
bool GetUseAutosuggestion() const
LoadedPluginsList m_loaded_plugins
void SetErrorFile(lldb::FileSP file)
lldb::StopShowColumn GetStopShowColumn() const
void SaveInputTerminalState()
bool RemoveIOHandler(const lldb::IOHandlerSP &reader_sp)
Remove the given IO handler if it's currently active.
static void ReportSymbolChange(const ModuleSpec &module_spec)
std::recursive_mutex m_io_handler_synchronous_mutex
lldb::ListenerSP m_listener_sp
@ eStopDisassemblyTypeAlways
Broadcaster m_broadcaster
Public Debugger event broadcaster.
llvm::StringMap< std::weak_ptr< LogHandler > > m_stream_handlers
const FormatEntity::Entry * GetDisassemblyFormat() const
llvm::StringRef GetAutosuggestionAnsiSuffix() const
static llvm::raw_ostream & error(Stream &strm)
VarSetOperationType
Settable state variable types.
void SetInputFile(lldb::FileSP file)
bool SetUseSourceCache(bool use_source_cache)
void SetLoggingCallback(lldb::LogOutputCallback log_callback, void *baton)
bool IsHandlingEvents() const
static ConstString GetStaticBroadcasterClass()
std::recursive_mutex m_script_interpreter_mutex
static void ReportInfo(std::string message, std::optional< lldb::user_id_t > debugger_id=std::nullopt, std::once_flag *once=nullptr)
Report info events.
std::unique_ptr< SourceManager > m_source_manager_up
bool GetAutoIndent() const
static void ReportDiagnosticImpl(DiagnosticEventData::Type type, std::string message, std::optional< lldb::user_id_t > debugger_id, std::once_flag *once)
void DispatchInputInterrupt()
static void SettingsInitialize()
bool SetREPLLanguage(lldb::LanguageType repl_lang)
llvm::StringRef GetStopShowColumnAnsiPrefix() const
const FormatEntity::Entry * GetThreadFormat() const
ConstString m_instance_name
lldb::StreamSP GetAsyncOutputStream()
bool GetEscapeNonPrintables() const
@ eStopDisassemblyTypeNoDebugInfo
lldb::StreamSP GetAsyncErrorStream()
uint32_t GetTerminalWidth() const
static void Initialize(LoadPluginCallbackType load_plugin_callback)
llvm::StringRef GetShowProgressAnsiPrefix() const
bool GetAutoOneLineSummaries() const
A Progress indicator helper class.
SourceManager & GetSourceManager()
void HandleProcessEvent(const lldb::EventSP &event_sp)
lldb::FileSP GetInputFileSP()
bool SetShowProgress(bool show_progress)
lldb::thread_result_t DefaultEventHandler()
lldb::StreamFileSP m_error_stream_sp
void EnableForwardEvents(const lldb::ListenerSP &listener_sp)
bool PopIOHandler(const lldb::IOHandlerSP &reader_sp)
string(SUBSTRING ${p} 10 -1 pStripped) if($
SourceManager::SourceFileCache m_source_file_cache
bool SetScriptLanguage(lldb::ScriptLanguage script_lang)
void FlushProcessOutput(Process &process, bool flush_stdout, bool flush_stderr)
IOHandlerStack m_io_handler_stack
repro::DataRecorder * GetInputRecorder()
void JoinIOHandlerThread()
static void ReportProgress(uint64_t progress_id, const std::string &message, uint64_t completed, uint64_t total, std::optional< lldb::user_id_t > debugger_id)
Report progress events.
TargetList & GetTargetList()
Get accessor for the target list.
lldb::BroadcasterManagerSP m_broadcaster_manager_sp
TerminalState m_terminal_state
const char * GetIOHandlerHelpPrologue()
@ eStopDisassemblyTypeNoSource
lldb::DWIMPrintVerbosity GetDWIMPrintVerbosity() const
StopDisassemblyType GetStopDisassemblyDisplay() const
void PrintAsync(const char *s, size_t len, bool is_stdout)
static size_t GetNumDebuggers()
bool IsTopIOHandler(const lldb::IOHandlerSP &reader_sp)
static lldb::DebuggerSP FindDebuggerWithInstanceName(ConstString instance_name)
void InstanceInitialize()
HostThread m_event_handler_thread
bool SetTerminalWidth(uint32_t term_width)
Broadcaster m_sync_broadcaster
Private debugger synchronization.
bool GetNotifyVoid() const
std::optional< uint64_t > m_current_event_id
void PushIOHandler(const lldb::IOHandlerSP &reader_sp, bool cancel_top_handler=true)
message(FATAL_ERROR "invalid libipt include path provided") endif() include_directories($
uint32_t GetTabSize() const
llvm::StringRef GetStopShowLineMarkerAnsiSuffix() const
lldb::StreamFileSP GetErrorStreamSP()
static lldb::TargetSP FindTargetWithProcessID(lldb::pid_t pid)
PlatformList & GetPlatformList()
bool GetCloseInputOnEOF() const
bool LoadPlugin(const FileSpec &spec, Status &error)
const Broadcaster & GetBroadcaster() const
static lldb::DebuggerSP FindDebuggerWithID(lldb::user_id_t id)
static lldb::TargetSP FindTargetWithProcess(Process *process)
ConstString GetInstanceName()
bool SetTabSize(uint32_t tab_size)
std::mutex m_output_flush_mutex
void HandleBreakpointEvent(const lldb::EventSP &event_sp)
void HandleProgressEvent(const lldb::EventSP &event_sp)
std::vector< llvm::sys::DynamicLibrary > LoadedPluginsList
DWIMPrintVerbosity
Enum to control the verbosity level of dwim-print execution.
static void ReportWarning(std::string message, std::optional< lldb::user_id_t > debugger_id=std::nullopt, std::once_flag *once=nullptr)
Report warning events.
bool SetUseExternalEditor(bool use_external_editor_p)
void HandleDiagnosticEvent(const lldb::EventSP &event_sp)
llvm::StringRef GetStopShowLineMarkerAnsiPrefix() const
llvm::StringRef GetShowProgressAnsiSuffix() const
A class that represents a running process on the host machine.
lldb::TargetSP GetSelectedTarget()
const FormatEntity::Entry * GetFrameFormatUnique() const
void RestoreInputTerminalState()
const FormatEntity::Entry * GetThreadStopFormat() const
PlatformList m_platform_list
lldb::FileSP m_input_file_sp
void StopIOHandlerThread()
void SetAsyncExecution(bool async)
static bool FormatDisassemblerAddress(const FormatEntity::Entry *format, const SymbolContext *sc, const SymbolContext *prev_sc, const ExecutionContext *exe_ctx, const Address *addr, Stream &s)
@ eBroadcastBitEventThreadIsListening
uint32_t GetStopSourceLineCount(bool before) const
lldb::TargetSP GetSelectedTarget()
lldb::BroadcasterManagerSP GetBroadcasterManager()
bool SetUseColor(bool use_color)
SourceManager::SourceFileCache & GetSourceFileCache()
lldb::thread_result_t IOHandlerThread()
bool SetPrintDecls(bool b)
std::unique_ptr< CommandInterpreter > m_command_interpreter_up
llvm::StringRef GetAutosuggestionAnsiPrefix() const
lldb::TargetSP m_dummy_target_sp
lldb::ListenerSP m_forward_listener_sp
llvm::StringRef GetPrompt() const
static void ReportError(std::string message, std::optional< lldb::user_id_t > debugger_id=std::nullopt, std::once_flag *once=nullptr)
Report error events.
void CancelForwardEvents(const lldb::ListenerSP &listener_sp)
StreamFile & GetErrorStream()
static void Destroy(lldb::DebuggerSP &debugger_sp)
bool HasIOHandlerThread()
Target & GetSelectedOrDummyTarget(bool prefer_dummy=false)
Status SetInputString(const char *data)
std::array< lldb::ScriptInterpreterSP, lldb::eScriptLanguageUnknown > m_script_interpreters
const FormatEntity::Entry * GetFrameFormat() const