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