blob: 9bd0497d27e4fb23c8b7e021a657c86fcc481616 [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
Jim Inghama1e541b2016-03-25 01:57:14 +000017#include "lldb/lldb-private-enumerations.h"
Greg Clayton44d93782014-01-27 23:43:24 +000018#include "lldb/Core/IOHandler.h"
Chris Lattner30fdc8d2010-06-08 16:52:24 +000019#include "lldb/Interpreter/CommandObject.h"
Sean Callananf2bd5c32015-10-20 00:55:21 +000020#include "lldb/Interpreter/OptionGroupBoolean.h"
Greg Clayton1deb7962011-10-25 06:44:01 +000021#include "lldb/Interpreter/OptionGroupFormat.h"
Enrico Granatab576bba2013-01-09 20:12:53 +000022#include "lldb/Interpreter/OptionGroupValueObjectDisplay.h"
Chris Lattner30fdc8d2010-06-08 16:52:24 +000023#include "lldb/Target/ExecutionContext.h"
Chris Lattner30fdc8d2010-06-08 16:52:24 +000024namespace 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;
Jim Inghama1e541b2016-03-25 01:57:14 +000066 LazyBool auto_apply_fixits;
Chris Lattner30fdc8d2010-06-08 16:52:24 +000067 };
68
Greg Claytona7015092010-09-18 01:14:36 +000069 CommandObjectExpression (CommandInterpreter &interpreter);
Chris Lattner30fdc8d2010-06-08 16:52:24 +000070
Pavel Labath1fb7e202015-09-02 09:33:09 +000071 ~CommandObjectExpression() override;
Chris Lattner30fdc8d2010-06-08 16:52:24 +000072
Chris Lattner30fdc8d2010-06-08 16:52:24 +000073 Options *
Pavel Labath1fb7e202015-09-02 09:33:09 +000074 GetOptions() override;
Chris Lattner30fdc8d2010-06-08 16:52:24 +000075
Chris Lattner30fdc8d2010-06-08 16:52:24 +000076protected:
Greg Clayton44d93782014-01-27 23:43:24 +000077
78 //------------------------------------------------------------------
79 // IOHandler::Delegate functions
80 //------------------------------------------------------------------
Pavel Labath1fb7e202015-09-02 09:33:09 +000081 void
82 IOHandlerInputComplete(IOHandler &io_handler,
83 std::string &line) override;
Greg Clayton44d93782014-01-27 23:43:24 +000084
85 virtual LineStatus
86 IOHandlerLinesUpdated (IOHandler &io_handler,
87 StringList &lines,
88 uint32_t line_idx,
89 Error &error);
Pavel Labath1fb7e202015-09-02 09:33:09 +000090 bool
91 DoExecute(const char *command,
92 CommandReturnObject &result) override;
Chris Lattner30fdc8d2010-06-08 16:52:24 +000093
Chris Lattner30fdc8d2010-06-08 16:52:24 +000094 bool
Johnny Chenfcd43b72010-08-13 00:42:30 +000095 EvaluateExpression (const char *expr,
Caroline Tice6e8dc332011-06-13 20:20:29 +000096 Stream *output_stream,
97 Stream *error_stream,
Johnny Chenfcd43b72010-08-13 00:42:30 +000098 CommandReturnObject *result = NULL);
Greg Claytoncf28a8b2014-03-13 23:42:30 +000099
100 void
101 GetMultilineExpression ();
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000102
Greg Clayton1deb7962011-10-25 06:44:01 +0000103 OptionGroupOptions m_option_group;
104 OptionGroupFormat m_format_options;
Enrico Granatab576bba2013-01-09 20:12:53 +0000105 OptionGroupValueObjectDisplay m_varobj_options;
Sean Callananf2bd5c32015-10-20 00:55:21 +0000106 OptionGroupBoolean m_repl_option;
Greg Clayton1deb7962011-10-25 06:44:01 +0000107 CommandOptions m_command_options;
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000108 uint32_t m_expr_line_count;
109 std::string m_expr_lines; // Multi-line expression support
110};
111
112} // namespace lldb_private
113
Pavel Labath1fb7e202015-09-02 09:33:09 +0000114#endif // liblldb_CommandObjectExpression_h_