blob: e30e9b0e01c0d85bf5113e554bcedecd189545fb [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"
Greg Clayton1deb7962011-10-25 06:44:01 +000019#include "lldb/Interpreter/OptionGroupFormat.h"
Enrico Granatab576bba2013-01-09 20:12:53 +000020#include "lldb/Interpreter/OptionGroupValueObjectDisplay.h"
Chris Lattner30fdc8d2010-06-08 16:52:24 +000021#include "lldb/Target/ExecutionContext.h"
22
23namespace lldb_private {
24
Greg Clayton44d93782014-01-27 23:43:24 +000025class CommandObjectExpression :
26 public CommandObjectRaw,
27 public IOHandlerDelegate
Chris Lattner30fdc8d2010-06-08 16:52:24 +000028{
29public:
30
Greg Clayton1deb7962011-10-25 06:44:01 +000031 class CommandOptions : public OptionGroup
Chris Lattner30fdc8d2010-06-08 16:52:24 +000032 {
33 public:
34
Greg Clayton1deb7962011-10-25 06:44:01 +000035 CommandOptions ();
Chris Lattner30fdc8d2010-06-08 16:52:24 +000036
Pavel Labath1fb7e202015-09-02 09:33:09 +000037 ~CommandOptions() override;
Chris Lattner30fdc8d2010-06-08 16:52:24 +000038
Pavel Labath1fb7e202015-09-02 09:33:09 +000039 uint32_t
40 GetNumDefinitions() override;
Greg Clayton1deb7962011-10-25 06:44:01 +000041
Pavel Labath1fb7e202015-09-02 09:33:09 +000042 const OptionDefinition*
43 GetDefinitions() override;
Greg Clayton1deb7962011-10-25 06:44:01 +000044
Pavel Labath1fb7e202015-09-02 09:33:09 +000045 Error
46 SetOptionValue(CommandInterpreter &interpreter,
47 uint32_t option_idx,
48 const char *option_value) override;
Greg Clayton1deb7962011-10-25 06:44:01 +000049
Pavel Labath1fb7e202015-09-02 09:33:09 +000050 void
51 OptionParsingStarting(CommandInterpreter &interpreter) override;
Chris Lattner30fdc8d2010-06-08 16:52:24 +000052
53 // Options table: Required for subclasses of Options.
54
Greg Claytone0d378b2011-03-24 21:19:54 +000055 static OptionDefinition g_option_table[];
Jim Ingham399f1ca2010-11-05 19:25:48 +000056 bool unwind_on_error;
Jim Ingham184e9812013-01-15 02:47:48 +000057 bool ignore_breakpoints;
Chris Lattner30fdc8d2010-06-08 16:52:24 +000058 bool show_types;
59 bool show_summary;
Greg Clayton62afb9f2013-11-04 19:35:17 +000060 bool debug;
Jim Ingham35e1bda2012-10-16 21:41:58 +000061 uint32_t timeout;
62 bool try_all_threads;
Dawn Perchik15663c52015-07-25 00:19:39 +000063 lldb::LanguageType language;
Enrico Granata4d93b8c2013-09-30 19:11:51 +000064 LanguageRuntimeDescriptionDisplayVerbosity m_verbosity;
Chris Lattner30fdc8d2010-06-08 16:52:24 +000065 };
66
Greg Claytona7015092010-09-18 01:14:36 +000067 CommandObjectExpression (CommandInterpreter &interpreter);
Chris Lattner30fdc8d2010-06-08 16:52:24 +000068
Pavel Labath1fb7e202015-09-02 09:33:09 +000069 ~CommandObjectExpression() override;
Chris Lattner30fdc8d2010-06-08 16:52:24 +000070
Chris Lattner30fdc8d2010-06-08 16:52:24 +000071 Options *
Pavel Labath1fb7e202015-09-02 09:33:09 +000072 GetOptions() override;
Chris Lattner30fdc8d2010-06-08 16:52:24 +000073
Chris Lattner30fdc8d2010-06-08 16:52:24 +000074protected:
Greg Clayton44d93782014-01-27 23:43:24 +000075
76 //------------------------------------------------------------------
77 // IOHandler::Delegate functions
78 //------------------------------------------------------------------
Pavel Labath1fb7e202015-09-02 09:33:09 +000079 void
80 IOHandlerInputComplete(IOHandler &io_handler,
81 std::string &line) override;
Greg Clayton44d93782014-01-27 23:43:24 +000082
83 virtual LineStatus
84 IOHandlerLinesUpdated (IOHandler &io_handler,
85 StringList &lines,
86 uint32_t line_idx,
87 Error &error);
Pavel Labath1fb7e202015-09-02 09:33:09 +000088 bool
89 DoExecute(const char *command,
90 CommandReturnObject &result) override;
Chris Lattner30fdc8d2010-06-08 16:52:24 +000091
Chris Lattner30fdc8d2010-06-08 16:52:24 +000092 bool
Johnny Chenfcd43b72010-08-13 00:42:30 +000093 EvaluateExpression (const char *expr,
Caroline Tice6e8dc332011-06-13 20:20:29 +000094 Stream *output_stream,
95 Stream *error_stream,
Johnny Chenfcd43b72010-08-13 00:42:30 +000096 CommandReturnObject *result = NULL);
Greg Claytoncf28a8b2014-03-13 23:42:30 +000097
98 void
99 GetMultilineExpression ();
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000100
Greg Clayton1deb7962011-10-25 06:44:01 +0000101 OptionGroupOptions m_option_group;
102 OptionGroupFormat m_format_options;
Enrico Granatab576bba2013-01-09 20:12:53 +0000103 OptionGroupValueObjectDisplay m_varobj_options;
Greg Clayton1deb7962011-10-25 06:44:01 +0000104 CommandOptions m_command_options;
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000105 uint32_t m_expr_line_count;
106 std::string m_expr_lines; // Multi-line expression support
107};
108
109} // namespace lldb_private
110
Pavel Labath1fb7e202015-09-02 09:33:09 +0000111#endif // liblldb_CommandObjectExpression_h_