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;
60 };
61
63
65
66 Options *GetOptions() override;
67
68 void HandleCompletion(CompletionRequest &request) override;
69
70protected:
71 // IOHandler::Delegate functions
72 void IOHandlerInputComplete(IOHandler &io_handler,
73 std::string &line) override;
74
75 bool IOHandlerIsInputComplete(IOHandler &io_handler,
76 StringList &lines) override;
77
78 void DoExecute(llvm::StringRef command, CommandReturnObject &result) override;
79
80 /// Evaluates the given expression.
81 /// \param output_stream The stream to which the evaluation result will be
82 /// printed.
83 /// \param error_stream Contains error messages that should be displayed to
84 /// the user in case the evaluation fails.
85 /// \param result A CommandReturnObject which status will be set to the
86 /// appropriate value depending on evaluation success and
87 /// whether the expression produced any result.
88 /// \return Returns true iff the expression was successfully evaluated,
89 /// executed and the result could be printed to the output stream.
90 bool EvaluateExpression(llvm::StringRef expr, Stream &output_stream,
91 Stream &error_stream, CommandReturnObject &result);
92
94
101 std::string m_expr_lines; // Multi-line expression support
102 std::string m_fixed_expression; // Holds the current expression's fixed text.
103};
104
105} // namespace lldb_private
106
107#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.
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
"lldb/Utility/ArgCompletionRequest.h"
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
A delegate class for use with IOHandler subclasses.
Definition: IOHandler.h:189
A command line option parsing protocol class.
Definition: Options.h:58
An error handling class.
Definition: Status.h:115
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.