blob: 312e9fe65125fba94c6aab0dbd5c39165170c795 [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[];
Sean Callanan863fab62016-03-28 21:20:05 +000057 bool top_level;
Jim Ingham399f1ca2010-11-05 19:25:48 +000058 bool unwind_on_error;
Jim Ingham184e9812013-01-15 02:47:48 +000059 bool ignore_breakpoints;
Chris Lattner30fdc8d2010-06-08 16:52:24 +000060 bool show_types;
61 bool show_summary;
Greg Clayton62afb9f2013-11-04 19:35:17 +000062 bool debug;
Jim Ingham35e1bda2012-10-16 21:41:58 +000063 uint32_t timeout;
64 bool try_all_threads;
Dawn Perchik15663c52015-07-25 00:19:39 +000065 lldb::LanguageType language;
Enrico Granata4d93b8c2013-09-30 19:11:51 +000066 LanguageRuntimeDescriptionDisplayVerbosity m_verbosity;
Jim Inghama1e541b2016-03-25 01:57:14 +000067 LazyBool auto_apply_fixits;
Chris Lattner30fdc8d2010-06-08 16:52:24 +000068 };
69
Greg Claytona7015092010-09-18 01:14:36 +000070 CommandObjectExpression (CommandInterpreter &interpreter);
Chris Lattner30fdc8d2010-06-08 16:52:24 +000071
Pavel Labath1fb7e202015-09-02 09:33:09 +000072 ~CommandObjectExpression() override;
Chris Lattner30fdc8d2010-06-08 16:52:24 +000073
Chris Lattner30fdc8d2010-06-08 16:52:24 +000074 Options *
Pavel Labath1fb7e202015-09-02 09:33:09 +000075 GetOptions() override;
Chris Lattner30fdc8d2010-06-08 16:52:24 +000076
Chris Lattner30fdc8d2010-06-08 16:52:24 +000077protected:
Greg Clayton44d93782014-01-27 23:43:24 +000078
79 //------------------------------------------------------------------
80 // IOHandler::Delegate functions
81 //------------------------------------------------------------------
Pavel Labath1fb7e202015-09-02 09:33:09 +000082 void
83 IOHandlerInputComplete(IOHandler &io_handler,
84 std::string &line) override;
Sean Callananf52c40c2016-05-09 21:13:27 +000085
86 bool
87 IOHandlerIsInputComplete (IOHandler &io_handler,
88 StringList &lines) override;
89
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
Jim Inghame5ee6f02016-03-29 22:00:08 +0000110 std::string m_fixed_expression; // Holds the current expression's fixed text.
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000111};
112
113} // namespace lldb_private
114
Pavel Labath1fb7e202015-09-02 09:33:09 +0000115#endif // liblldb_CommandObjectExpression_h_