blob: 4aed304a793766419f1f28ae36e2a6612a725b58 [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[];
Caroline Ticec1ad82e2010-09-07 22:38:08 +000049 //Language language;
Chris Lattner24943d22010-06-08 16:52:24 +000050 lldb::Encoding encoding;
51 lldb::Format format;
52 bool debug;
53 bool show_types;
54 bool show_summary;
55 };
56
Greg Clayton238c0a12010-09-18 01:14:36 +000057 CommandObjectExpression (CommandInterpreter &interpreter);
Chris Lattner24943d22010-06-08 16:52:24 +000058
59 virtual
60 ~CommandObjectExpression ();
61
62 virtual
63 Options *
64 GetOptions ();
65
66
67 virtual bool
Greg Clayton238c0a12010-09-18 01:14:36 +000068 Execute (Args& command,
Chris Lattner24943d22010-06-08 16:52:24 +000069 CommandReturnObject &result);
70
71 virtual bool
72 WantsRawCommandString() { return true; }
73
74 virtual bool
Greg Clayton238c0a12010-09-18 01:14:36 +000075 ExecuteRawCommandString (const char *command,
Chris Lattner24943d22010-06-08 16:52:24 +000076 CommandReturnObject &result);
77
78protected:
79
80 static size_t
81 MultiLineExpressionCallback (void *baton,
Greg Clayton63094e02010-06-23 01:19:29 +000082 InputReader &reader,
Chris Lattner24943d22010-06-08 16:52:24 +000083 lldb::InputReaderAction notification,
84 const char *bytes,
85 size_t bytes_len);
86
87 bool
Johnny Chen0deefc72010-08-13 00:42:30 +000088 EvaluateExpression (const char *expr,
Chris Lattner24943d22010-06-08 16:52:24 +000089 bool bare,
Johnny Chen0deefc72010-08-13 00:42:30 +000090 Stream &output_stream,
91 Stream &error_stream,
92 CommandReturnObject *result = NULL);
Chris Lattner24943d22010-06-08 16:52:24 +000093
94 CommandOptions m_options;
95 ExecutionContext m_exe_ctx;
96 uint32_t m_expr_line_count;
97 std::string m_expr_lines; // Multi-line expression support
98};
99
100} // namespace lldb_private
101
102#endif // liblldb_CommandObjectExpression_h_