1 //===-- CommandObjectExpression.h -------------------------------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
9 #ifndef liblldb_CommandObjectExpression_h_
10 #define liblldb_CommandObjectExpression_h_
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 {
21 class CommandObjectExpression : public CommandObjectRaw,
22 public IOHandlerDelegate {
24 class CommandOptions : public OptionGroup {
28 ~CommandOptions() override;
30 llvm::ArrayRef<OptionDefinition> GetDefinitions() override;
32 Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value,
33 ExecutionContext *execution_context) override;
35 void OptionParsingStarting(ExecutionContext *execution_context) override;
39 bool ignore_breakpoints;
46 lldb::LanguageType language;
47 LanguageRuntimeDescriptionDisplayVerbosity m_verbosity;
48 LazyBool auto_apply_fixits;
51 CommandObjectExpression(CommandInterpreter &interpreter);
53 ~CommandObjectExpression() override;
55 Options *GetOptions() override;
57 int HandleCompletion(CompletionRequest &request) override;
60 // IOHandler::Delegate functions
61 void IOHandlerInputComplete(IOHandler &io_handler,
62 std::string &line) override;
64 bool IOHandlerIsInputComplete(IOHandler &io_handler,
65 StringList &lines) override;
67 bool DoExecute(llvm::StringRef command, CommandReturnObject &result) override;
69 bool EvaluateExpression(llvm::StringRef expr, Stream *output_stream,
71 CommandReturnObject *result = nullptr);
73 void GetMultilineExpression();
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.
85 } // namespace lldb_private
87 #endif // liblldb_CommandObjectExpression_h_