LLDB mainline
CommandObjectExpression.h
Go to the documentation of this file.
1//===-- CommandObjectExpression.h -------------------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLDB_SOURCE_COMMANDS_COMMANDOBJECTEXPRESSION_H
10#define LLDB_SOURCE_COMMANDS_COMMANDOBJECTEXPRESSION_H
11
12#include "lldb/Core/IOHandler.h"
17#include "lldb/Target/Target.h"
19
20namespace lldb_private {
21
23 public IOHandlerDelegate {
24public:
25 class CommandOptions : public OptionGroup {
26 public:
28
29 ~CommandOptions() override;
30
31 llvm::ArrayRef<OptionDefinition> GetDefinitions() override;
32
33 Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value,
34 ExecutionContext *execution_context) override;
35
36 void OptionParsingStarting(ExecutionContext *execution_context) override;
37
38 /// Return the appropriate expression options used for evaluating the
39 /// expression in the given target.
41 const Target &target,
42 const OptionGroupValueObjectDisplay &display_opts);
43
45 const OptionGroupValueObjectDisplay &display_opts) const;
46
53 bool debug;
54 uint32_t timeout;
61 };
62
64
66
67 Options *GetOptions() override;
68
69 void HandleCompletion(CompletionRequest &request) override;
70
71protected:
72 // IOHandler::Delegate functions
73 void IOHandlerInputComplete(IOHandler &io_handler,
74 std::string &line) override;
75
76 bool IOHandlerIsInputComplete(IOHandler &io_handler,
77 StringList &lines) override;
78
79 void DoExecute(llvm::StringRef command, CommandReturnObject &result) override;
80
81 /// Evaluates the given expression.
82 /// \param output_stream The stream to which the evaluation result will be
83 /// printed.
84 /// \param error_stream Contains error messages that should be displayed to
85 /// the user in case the evaluation fails.
86 /// \param result A CommandReturnObject which status will be set to the
87 /// appropriate value depending on evaluation success and
88 /// whether the expression produced any result.
89 /// \return Returns true iff the expression was successfully evaluated,
90 /// executed and the result could be printed to the output stream.
91 bool EvaluateExpression(llvm::StringRef expr, Stream &output_stream,
92 Stream &error_stream, CommandReturnObject &result);
93
95
102 std::string m_expr_lines; // Multi-line expression support
103 std::string m_fixed_expression; // Holds the current expression's fixed text.
104};
105
106} // namespace lldb_private
107
108#endif // LLDB_SOURCE_COMMANDS_COMMANDOBJECTEXPRESSION_H
void OptionParsingStarting(ExecutionContext *execution_context) override
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
bool ShouldSuppressResult(const OptionGroupValueObjectDisplay &display_opts) const
LanguageRuntimeDescriptionDisplayVerbosity m_verbosity
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, ExecutionContext *execution_context) override
EvaluateExpressionOptions GetEvaluateExpressionOptions(const Target &target, const OptionGroupValueObjectDisplay &display_opts)
Return the appropriate expression options used for evaluating the expression in the given target.
CommandObjectExpression(CommandInterpreter &interpreter)
bool IOHandlerIsInputComplete(IOHandler &io_handler, StringList &lines) override
Called to determine whether typing enter after the last line in lines should end input.
OptionGroupValueObjectDisplay m_varobj_options
void HandleCompletion(CompletionRequest &request) override
This default version handles calling option argument completions and then calls HandleArgumentComplet...
bool EvaluateExpression(llvm::StringRef expr, Stream &output_stream, Stream &error_stream, CommandReturnObject &result)
Evaluates the given expression.
void IOHandlerInputComplete(IOHandler &io_handler, std::string &line) override
Called when a line or lines have been retrieved.
void DoExecute(llvm::StringRef command, CommandReturnObject &result) override
CommandObjectRaw(CommandInterpreter &interpreter, llvm::StringRef name, llvm::StringRef help="", llvm::StringRef syntax="", uint32_t flags=0)
"lldb/Utility/ArgCompletionRequest.h"
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
IOHandlerDelegate(Completion completion=Completion::None)
Definition IOHandler.h:188
A command line option parsing protocol class.
Definition Options.h:58
An error handling class.
Definition Status.h:118
A stream class that can stream formatted output to a file.
Definition Stream.h:28
A class that represents a running process on the host machine.
LanguageType
Programming language type.