Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 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" |
Greg Clayton | a42880a | 2011-10-25 06:44:01 +0000 | [diff] [blame] | 18 | #include "lldb/Interpreter/OptionGroupFormat.h" |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 19 | #include "lldb/Target/ExecutionContext.h" |
| 20 | |
| 21 | namespace lldb_private { |
| 22 | |
Jim Ingham | da26bd2 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 23 | class CommandObjectExpression : public CommandObjectRaw |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 24 | { |
| 25 | public: |
| 26 | |
Greg Clayton | a42880a | 2011-10-25 06:44:01 +0000 | [diff] [blame] | 27 | class CommandOptions : public OptionGroup |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 28 | { |
| 29 | public: |
| 30 | |
Greg Clayton | a42880a | 2011-10-25 06:44:01 +0000 | [diff] [blame] | 31 | CommandOptions (); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 32 | |
| 33 | virtual |
| 34 | ~CommandOptions (); |
| 35 | |
Greg Clayton | a42880a | 2011-10-25 06:44:01 +0000 | [diff] [blame] | 36 | virtual uint32_t |
| 37 | GetNumDefinitions (); |
| 38 | |
| 39 | virtual const OptionDefinition* |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 40 | GetDefinitions (); |
Greg Clayton | a42880a | 2011-10-25 06:44:01 +0000 | [diff] [blame] | 41 | |
| 42 | virtual Error |
| 43 | SetOptionValue (CommandInterpreter &interpreter, |
| 44 | uint32_t option_idx, |
| 45 | const char *option_value); |
| 46 | |
| 47 | virtual void |
| 48 | OptionParsingStarting (CommandInterpreter &interpreter); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 49 | |
| 50 | // Options table: Required for subclasses of Options. |
| 51 | |
Greg Clayton | b344843 | 2011-03-24 21:19:54 +0000 | [diff] [blame] | 52 | static OptionDefinition g_option_table[]; |
Jim Ingham | 324067b | 2010-09-30 00:54:27 +0000 | [diff] [blame] | 53 | bool print_object; |
Jim Ingham | e41494a | 2011-04-16 00:01:13 +0000 | [diff] [blame] | 54 | LazyBool use_dynamic; |
Jim Ingham | ea9d426 | 2010-11-05 19:25:48 +0000 | [diff] [blame] | 55 | bool unwind_on_error; |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 56 | bool show_types; |
| 57 | bool show_summary; |
| 58 | }; |
| 59 | |
Greg Clayton | 238c0a1 | 2010-09-18 01:14:36 +0000 | [diff] [blame] | 60 | CommandObjectExpression (CommandInterpreter &interpreter); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 61 | |
| 62 | virtual |
| 63 | ~CommandObjectExpression (); |
| 64 | |
| 65 | virtual |
| 66 | Options * |
| 67 | GetOptions (); |
| 68 | |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 69 | protected: |
Jim Ingham | da26bd2 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 70 | virtual bool |
| 71 | DoExecute (const char *command, |
| 72 | CommandReturnObject &result); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 73 | |
| 74 | static size_t |
| 75 | MultiLineExpressionCallback (void *baton, |
Greg Clayton | 63094e0 | 2010-06-23 01:19:29 +0000 | [diff] [blame] | 76 | InputReader &reader, |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 77 | lldb::InputReaderAction notification, |
| 78 | const char *bytes, |
| 79 | size_t bytes_len); |
| 80 | |
| 81 | bool |
Johnny Chen | 0deefc7 | 2010-08-13 00:42:30 +0000 | [diff] [blame] | 82 | EvaluateExpression (const char *expr, |
Caroline Tice | 87e1f77 | 2011-06-13 20:20:29 +0000 | [diff] [blame] | 83 | Stream *output_stream, |
| 84 | Stream *error_stream, |
Johnny Chen | 0deefc7 | 2010-08-13 00:42:30 +0000 | [diff] [blame] | 85 | CommandReturnObject *result = NULL); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 86 | |
Greg Clayton | a42880a | 2011-10-25 06:44:01 +0000 | [diff] [blame] | 87 | OptionGroupOptions m_option_group; |
| 88 | OptionGroupFormat m_format_options; |
| 89 | CommandOptions m_command_options; |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 90 | uint32_t m_expr_line_count; |
| 91 | std::string m_expr_lines; // Multi-line expression support |
| 92 | }; |
| 93 | |
| 94 | } // namespace lldb_private |
| 95 | |
| 96 | #endif // liblldb_CommandObjectExpression_h_ |