1 //===-- CommandObjectExpression.h -------------------------------*- C++ -*-===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 #ifndef liblldb_CommandObjectExpression_h_ 11 #define liblldb_CommandObjectExpression_h_ 12 13 // C Includes 14 // C++ Includes 15 // Other libraries and framework includes 16 // Project includes 17 #include "lldb/Core/IOHandler.h" 18 #include "lldb/Interpreter/CommandObject.h" 19 #include "lldb/Interpreter/OptionGroupBoolean.h" 20 #include "lldb/Interpreter/OptionGroupFormat.h" 21 #include "lldb/Interpreter/OptionGroupValueObjectDisplay.h" 22 #include "lldb/Target/ExecutionContext.h" 23 #include "lldb/lldb-private-enumerations.h" 24 namespace lldb_private { 25 26 class CommandObjectExpression : public CommandObjectRaw, 27 public IOHandlerDelegate { 28 public: 29 class CommandOptions : public OptionGroup { 30 public: 31 CommandOptions(); 32 33 ~CommandOptions() override; 34 35 llvm::ArrayRef<OptionDefinition> GetDefinitions() override; 36 37 Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, 38 ExecutionContext *execution_context) override; 39 Error SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete; 40 41 void OptionParsingStarting(ExecutionContext *execution_context) override; 42 43 // Options table: Required for subclasses of Options. 44 45 static OptionDefinition g_option_table[]; 46 bool top_level; 47 bool unwind_on_error; 48 bool ignore_breakpoints; 49 bool allow_jit; 50 bool show_types; 51 bool show_summary; 52 bool debug; 53 uint32_t timeout; 54 bool try_all_threads; 55 lldb::LanguageType language; 56 LanguageRuntimeDescriptionDisplayVerbosity m_verbosity; 57 LazyBool auto_apply_fixits; 58 }; 59 60 CommandObjectExpression(CommandInterpreter &interpreter); 61 62 ~CommandObjectExpression() override; 63 64 Options *GetOptions() override; 65 66 protected: 67 //------------------------------------------------------------------ 68 // IOHandler::Delegate functions 69 //------------------------------------------------------------------ 70 void IOHandlerInputComplete(IOHandler &io_handler, 71 std::string &line) override; 72 73 bool IOHandlerIsInputComplete(IOHandler &io_handler, 74 StringList &lines) override; 75 76 bool DoExecute(const char *command, CommandReturnObject &result) override; 77 78 bool EvaluateExpression(const char *expr, Stream *output_stream, 79 Stream *error_stream, 80 CommandReturnObject *result = NULL); 81 82 void GetMultilineExpression(); 83 84 OptionGroupOptions m_option_group; 85 OptionGroupFormat m_format_options; 86 OptionGroupValueObjectDisplay m_varobj_options; 87 OptionGroupBoolean m_repl_option; 88 CommandOptions m_command_options; 89 uint32_t m_expr_line_count; 90 std::string m_expr_lines; // Multi-line expression support 91 std::string m_fixed_expression; // Holds the current expression's fixed text. 92 }; 93 94 } // namespace lldb_private 95 96 #endif // liblldb_CommandObjectExpression_h_ 97