blob: 7103675f3992451db0abd596acc84f6357dc4c7f [file] [log] [blame]
Chris Lattner30fdc8d2010-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
Greg Clayton44d93782014-01-27 23:43:24 +000017#include "lldb/Core/IOHandler.h"
Chris Lattner30fdc8d2010-06-08 16:52:24 +000018#include "lldb/Interpreter/CommandObject.h"
Sean Callananf2bd5c32015-10-20 00:55:21 +000019#include "lldb/Interpreter/OptionGroupBoolean.h"
Greg Clayton1deb7962011-10-25 06:44:01 +000020#include "lldb/Interpreter/OptionGroupFormat.h"
Enrico Granatab576bba2013-01-09 20:12:53 +000021#include "lldb/Interpreter/OptionGroupValueObjectDisplay.h"
Chris Lattner30fdc8d2010-06-08 16:52:24 +000022#include "lldb/Target/ExecutionContext.h"
23
24namespace lldb_private {
25
Greg Clayton44d93782014-01-27 23:43:24 +000026class CommandObjectExpression :
27 public CommandObjectRaw,
28 public IOHandlerDelegate
Chris Lattner30fdc8d2010-06-08 16:52:24 +000029{
30public:
31
Greg Clayton1deb7962011-10-25 06:44:01 +000032 class CommandOptions : public OptionGroup
Chris Lattner30fdc8d2010-06-08 16:52:24 +000033 {
34 public:
35
Greg Clayton1deb7962011-10-25 06:44:01 +000036 CommandOptions ();
Chris Lattner30fdc8d2010-06-08 16:52:24 +000037
Pavel Labath1fb7e202015-09-02 09:33:09 +000038 ~CommandOptions() override;
Chris Lattner30fdc8d2010-06-08 16:52:24 +000039
Pavel Labath1fb7e202015-09-02 09:33:09 +000040 uint32_t
41 GetNumDefinitions() override;
Greg Clayton1deb7962011-10-25 06:44:01 +000042
Pavel Labath1fb7e202015-09-02 09:33:09 +000043 const OptionDefinition*
44 GetDefinitions() override;
Greg Clayton1deb7962011-10-25 06:44:01 +000045
Pavel Labath1fb7e202015-09-02 09:33:09 +000046 Error
47 SetOptionValue(CommandInterpreter &interpreter,
48 uint32_t option_idx,
49 const char *option_value) override;
Greg Clayton1deb7962011-10-25 06:44:01 +000050
Pavel Labath1fb7e202015-09-02 09:33:09 +000051 void
52 OptionParsingStarting(CommandInterpreter &interpreter) override;
Chris Lattner30fdc8d2010-06-08 16:52:24 +000053
54 // Options table: Required for subclasses of Options.
55
Greg Claytone0d378b2011-03-24 21:19:54 +000056 static OptionDefinition g_option_table[];
Jim Ingham399f1ca2010-11-05 19:25:48 +000057 bool unwind_on_error;
Jim Ingham184e9812013-01-15 02:47:48 +000058 bool ignore_breakpoints;
Chris Lattner30fdc8d2010-06-08 16:52:24 +000059 bool show_types;
60 bool show_summary;
Greg Clayton62afb9f2013-11-04 19:35:17 +000061 bool debug;
Jim Ingham35e1bda2012-10-16 21:41:58 +000062 uint32_t timeout;
63 bool try_all_threads;
Dawn Perchik15663c52015-07-25 00:19:39 +000064 lldb::LanguageType language;
Enrico Granata4d93b8c2013-09-30 19:11:51 +000065 LanguageRuntimeDescriptionDisplayVerbosity m_verbosity;
Chris Lattner30fdc8d2010-06-08 16:52:24 +000066 };
67
Greg Claytona7015092010-09-18 01:14:36 +000068 CommandObjectExpression (CommandInterpreter &interpreter);
Chris Lattner30fdc8d2010-06-08 16:52:24 +000069
Pavel Labath1fb7e202015-09-02 09:33:09 +000070 ~CommandObjectExpression() override;
Chris Lattner30fdc8d2010-06-08 16:52:24 +000071
Chris Lattner30fdc8d2010-06-08 16:52:24 +000072 Options *
Pavel Labath1fb7e202015-09-02 09:33:09 +000073 GetOptions() override;
Chris Lattner30fdc8d2010-06-08 16:52:24 +000074
Chris Lattner30fdc8d2010-06-08 16:52:24 +000075protected:
Greg Clayton44d93782014-01-27 23:43:24 +000076
77 //------------------------------------------------------------------
78 // IOHandler::Delegate functions
79 //------------------------------------------------------------------
Pavel Labath1fb7e202015-09-02 09:33:09 +000080 void
81 IOHandlerInputComplete(IOHandler &io_handler,
82 std::string &line) override;
Greg Clayton44d93782014-01-27 23:43:24 +000083
84 virtual LineStatus
85 IOHandlerLinesUpdated (IOHandler &io_handler,
86 StringList &lines,
87 uint32_t line_idx,
88 Error &error);
Pavel Labath1fb7e202015-09-02 09:33:09 +000089 bool
90 DoExecute(const char *command,
91 CommandReturnObject &result) override;
Chris Lattner30fdc8d2010-06-08 16:52:24 +000092
Chris Lattner30fdc8d2010-06-08 16:52:24 +000093 bool
Johnny Chenfcd43b72010-08-13 00:42:30 +000094 EvaluateExpression (const char *expr,
Caroline Tice6e8dc332011-06-13 20:20:29 +000095 Stream *output_stream,
96 Stream *error_stream,
Johnny Chenfcd43b72010-08-13 00:42:30 +000097 CommandReturnObject *result = NULL);
Greg Claytoncf28a8b2014-03-13 23:42:30 +000098
99 void
100 GetMultilineExpression ();
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000101
Greg Clayton1deb7962011-10-25 06:44:01 +0000102 OptionGroupOptions m_option_group;
103 OptionGroupFormat m_format_options;
Enrico Granatab576bba2013-01-09 20:12:53 +0000104 OptionGroupValueObjectDisplay m_varobj_options;
Sean Callananf2bd5c32015-10-20 00:55:21 +0000105 OptionGroupBoolean m_repl_option;
Greg Clayton1deb7962011-10-25 06:44:01 +0000106 CommandOptions m_command_options;
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000107 uint32_t m_expr_line_count;
108 std::string m_expr_lines; // Multi-line expression support
109};
110
111} // namespace lldb_private
112
Pavel Labath1fb7e202015-09-02 09:33:09 +0000113#endif // liblldb_CommandObjectExpression_h_