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 
20 namespace lldb_private {
21 
23  public IOHandlerDelegate {
24 public:
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  bool top_level;
41  bool allow_jit;
42  bool show_types;
44  bool debug;
50  };
51 
53 
54  ~CommandObjectExpression() override;
55 
56  Options *GetOptions() override;
57 
58  void HandleCompletion(CompletionRequest &request) override;
59 
60 protected:
61  // IOHandler::Delegate functions
62  void IOHandlerInputComplete(IOHandler &io_handler,
63  std::string &line) override;
64 
65  bool IOHandlerIsInputComplete(IOHandler &io_handler,
66  StringList &lines) override;
67 
68  bool DoExecute(llvm::StringRef command, CommandReturnObject &result) override;
69 
70  /// Return the appropriate expression options used for evaluating the
71  /// expression in the given target.
73 
74  /// Evaluates the given expression.
75  /// \param output_stream The stream to which the evaluation result will be
76  /// printed.
77  /// \param error_stream Contains error messages that should be displayed to
78  /// the user in case the evaluation fails.
79  /// \param result A CommandReturnObject which status will be set to the
80  /// appropriate value depending on evaluation success and
81  /// whether the expression produced any result.
82  /// \return Returns true iff the expression was successfully evaluated,
83  /// executed and the result could be printed to the output stream.
84  bool EvaluateExpression(llvm::StringRef expr, Stream &output_stream,
85  Stream &error_stream, CommandReturnObject &result);
86 
88 
95  std::string m_expr_lines; // Multi-line expression support
96  std::string m_fixed_expression; // Holds the current expression's fixed text.
97 };
98 
99 } // namespace lldb_private
100 
101 #endif // LLDB_SOURCE_COMMANDS_COMMANDOBJECTEXPRESSION_H
CommandObjectExpression(CommandInterpreter &interpreter)
A class that represents a running process on the host machine.
A stream class that can stream formatted output to a file.
Definition: Stream.h:28
bool IOHandlerIsInputComplete(IOHandler &io_handler, StringList &lines) override
Called to determine whether typing enter after the last line in lines should end input.
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
OptionGroupValueObjectDisplay m_varobj_options
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
void IOHandlerInputComplete(IOHandler &io_handler, std::string &line) override
Called when a line or lines have been retrieved.
A delegate class for use with IOHandler subclasses.
Definition: IOHandler.h:192
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, ExecutionContext *execution_context) override
bool EvaluateExpression(llvm::StringRef expr, Stream &output_stream, Stream &error_stream, CommandReturnObject &result)
Evaluates the given expression.
"lldb/Utility/ArgCompletionRequest.h"
LanguageRuntimeDescriptionDisplayVerbosity m_verbosity
bool DoExecute(llvm::StringRef command, CommandReturnObject &result) override
LanguageType
Programming language type.
A command line option parsing protocol class.
Definition: Options.h:62
void HandleCompletion(CompletionRequest &request) override
This default version handles calling option argument completions and then calls HandleArgumentComplet...
void OptionParsingStarting(ExecutionContext *execution_context) override
EvaluateExpressionOptions GetEvalOptions(const Target &target)
Return the appropriate expression options used for evaluating the expression in the given target...
An error handling class.
Definition: Status.h:44