blob: 71eb9bf8ea11a21f8441135b02159c926c2bc71c [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
Greg Claytonf15996e2011-04-07 22:46:35 +000032 CommandOptions (CommandInterpreter &interpreter);
Chris Lattner24943d22010-06-08 16:52:24 +000033
34 virtual
35 ~CommandOptions ();
36
37 virtual Error
Greg Clayton143fcc32011-04-13 00:18:08 +000038 SetOptionValue (uint32_t option_idx, const char *option_arg);
Chris Lattner24943d22010-06-08 16:52:24 +000039
40 void
Greg Clayton143fcc32011-04-13 00:18:08 +000041 OptionParsingStarting ();
Chris Lattner24943d22010-06-08 16:52:24 +000042
Greg Claytonb3448432011-03-24 21:19:54 +000043 const OptionDefinition*
Chris Lattner24943d22010-06-08 16:52:24 +000044 GetDefinitions ();
45
46 // Options table: Required for subclasses of Options.
47
Greg Claytonb3448432011-03-24 21:19:54 +000048 static 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;
Jim Ingham324067b2010-09-30 00:54:27 +000053 bool print_object;
Jim Inghame41494a2011-04-16 00:01:13 +000054 LazyBool use_dynamic;
Jim Inghamea9d4262010-11-05 19:25:48 +000055 bool unwind_on_error;
Chris Lattner24943d22010-06-08 16:52:24 +000056 bool show_types;
57 bool show_summary;
58 };
59
Greg Clayton238c0a12010-09-18 01:14:36 +000060 CommandObjectExpression (CommandInterpreter &interpreter);
Chris Lattner24943d22010-06-08 16:52:24 +000061
62 virtual
63 ~CommandObjectExpression ();
64
65 virtual
66 Options *
67 GetOptions ();
68
69
70 virtual bool
Greg Clayton238c0a12010-09-18 01:14:36 +000071 Execute (Args& command,
Chris Lattner24943d22010-06-08 16:52:24 +000072 CommandReturnObject &result);
73
74 virtual bool
75 WantsRawCommandString() { return true; }
76
77 virtual bool
Greg Clayton238c0a12010-09-18 01:14:36 +000078 ExecuteRawCommandString (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
Johnny Chen0deefc72010-08-13 00:42:30 +000091 EvaluateExpression (const char *expr,
Johnny Chen0deefc72010-08-13 00:42:30 +000092 Stream &output_stream,
93 Stream &error_stream,
94 CommandReturnObject *result = NULL);
Chris Lattner24943d22010-06-08 16:52:24 +000095
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_