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/Interpreter/CommandObject.h"
18 #include "lldb/Interpreter/OptionGroupFormat.h"
19 #include "lldb/Target/ExecutionContext.h"
20 
21 namespace lldb_private {
22 
23 class CommandObjectExpression : public CommandObject
24 {
25 public:
26 
27     class CommandOptions : public OptionGroup
28     {
29     public:
30 
31         CommandOptions ();
32 
33         virtual
34         ~CommandOptions ();
35 
36         virtual uint32_t
37         GetNumDefinitions ();
38 
39         virtual const OptionDefinition*
40         GetDefinitions ();
41 
42         virtual Error
43         SetOptionValue (CommandInterpreter &interpreter,
44                         uint32_t option_idx,
45                         const char *option_value);
46 
47         virtual void
48         OptionParsingStarting (CommandInterpreter &interpreter);
49 
50         // Options table: Required for subclasses of Options.
51 
52         static OptionDefinition g_option_table[];
53         bool        print_object;
54         LazyBool    use_dynamic;
55         bool        unwind_on_error;
56         bool        show_types;
57         bool        show_summary;
58     };
59 
60     CommandObjectExpression (CommandInterpreter &interpreter);
61 
62     virtual
63     ~CommandObjectExpression ();
64 
65     virtual
66     Options *
67     GetOptions ();
68 
69 
70     virtual bool
71     Execute (Args& command,
72              CommandReturnObject &result);
73 
74     virtual bool
75     WantsRawCommandString() { return true; }
76 
77     virtual bool
78     ExecuteRawCommandString (const char *command,
79                              CommandReturnObject &result);
80 
81 protected:
82 
83     static size_t
84     MultiLineExpressionCallback (void *baton,
85                                  InputReader &reader,
86                                  lldb::InputReaderAction notification,
87                                  const char *bytes,
88                                  size_t bytes_len);
89 
90     bool
91     EvaluateExpression (const char *expr,
92                         Stream *output_stream,
93                         Stream *error_stream,
94                         CommandReturnObject *result = NULL);
95 
96     OptionGroupOptions m_option_group;
97     OptionGroupFormat m_format_options;
98     CommandOptions m_command_options;
99     ExecutionContext m_exe_ctx;
100     uint32_t m_expr_line_count;
101     std::string m_expr_lines; // Multi-line expression support
102 };
103 
104 } // namespace lldb_private
105 
106 #endif  // liblldb_CommandObjectExpression_h_
107