blob: 9e6278351d185de4cd6a087bd969ef86292e0e62 [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
Todd Fialae1cfbc72016-08-11 23:51:28 +000047 SetOptionValue(uint32_t option_idx,
48 const char *option_value,
49 ExecutionContext *execution_context) override;
Greg Clayton1deb7962011-10-25 06:44:01 +000050
Pavel Labath1fb7e202015-09-02 09:33:09 +000051 void
Todd Fialae1cfbc72016-08-11 23:51:28 +000052 OptionParsingStarting(ExecutionContext *execution_context) 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;
Marianne Mailhot-Sarrasin3fe71582016-05-12 20:00:53 +000060 bool allow_jit;
Chris Lattner30fdc8d2010-06-08 16:52:24 +000061 bool show_types;
62 bool show_summary;
Greg Clayton62afb9f2013-11-04 19:35:17 +000063 bool debug;
Jim Ingham35e1bda2012-10-16 21:41:58 +000064 uint32_t timeout;
65 bool try_all_threads;
Dawn Perchik15663c52015-07-25 00:19:39 +000066 lldb::LanguageType language;
Enrico Granata4d93b8c2013-09-30 19:11:51 +000067 LanguageRuntimeDescriptionDisplayVerbosity m_verbosity;
Jim Inghama1e541b2016-03-25 01:57:14 +000068 LazyBool auto_apply_fixits;
Chris Lattner30fdc8d2010-06-08 16:52:24 +000069 };
70
Greg Claytona7015092010-09-18 01:14:36 +000071 CommandObjectExpression (CommandInterpreter &interpreter);
Chris Lattner30fdc8d2010-06-08 16:52:24 +000072
Pavel Labath1fb7e202015-09-02 09:33:09 +000073 ~CommandObjectExpression() override;
Chris Lattner30fdc8d2010-06-08 16:52:24 +000074
Chris Lattner30fdc8d2010-06-08 16:52:24 +000075 Options *
Pavel Labath1fb7e202015-09-02 09:33:09 +000076 GetOptions() override;
Chris Lattner30fdc8d2010-06-08 16:52:24 +000077
Chris Lattner30fdc8d2010-06-08 16:52:24 +000078protected:
Greg Clayton44d93782014-01-27 23:43:24 +000079
80 //------------------------------------------------------------------
81 // IOHandler::Delegate functions
82 //------------------------------------------------------------------
Pavel Labath1fb7e202015-09-02 09:33:09 +000083 void
84 IOHandlerInputComplete(IOHandler &io_handler,
85 std::string &line) override;
Sean Callananf52c40c2016-05-09 21:13:27 +000086
87 bool
88 IOHandlerIsInputComplete (IOHandler &io_handler,
89 StringList &lines) override;
90
Pavel Labath1fb7e202015-09-02 09:33:09 +000091 bool
92 DoExecute(const char *command,
93 CommandReturnObject &result) override;
Chris Lattner30fdc8d2010-06-08 16:52:24 +000094
Chris Lattner30fdc8d2010-06-08 16:52:24 +000095 bool
Johnny Chenfcd43b72010-08-13 00:42:30 +000096 EvaluateExpression (const char *expr,
Caroline Tice6e8dc332011-06-13 20:20:29 +000097 Stream *output_stream,
98 Stream *error_stream,
Johnny Chenfcd43b72010-08-13 00:42:30 +000099 CommandReturnObject *result = NULL);
Greg Claytoncf28a8b2014-03-13 23:42:30 +0000100
101 void
102 GetMultilineExpression ();
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000103
Greg Clayton1deb7962011-10-25 06:44:01 +0000104 OptionGroupOptions m_option_group;
105 OptionGroupFormat m_format_options;
Enrico Granatab576bba2013-01-09 20:12:53 +0000106 OptionGroupValueObjectDisplay m_varobj_options;
Sean Callananf2bd5c32015-10-20 00:55:21 +0000107 OptionGroupBoolean m_repl_option;
Greg Clayton1deb7962011-10-25 06:44:01 +0000108 CommandOptions m_command_options;
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000109 uint32_t m_expr_line_count;
110 std::string m_expr_lines; // Multi-line expression support
Jim Inghame5ee6f02016-03-29 22:00:08 +0000111 std::string m_fixed_expression; // Holds the current expression's fixed text.
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000112};
113
114} // namespace lldb_private
115
Pavel Labath1fb7e202015-09-02 09:33:09 +0000116#endif // liblldb_CommandObjectExpression_h_