2010-06-08 16:52:24 +00:00
|
|
|
//===-- CommandObjectExpression.h -------------------------------*- C++ -*-===//
|
|
|
|
|
//
|
2019-01-19 08:50:56 +00:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2010-06-08 16:52:24 +00:00
|
|
|
//
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
2020-02-17 15:57:45 -08:00
|
|
|
#ifndef LLDB_SOURCE_COMMANDS_COMMANDOBJECTEXPRESSION_H
|
|
|
|
|
#define LLDB_SOURCE_COMMANDS_COMMANDOBJECTEXPRESSION_H
|
2010-06-08 16:52:24 +00:00
|
|
|
|
2014-01-27 23:43:24 +00:00
|
|
|
#include "lldb/Core/IOHandler.h"
|
2010-06-08 16:52:24 +00:00
|
|
|
#include "lldb/Interpreter/CommandObject.h"
|
2015-10-20 00:55:21 +00:00
|
|
|
#include "lldb/Interpreter/OptionGroupBoolean.h"
|
2011-10-25 06:44:01 +00:00
|
|
|
#include "lldb/Interpreter/OptionGroupFormat.h"
|
2013-01-09 20:12:53 +00:00
|
|
|
#include "lldb/Interpreter/OptionGroupValueObjectDisplay.h"
|
2020-03-06 18:27:46 -08:00
|
|
|
#include "lldb/Target/Target.h"
|
2016-03-25 01:57:14 +00:00
|
|
|
#include "lldb/lldb-private-enumerations.h"
|
2020-03-06 18:27:46 -08:00
|
|
|
|
2010-06-08 16:52:24 +00:00
|
|
|
namespace lldb_private {
|
|
|
|
|
|
2014-01-27 23:43:24 +00:00
|
|
|
class CommandObjectExpression : public CommandObjectRaw,
|
|
|
|
|
public IOHandlerDelegate {
|
2010-06-08 16:52:24 +00:00
|
|
|
public:
|
2011-10-25 06:44:01 +00:00
|
|
|
class CommandOptions : public OptionGroup {
|
2016-09-06 20:57:50 +00:00
|
|
|
public:
|
2011-10-25 06:44:01 +00:00
|
|
|
CommandOptions();
|
2010-06-08 16:52:24 +00:00
|
|
|
|
2011-10-25 06:44:01 +00:00
|
|
|
~CommandOptions() override;
|
2010-06-08 16:52:24 +00:00
|
|
|
|
2016-09-22 20:22:55 +00:00
|
|
|
llvm::ArrayRef<OptionDefinition> GetDefinitions() override;
|
2010-06-08 16:52:24 +00:00
|
|
|
|
2017-05-12 04:51:55 +00:00
|
|
|
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value,
|
|
|
|
|
ExecutionContext *execution_context) override;
|
2010-06-08 16:52:24 +00:00
|
|
|
|
|
|
|
|
void OptionParsingStarting(ExecutionContext *execution_context) override;
|
|
|
|
|
|
2016-03-28 21:20:05 +00:00
|
|
|
bool top_level;
|
2010-09-18 01:14:36 +00:00
|
|
|
bool unwind_on_error;
|
|
|
|
|
bool ignore_breakpoints;
|
2016-05-12 20:00:53 +00:00
|
|
|
bool allow_jit;
|
2010-06-08 16:52:24 +00:00
|
|
|
bool show_types;
|
2010-09-18 01:14:36 +00:00
|
|
|
bool show_summary;
|
2013-11-04 19:35:17 +00:00
|
|
|
bool debug;
|
2012-10-16 21:41:58 +00:00
|
|
|
uint32_t timeout;
|
2010-09-18 01:14:36 +00:00
|
|
|
bool try_all_threads;
|
|
|
|
|
lldb::LanguageType language;
|
|
|
|
|
LanguageRuntimeDescriptionDisplayVerbosity m_verbosity;
|
2016-03-25 01:57:14 +00:00
|
|
|
LazyBool auto_apply_fixits;
|
2016-09-06 20:57:50 +00:00
|
|
|
};
|
2010-06-08 16:52:24 +00:00
|
|
|
|
2015-09-02 09:33:09 +00:00
|
|
|
CommandObjectExpression(CommandInterpreter &interpreter);
|
2010-06-08 16:52:24 +00:00
|
|
|
|
|
|
|
|
~CommandObjectExpression() override;
|
2016-09-06 20:57:50 +00:00
|
|
|
|
2015-09-02 09:33:09 +00:00
|
|
|
Options *GetOptions() override;
|
2010-06-08 16:52:24 +00:00
|
|
|
|
2019-08-22 07:41:23 +00:00
|
|
|
void HandleCompletion(CompletionRequest &request) override;
|
2018-08-30 17:29:37 +00:00
|
|
|
|
2010-06-08 16:52:24 +00:00
|
|
|
protected:
|
2014-01-27 23:43:24 +00:00
|
|
|
// IOHandler::Delegate functions
|
2015-09-02 09:33:09 +00:00
|
|
|
void IOHandlerInputComplete(IOHandler &io_handler,
|
|
|
|
|
std::string &line) override;
|
2010-06-08 16:52:24 +00:00
|
|
|
|
2010-08-13 00:42:30 +00:00
|
|
|
bool IOHandlerIsInputComplete(IOHandler &io_handler,
|
2011-06-13 20:20:29 +00:00
|
|
|
StringList &lines) override;
|
2010-06-08 16:52:24 +00:00
|
|
|
|
2018-07-12 22:28:52 +00:00
|
|
|
bool DoExecute(llvm::StringRef command, CommandReturnObject &result) override;
|
2016-09-06 20:57:50 +00:00
|
|
|
|
2020-03-06 18:27:46 -08:00
|
|
|
/// Return the appropriate expression options used for evaluating the
|
|
|
|
|
/// expression in the given target.
|
|
|
|
|
EvaluateExpressionOptions GetEvalOptions(const Target &target);
|
|
|
|
|
|
2020-03-23 15:25:51 +01:00
|
|
|
/// Evaluates the given expression.
|
|
|
|
|
/// \param output_stream The stream to which the evaluation result will be
|
|
|
|
|
/// printed.
|
|
|
|
|
/// \param error_stream Contains error messages that should be displayed to
|
|
|
|
|
/// the user in case the evaluation fails.
|
|
|
|
|
/// \param result A CommandReturnObject which status will be set to the
|
|
|
|
|
/// appropriate value depending on evaluation success and
|
|
|
|
|
/// whether the expression produced any result.
|
|
|
|
|
/// \return Returns true iff the expression was successfully evaluated,
|
|
|
|
|
/// executed and the result could be printed to the output stream.
|
2020-03-17 12:57:32 +01:00
|
|
|
bool EvaluateExpression(llvm::StringRef expr, Stream &output_stream,
|
|
|
|
|
Stream &error_stream, CommandReturnObject &result);
|
2016-09-06 20:57:50 +00:00
|
|
|
|
2014-03-13 23:42:30 +00:00
|
|
|
void GetMultilineExpression();
|
2016-09-06 20:57:50 +00:00
|
|
|
|
2011-10-25 06:44:01 +00:00
|
|
|
OptionGroupOptions m_option_group;
|
|
|
|
|
OptionGroupFormat m_format_options;
|
2013-01-09 20:12:53 +00:00
|
|
|
OptionGroupValueObjectDisplay m_varobj_options;
|
2015-10-20 00:55:21 +00:00
|
|
|
OptionGroupBoolean m_repl_option;
|
2011-10-25 06:44:01 +00:00
|
|
|
CommandOptions m_command_options;
|
2010-06-08 16:52:24 +00:00
|
|
|
uint32_t m_expr_line_count;
|
|
|
|
|
std::string m_expr_lines; // Multi-line expression support
|
2016-03-29 22:00:08 +00:00
|
|
|
std::string m_fixed_expression; // Holds the current expression's fixed text.
|
2010-06-08 16:52:24 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace lldb_private
|
|
|
|
|
|
2020-02-17 15:57:45 -08:00
|
|
|
#endif // LLDB_SOURCE_COMMANDS_COMMANDOBJECTEXPRESSION_H
|