Path: blob/main/contrib/llvm-project/lldb/source/Commands/CommandObjectExpression.h
39587 views
//===-- CommandObjectExpression.h -------------------------------*- C++ -*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#ifndef LLDB_SOURCE_COMMANDS_COMMANDOBJECTEXPRESSION_H9#define LLDB_SOURCE_COMMANDS_COMMANDOBJECTEXPRESSION_H1011#include "lldb/Core/IOHandler.h"12#include "lldb/Interpreter/CommandObject.h"13#include "lldb/Interpreter/OptionGroupBoolean.h"14#include "lldb/Interpreter/OptionGroupFormat.h"15#include "lldb/Interpreter/OptionGroupValueObjectDisplay.h"16#include "lldb/Target/Target.h"17#include "lldb/lldb-private-enumerations.h"1819namespace lldb_private {2021class CommandObjectExpression : public CommandObjectRaw,22public IOHandlerDelegate {23public:24class CommandOptions : public OptionGroup {25public:26CommandOptions();2728~CommandOptions() override;2930llvm::ArrayRef<OptionDefinition> GetDefinitions() override;3132Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value,33ExecutionContext *execution_context) override;3435void OptionParsingStarting(ExecutionContext *execution_context) override;3637/// Return the appropriate expression options used for evaluating the38/// expression in the given target.39EvaluateExpressionOptions GetEvaluateExpressionOptions(40const Target &target,41const OptionGroupValueObjectDisplay &display_opts);4243bool ShouldSuppressResult(44const OptionGroupValueObjectDisplay &display_opts) const;4546bool top_level;47bool unwind_on_error;48bool ignore_breakpoints;49bool allow_jit;50bool show_types;51bool show_summary;52bool debug;53uint32_t timeout;54bool try_all_threads;55lldb::LanguageType language;56LanguageRuntimeDescriptionDisplayVerbosity m_verbosity;57LazyBool auto_apply_fixits;58LazyBool suppress_persistent_result;59};6061CommandObjectExpression(CommandInterpreter &interpreter);6263~CommandObjectExpression() override;6465Options *GetOptions() override;6667void HandleCompletion(CompletionRequest &request) override;6869protected:70// IOHandler::Delegate functions71void IOHandlerInputComplete(IOHandler &io_handler,72std::string &line) override;7374bool IOHandlerIsInputComplete(IOHandler &io_handler,75StringList &lines) override;7677void DoExecute(llvm::StringRef command, CommandReturnObject &result) override;7879/// Evaluates the given expression.80/// \param output_stream The stream to which the evaluation result will be81/// printed.82/// \param error_stream Contains error messages that should be displayed to83/// the user in case the evaluation fails.84/// \param result A CommandReturnObject which status will be set to the85/// appropriate value depending on evaluation success and86/// whether the expression produced any result.87/// \return Returns true iff the expression was successfully evaluated,88/// executed and the result could be printed to the output stream.89bool EvaluateExpression(llvm::StringRef expr, Stream &output_stream,90Stream &error_stream, CommandReturnObject &result);9192void GetMultilineExpression();9394OptionGroupOptions m_option_group;95OptionGroupFormat m_format_options;96OptionGroupValueObjectDisplay m_varobj_options;97OptionGroupBoolean m_repl_option;98CommandOptions m_command_options;99uint32_t m_expr_line_count;100std::string m_expr_lines; // Multi-line expression support101std::string m_fixed_expression; // Holds the current expression's fixed text.102};103104} // namespace lldb_private105106#endif // LLDB_SOURCE_COMMANDS_COMMANDOBJECTEXPRESSION_H107108109