2010-06-09 00:52:24 +08:00
|
|
|
//===-- CommandObjectExpression.h -------------------------------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef liblldb_CommandObjectExpression_h_
|
|
|
|
#define liblldb_CommandObjectExpression_h_
|
|
|
|
|
|
|
|
// C Includes
|
|
|
|
// C++ Includes
|
|
|
|
// Other libraries and framework includes
|
|
|
|
// Project includes
|
2014-01-28 07:43:24 +08:00
|
|
|
#include "lldb/Core/IOHandler.h"
|
2010-06-09 00:52:24 +08:00
|
|
|
#include "lldb/Interpreter/CommandObject.h"
|
2015-10-20 08:55:21 +08:00
|
|
|
#include "lldb/Interpreter/OptionGroupBoolean.h"
|
2011-10-25 14:44:01 +08:00
|
|
|
#include "lldb/Interpreter/OptionGroupFormat.h"
|
2013-01-10 04:12:53 +08:00
|
|
|
#include "lldb/Interpreter/OptionGroupValueObjectDisplay.h"
|
2010-06-09 00:52:24 +08:00
|
|
|
#include "lldb/Target/ExecutionContext.h"
|
2016-09-07 04:57:50 +08:00
|
|
|
#include "lldb/lldb-private-enumerations.h"
|
2010-06-09 00:52:24 +08:00
|
|
|
namespace lldb_private {
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
class CommandObjectExpression : public CommandObjectRaw,
|
|
|
|
public IOHandlerDelegate {
|
2010-06-09 00:52:24 +08:00
|
|
|
public:
|
2016-09-07 04:57:50 +08:00
|
|
|
class CommandOptions : public OptionGroup {
|
|
|
|
public:
|
|
|
|
CommandOptions();
|
|
|
|
|
|
|
|
~CommandOptions() override;
|
|
|
|
|
Convert option tables to ArrayRefs.
This change is very mechanical. All it does is change the
signature of `Options::GetDefinitions()` and `OptionGroup::
GetDefinitions()` to return an `ArrayRef<OptionDefinition>`
instead of a `const OptionDefinition *`. In the case of the
former, it deletes the sentinel entry from every table, and
in the case of the latter, it removes the `GetNumDefinitions()`
method from the interface. These are no longer necessary as
`ArrayRef` carries its own length.
In the former case, iteration was done by using a sentinel
entry, so there was no knowledge of length. Because of this
the individual option tables were allowed to be defined below
the corresponding class (after all, only a pointer was needed).
Now, however, the length must be known at compile time to
construct the `ArrayRef`, and as a result it is necessary to
move every option table before its corresponding class. This
results in this CL looking very big, but in terms of substance
there is not much here.
Differential revision: https://reviews.llvm.org/D24834
llvm-svn: 282188
2016-09-23 04:22:55 +08:00
|
|
|
llvm::ArrayRef<OptionDefinition> GetDefinitions() override;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2017-05-12 12:51:55 +08:00
|
|
|
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value,
|
|
|
|
ExecutionContext *execution_context) override;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
|
|
|
void OptionParsingStarting(ExecutionContext *execution_context) override;
|
|
|
|
|
|
|
|
// Options table: Required for subclasses of Options.
|
|
|
|
|
|
|
|
static OptionDefinition g_option_table[];
|
|
|
|
bool top_level;
|
|
|
|
bool unwind_on_error;
|
|
|
|
bool ignore_breakpoints;
|
|
|
|
bool allow_jit;
|
|
|
|
bool show_types;
|
|
|
|
bool show_summary;
|
|
|
|
bool debug;
|
|
|
|
uint32_t timeout;
|
|
|
|
bool try_all_threads;
|
|
|
|
lldb::LanguageType language;
|
|
|
|
LanguageRuntimeDescriptionDisplayVerbosity m_verbosity;
|
|
|
|
LazyBool auto_apply_fixits;
|
|
|
|
};
|
|
|
|
|
|
|
|
CommandObjectExpression(CommandInterpreter &interpreter);
|
|
|
|
|
|
|
|
~CommandObjectExpression() override;
|
2010-06-09 00:52:24 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
Options *GetOptions() override;
|
2010-06-09 00:52:24 +08:00
|
|
|
|
|
|
|
protected:
|
2016-09-07 04:57:50 +08:00
|
|
|
//------------------------------------------------------------------
|
|
|
|
// IOHandler::Delegate functions
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
void IOHandlerInputComplete(IOHandler &io_handler,
|
|
|
|
std::string &line) override;
|
|
|
|
|
|
|
|
bool IOHandlerIsInputComplete(IOHandler &io_handler,
|
|
|
|
StringList &lines) override;
|
|
|
|
|
2018-07-13 06:28:52 +08:00
|
|
|
bool DoExecute(llvm::StringRef command, CommandReturnObject &result) override;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2018-07-13 06:28:52 +08:00
|
|
|
bool EvaluateExpression(llvm::StringRef expr, Stream *output_stream,
|
2016-09-07 04:57:50 +08:00
|
|
|
Stream *error_stream,
|
|
|
|
CommandReturnObject *result = NULL);
|
|
|
|
|
|
|
|
void GetMultilineExpression();
|
|
|
|
|
|
|
|
OptionGroupOptions m_option_group;
|
|
|
|
OptionGroupFormat m_format_options;
|
|
|
|
OptionGroupValueObjectDisplay m_varobj_options;
|
|
|
|
OptionGroupBoolean m_repl_option;
|
|
|
|
CommandOptions m_command_options;
|
|
|
|
uint32_t m_expr_line_count;
|
|
|
|
std::string m_expr_lines; // Multi-line expression support
|
|
|
|
std::string m_fixed_expression; // Holds the current expression's fixed text.
|
2010-06-09 00:52:24 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace lldb_private
|
|
|
|
|
2015-09-02 17:33:09 +08:00
|
|
|
#endif // liblldb_CommandObjectExpression_h_
|