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