diff options
Diffstat (limited to 'include/lldb/Interpreter/CommandInterpreter.h')
-rw-r--r-- | include/lldb/Interpreter/CommandInterpreter.h | 79 |
1 files changed, 59 insertions, 20 deletions
diff --git a/include/lldb/Interpreter/CommandInterpreter.h b/include/lldb/Interpreter/CommandInterpreter.h index 31fcc38eed9a..bcb9b5538c84 100644 --- a/include/lldb/Interpreter/CommandInterpreter.h +++ b/include/lldb/Interpreter/CommandInterpreter.h @@ -17,6 +17,7 @@ #include "lldb/lldb-private.h" #include "lldb/Core/Broadcaster.h" #include "lldb/Core/Debugger.h" +#include "lldb/Core/IOHandler.h" #include "lldb/Core/Log.h" #include "lldb/Interpreter/CommandHistory.h" #include "lldb/Interpreter/CommandObject.h" @@ -29,7 +30,8 @@ namespace lldb_private { class CommandInterpreter : public Broadcaster, - public Properties + public Properties, + public IOHandlerDelegate { public: typedef std::map<std::string, OptionArgVectorSP> OptionArgMap; @@ -213,10 +215,10 @@ public: void HandleCommandsFromFile (FileSpec &file, ExecutionContext *context, - bool stop_on_continue, - bool stop_on_error, - bool echo_commands, - bool print_results, + LazyBool stop_on_continue, + LazyBool stop_on_error, + LazyBool echo_commands, + LazyBool print_results, LazyBool add_to_history, CommandReturnObject &result); @@ -305,7 +307,8 @@ public: ExecutionContext GetExecutionContext() { - return m_exe_ctx_ref.Lock(); + const bool thread_and_frame_only_if_stopped = true; + return m_exe_ctx_ref.Lock(thread_and_frame_only_if_stopped); } void @@ -317,20 +320,12 @@ public: const char * ProcessEmbeddedScriptCommands (const char *arg); - const char * - GetPrompt (); - void - SetPrompt (const char *); - - bool Confirm (const char *message, bool default_answer); + UpdatePrompt (const char *); - static size_t - GetConfirmationInputReaderCallback (void *baton, - InputReader &reader, - lldb::InputReaderAction action, - const char *bytes, - size_t bytes_len); + bool + Confirm (const char *message, + bool default_answer); void LoadCommandDictionary (); @@ -395,8 +390,12 @@ public: bool GetBatchCommandMode () { return m_batch_command_mode; } - void - SetBatchCommandMode (bool value) { m_batch_command_mode = value; } + bool + SetBatchCommandMode (bool value) { + const bool old_value = m_batch_command_mode; + m_batch_command_mode = value; + return old_value; + } void ChildrenTruncated () @@ -435,6 +434,25 @@ public: return m_command_history; } + bool + IsActive (); + + void + RunCommandInterpreter (bool auto_handle_events, + bool spawn_thread); + + void + GetLLDBCommandsFromIOHandler (const char *prompt, + IOHandlerDelegate &delegate, + bool asynchronously, + void *baton); + + void + GetPythonCommandsFromIOHandler (const char *prompt, + IOHandlerDelegate &delegate, + bool asynchronously, + void *baton); + //------------------------------------------------------------------ // Properties //------------------------------------------------------------------ @@ -450,12 +468,31 @@ public: protected: friend class Debugger; + //------------------------------------------------------------------ + // IOHandlerDelegate functions + //------------------------------------------------------------------ + virtual void + IOHandlerInputComplete (IOHandler &io_handler, + std::string &line); + + virtual ConstString + GetControlSequence (char ch) + { + if (ch == 'd') + return ConstString("quit\n"); + return ConstString(); + } + + size_t + GetProcessOutput (); + void SetSynchronous (bool value); lldb::CommandObjectSP GetCommandSP (const char *cmd, bool include_aliases = true, bool exact = true, StringList *matches = NULL); + private: Error @@ -473,10 +510,12 @@ private: CommandHistory m_command_history; std::string m_repeat_command; // Stores the command that will be executed for an empty command string. std::unique_ptr<ScriptInterpreter> m_script_interpreter_ap; + lldb::IOHandlerSP m_command_io_handler_sp; char m_comment_char; bool m_batch_command_mode; ChildrenTruncatedWarningStatus m_truncation_warning; // Whether we truncated children and whether the user has been told uint32_t m_command_source_depth; + std::vector<uint32_t> m_command_source_flags; }; |