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 #include "lldb/Core/IOHandler.h" 14 #include "lldb/Interpreter/CommandObject.h" 15 #include "lldb/Interpreter/OptionGroupBoolean.h" 16 #include "lldb/Interpreter/OptionGroupFormat.h" 17 #include "lldb/Interpreter/OptionGroupValueObjectDisplay.h" 18 #include "lldb/Target/ExecutionContext.h" 19 #include "lldb/lldb-private-enumerations.h" 20 namespace lldb_private { 21 22 class CommandObjectExpression : public CommandObjectRaw, 23 public IOHandlerDelegate { 24 public: 25 class CommandOptions : public OptionGroup { 26 public: 27 CommandOptions(); 28 29 ~CommandOptions() override; 30 31 llvm::ArrayRef<OptionDefinition> GetDefinitions() override; 32 33 Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, 34 ExecutionContext *execution_context) override; 35 36 void OptionParsingStarting(ExecutionContext *execution_context) override; 37 38 bool top_level; 39 bool unwind_on_error; 40 bool ignore_breakpoints; 41 bool allow_jit; 42 bool show_types; 43 bool show_summary; 44 bool debug; 45 uint32_t timeout; 46 bool try_all_threads; 47 lldb::LanguageType language; 48 LanguageRuntimeDescriptionDisplayVerbosity m_verbosity; 49 LazyBool auto_apply_fixits; 50 }; 51 52 CommandObjectExpression(CommandInterpreter &interpreter); 53 54 ~CommandObjectExpression() override; 55 56 Options *GetOptions() override; 57 58 int HandleCompletion(CompletionRequest &request) override; 59 60 protected: 61 //------------------------------------------------------------------ 62 // IOHandler::Delegate functions 63 //------------------------------------------------------------------ 64 void IOHandlerInputComplete(IOHandler &io_handler, 65 std::string &line) override; 66 67 bool IOHandlerIsInputComplete(IOHandler &io_handler, 68 StringList &lines) override; 69 70 bool DoExecute(llvm::StringRef command, CommandReturnObject &result) override; 71 72 bool EvaluateExpression(llvm::StringRef expr, Stream *output_stream, 73 Stream *error_stream, 74 CommandReturnObject *result = NULL); 75 76 void GetMultilineExpression(); 77 78 OptionGroupOptions m_option_group; 79 OptionGroupFormat m_format_options; 80 OptionGroupValueObjectDisplay m_varobj_options; 81 OptionGroupBoolean m_repl_option; 82 CommandOptions m_command_options; 83 uint32_t m_expr_line_count; 84 std::string m_expr_lines; // Multi-line expression support 85 std::string m_fixed_expression; // Holds the current expression's fixed text. 86 }; 87 88 } // namespace lldb_private 89 90 #endif // liblldb_CommandObjectExpression_h_ 91