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
50 bool debug;
57 };
58
60
62
63 Options *GetOptions() override;
64
65 void HandleCompletion(CompletionRequest &request) override;
66
67protected:
68 // IOHandler::Delegate functions
69 void IOHandlerInputComplete(IOHandler &io_handler,
70 std::string &line) override;
71
72 bool IOHandlerIsInputComplete(IOHandler &io_handler,
73 StringList &lines) override;
74
75 bool DoExecute(llvm::StringRef command, CommandReturnObject &result) override;
76
77 /// Evaluates the given expression.
78 /// \param output_stream The stream to which the evaluation result will be
79 /// printed.
80 /// \param error_stream Contains error messages that should be displayed to
81 /// the user in case the evaluation fails.
82 /// \param result A CommandReturnObject which status will be set to the
83 /// appropriate value depending on evaluation success and
84 /// whether the expression produced any result.
85 /// \return Returns true iff the expression was successfully evaluated,
86 /// executed and the result could be printed to the output stream.
87 bool EvaluateExpression(llvm::StringRef expr, Stream &output_stream,
88 Stream &error_stream, CommandReturnObject &result);
89
91
98 std::string m_expr_lines; // Multi-line expression support
99 std::string m_fixed_expression; // Holds the current expression's fixed text.
100};
101
102} // namespace lldb_private
103
104#endif // LLDB_SOURCE_COMMANDS_COMMANDOBJECTEXPRESSION_H
void OptionParsingStarting(ExecutionContext *execution_context) override
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
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 DoExecute(llvm::StringRef command, CommandReturnObject &result) override
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.
"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:191
A command line option parsing protocol class.
Definition: Options.h:58
An error handling class.
Definition: Status.h:44
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.
Definition: SBAttachInfo.h:14
LanguageType
Programming language type.