Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-src
Path: blob/main/contrib/llvm-project/lldb/source/Commands/CommandObjectExpression.h
39587 views
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"
13
#include "lldb/Interpreter/CommandObject.h"
14
#include "lldb/Interpreter/OptionGroupBoolean.h"
15
#include "lldb/Interpreter/OptionGroupFormat.h"
16
#include "lldb/Interpreter/OptionGroupValueObjectDisplay.h"
17
#include "lldb/Target/Target.h"
18
#include "lldb/lldb-private-enumerations.h"
19
20
namespace lldb_private {
21
22
class CommandObjectExpression : public CommandObjectRaw,
23
public IOHandlerDelegate {
24
public:
25
class CommandOptions : public OptionGroup {
26
public:
27
CommandOptions();
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.
40
EvaluateExpressionOptions GetEvaluateExpressionOptions(
41
const Target &target,
42
const OptionGroupValueObjectDisplay &display_opts);
43
44
bool ShouldSuppressResult(
45
const OptionGroupValueObjectDisplay &display_opts) const;
46
47
bool top_level;
48
bool unwind_on_error;
49
bool ignore_breakpoints;
50
bool allow_jit;
51
bool show_types;
52
bool show_summary;
53
bool debug;
54
uint32_t timeout;
55
bool try_all_threads;
56
lldb::LanguageType language;
57
LanguageRuntimeDescriptionDisplayVerbosity m_verbosity;
58
LazyBool auto_apply_fixits;
59
LazyBool suppress_persistent_result;
60
};
61
62
CommandObjectExpression(CommandInterpreter &interpreter);
63
64
~CommandObjectExpression() override;
65
66
Options *GetOptions() override;
67
68
void HandleCompletion(CompletionRequest &request) override;
69
70
protected:
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
93
void GetMultilineExpression();
94
95
OptionGroupOptions m_option_group;
96
OptionGroupFormat m_format_options;
97
OptionGroupValueObjectDisplay m_varobj_options;
98
OptionGroupBoolean m_repl_option;
99
CommandOptions m_command_options;
100
uint32_t m_expr_line_count;
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
108
109