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/OptionGroupFormat.h"
20 #include "lldb/Interpreter/OptionGroupValueObjectDisplay.h"
21 #include "lldb/Target/ExecutionContext.h"
22 
23 namespace lldb_private {
24 
25 class CommandObjectExpression :
26     public CommandObjectRaw,
27     public IOHandlerDelegate
28 {
29 public:
30 
31     class CommandOptions : public OptionGroup
32     {
33     public:
34 
35         CommandOptions ();
36 
37         ~CommandOptions() override;
38 
39         uint32_t
40         GetNumDefinitions() override;
41 
42         const OptionDefinition*
43         GetDefinitions() override;
44 
45         Error
46         SetOptionValue(CommandInterpreter &interpreter,
47 		       uint32_t option_idx,
48 		       const char *option_value) override;
49 
50         void
51         OptionParsingStarting(CommandInterpreter &interpreter) override;
52 
53         // Options table: Required for subclasses of Options.
54 
55         static OptionDefinition g_option_table[];
56         bool        unwind_on_error;
57         bool        ignore_breakpoints;
58         bool        show_types;
59         bool        show_summary;
60         bool        debug;
61         uint32_t    timeout;
62         bool        try_all_threads;
63         lldb::LanguageType language;
64         LanguageRuntimeDescriptionDisplayVerbosity m_verbosity;
65     };
66 
67     CommandObjectExpression (CommandInterpreter &interpreter);
68 
69     ~CommandObjectExpression() override;
70 
71     Options *
72     GetOptions() override;
73 
74 protected:
75 
76     //------------------------------------------------------------------
77     // IOHandler::Delegate functions
78     //------------------------------------------------------------------
79     void
80     IOHandlerInputComplete(IOHandler &io_handler,
81 			   std::string &line) override;
82 
83     virtual LineStatus
84     IOHandlerLinesUpdated (IOHandler &io_handler,
85                            StringList &lines,
86                            uint32_t line_idx,
87                            Error &error);
88     bool
89     DoExecute(const char *command,
90 	      CommandReturnObject &result) override;
91 
92     bool
93     EvaluateExpression (const char *expr,
94                         Stream *output_stream,
95                         Stream *error_stream,
96                         CommandReturnObject *result = NULL);
97 
98     void
99     GetMultilineExpression ();
100 
101     OptionGroupOptions m_option_group;
102     OptionGroupFormat m_format_options;
103     OptionGroupValueObjectDisplay m_varobj_options;
104     CommandOptions m_command_options;
105     uint32_t m_expr_line_count;
106     std::string m_expr_lines; // Multi-line expression support
107 };
108 
109 } // namespace lldb_private
110 
111 #endif // liblldb_CommandObjectExpression_h_
112