blob: 79a1c4f3501492fecaab5cbf0de277430887292a [file] [log] [blame]
Chris Lattner24943d22010-06-08 16:52:24 +00001//===-- 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"
Jim Ingham84cdc152010-06-15 19:49:27 +000018#include "lldb/Interpreter/Options.h"
Chris Lattner24943d22010-06-08 16:52:24 +000019#include "lldb/Core/Language.h"
20#include "lldb/Target/ExecutionContext.h"
21
22namespace lldb_private {
23
24class CommandObjectExpression : public CommandObject
25{
26public:
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 show_types;
54 bool show_summary;
Sean Callanan848960c2010-06-23 23:18:04 +000055 bool use_ir;
Chris Lattner24943d22010-06-08 16:52:24 +000056 };
57
58 CommandObjectExpression ();
59
60 virtual
61 ~CommandObjectExpression ();
62
63 virtual
64 Options *
65 GetOptions ();
66
67
68 virtual bool
Greg Clayton63094e02010-06-23 01:19:29 +000069 Execute (CommandInterpreter &interpreter,
70 Args& command,
Chris Lattner24943d22010-06-08 16:52:24 +000071 CommandReturnObject &result);
72
73 virtual bool
74 WantsRawCommandString() { return true; }
75
76 virtual bool
Greg Clayton63094e02010-06-23 01:19:29 +000077 ExecuteRawCommandString (CommandInterpreter &interpreter,
78 const char *command,
Chris Lattner24943d22010-06-08 16:52:24 +000079 CommandReturnObject &result);
80
81protected:
82
83 static size_t
84 MultiLineExpressionCallback (void *baton,
Greg Clayton63094e02010-06-23 01:19:29 +000085 InputReader &reader,
Chris Lattner24943d22010-06-08 16:52:24 +000086 lldb::InputReaderAction notification,
87 const char *bytes,
88 size_t bytes_len);
89
90 bool
91 EvaluateExpression (const char *expr,
92 bool bare,
93 Stream &output_stream,
94 Stream &error_stream);
95
96 CommandOptions m_options;
97 ExecutionContext m_exe_ctx;
98 uint32_t m_expr_line_count;
99 std::string m_expr_lines; // Multi-line expression support
100};
101
102} // namespace lldb_private
103
104#endif // liblldb_CommandObjectExpression_h_