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