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