blob: 7aacc922f0c7a1048f4c218991057b67d7666b57 [file] [log] [blame]
Chris Lattner30fdc8d2010-06-08 16:52:24 +00001//===-- 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
Greg Clayton44d93782014-01-27 23:43:24 +000017#include "lldb/Core/IOHandler.h"
Chris Lattner30fdc8d2010-06-08 16:52:24 +000018#include "lldb/Interpreter/CommandObject.h"
Sean Callananf2bd5c32015-10-20 00:55:21 +000019#include "lldb/Interpreter/OptionGroupBoolean.h"
Greg Clayton1deb7962011-10-25 06:44:01 +000020#include "lldb/Interpreter/OptionGroupFormat.h"
Enrico Granatab576bba2013-01-09 20:12:53 +000021#include "lldb/Interpreter/OptionGroupValueObjectDisplay.h"
Chris Lattner30fdc8d2010-06-08 16:52:24 +000022#include "lldb/Target/ExecutionContext.h"
Kate Stoneb9c1b512016-09-06 20:57:50 +000023#include "lldb/lldb-private-enumerations.h"
Chris Lattner30fdc8d2010-06-08 16:52:24 +000024namespace lldb_private {
25
Kate Stoneb9c1b512016-09-06 20:57:50 +000026class CommandObjectExpression : public CommandObjectRaw,
27 public IOHandlerDelegate {
Chris Lattner30fdc8d2010-06-08 16:52:24 +000028public:
Kate Stoneb9c1b512016-09-06 20:57:50 +000029 class CommandOptions : public OptionGroup {
30 public:
31 CommandOptions();
Chris Lattner30fdc8d2010-06-08 16:52:24 +000032
Kate Stoneb9c1b512016-09-06 20:57:50 +000033 ~CommandOptions() override;
Chris Lattner30fdc8d2010-06-08 16:52:24 +000034
Zachary Turner1f0f5b52016-09-22 20:22:55 +000035 llvm::ArrayRef<OptionDefinition> GetDefinitions() override;
Chris Lattner30fdc8d2010-06-08 16:52:24 +000036
Zachary Turner8cef4b02016-09-23 17:48:13 +000037 Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_value,
Kate Stoneb9c1b512016-09-06 20:57:50 +000038 ExecutionContext *execution_context) override;
Zachary Turner8cef4b02016-09-23 17:48:13 +000039 Error SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete;
Chris Lattner30fdc8d2010-06-08 16:52:24 +000040
Kate Stoneb9c1b512016-09-06 20:57:50 +000041 void OptionParsingStarting(ExecutionContext *execution_context) override;
Chris Lattner30fdc8d2010-06-08 16:52:24 +000042
Kate Stoneb9c1b512016-09-06 20:57:50 +000043 // Options table: Required for subclasses of Options.
Chris Lattner30fdc8d2010-06-08 16:52:24 +000044
Kate Stoneb9c1b512016-09-06 20:57:50 +000045 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 };
Chris Lattner30fdc8d2010-06-08 16:52:24 +000059
Kate Stoneb9c1b512016-09-06 20:57:50 +000060 CommandObjectExpression(CommandInterpreter &interpreter);
Chris Lattner30fdc8d2010-06-08 16:52:24 +000061
Kate Stoneb9c1b512016-09-06 20:57:50 +000062 ~CommandObjectExpression() override;
63
64 Options *GetOptions() override;
Chris Lattner30fdc8d2010-06-08 16:52:24 +000065
Chris Lattner30fdc8d2010-06-08 16:52:24 +000066protected:
Kate Stoneb9c1b512016-09-06 20:57:50 +000067 //------------------------------------------------------------------
68 // IOHandler::Delegate functions
69 //------------------------------------------------------------------
70 void IOHandlerInputComplete(IOHandler &io_handler,
71 std::string &line) override;
Chris Lattner30fdc8d2010-06-08 16:52:24 +000072
Kate Stoneb9c1b512016-09-06 20:57:50 +000073 bool IOHandlerIsInputComplete(IOHandler &io_handler,
74 StringList &lines) override;
Chris Lattner30fdc8d2010-06-08 16:52:24 +000075
Kate Stoneb9c1b512016-09-06 20:57:50 +000076 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.
Chris Lattner30fdc8d2010-06-08 16:52:24 +000092};
93
94} // namespace lldb_private
95
Pavel Labath1fb7e202015-09-02 09:33:09 +000096#endif // liblldb_CommandObjectExpression_h_