2010-06-09 00:52:24 +08:00
|
|
|
//===-- CommandObjectExpression.h -------------------------------*- C++ -*-===//
|
|
|
|
//
|
2019-01-19 16:50:56 +08:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2010-06-09 00:52:24 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef liblldb_CommandObjectExpression_h_
|
|
|
|
#define liblldb_CommandObjectExpression_h_
|
|
|
|
|
2014-01-28 07:43:24 +08:00
|
|
|
#include "lldb/Core/IOHandler.h"
|
2010-06-09 00:52:24 +08:00
|
|
|
#include "lldb/Interpreter/CommandObject.h"
|
2015-10-20 08:55:21 +08:00
|
|
|
#include "lldb/Interpreter/OptionGroupBoolean.h"
|
2011-10-25 14:44:01 +08:00
|
|
|
#include "lldb/Interpreter/OptionGroupFormat.h"
|
2013-01-10 04:12:53 +08:00
|
|
|
#include "lldb/Interpreter/OptionGroupValueObjectDisplay.h"
|
2010-06-09 00:52:24 +08:00
|
|
|
#include "lldb/Target/ExecutionContext.h"
|
2016-09-07 04:57:50 +08:00
|
|
|
#include "lldb/lldb-private-enumerations.h"
|
2010-06-09 00:52:24 +08:00
|
|
|
namespace lldb_private {
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
class CommandObjectExpression : public CommandObjectRaw,
|
|
|
|
public IOHandlerDelegate {
|
2010-06-09 00:52:24 +08:00
|
|
|
public:
|
2016-09-07 04:57:50 +08:00
|
|
|
class CommandOptions : public OptionGroup {
|
|
|
|
public:
|
|
|
|
CommandOptions();
|
|
|
|
|
|
|
|
~CommandOptions() override;
|
|
|
|
|
Convert option tables to ArrayRefs.
This change is very mechanical. All it does is change the
signature of `Options::GetDefinitions()` and `OptionGroup::
GetDefinitions()` to return an `ArrayRef<OptionDefinition>`
instead of a `const OptionDefinition *`. In the case of the
former, it deletes the sentinel entry from every table, and
in the case of the latter, it removes the `GetNumDefinitions()`
method from the interface. These are no longer necessary as
`ArrayRef` carries its own length.
In the former case, iteration was done by using a sentinel
entry, so there was no knowledge of length. Because of this
the individual option tables were allowed to be defined below
the corresponding class (after all, only a pointer was needed).
Now, however, the length must be known at compile time to
construct the `ArrayRef`, and as a result it is necessary to
move every option table before its corresponding class. This
results in this CL looking very big, but in terms of substance
there is not much here.
Differential revision: https://reviews.llvm.org/D24834
llvm-svn: 282188
2016-09-23 04:22:55 +08:00
|
|
|
llvm::ArrayRef<OptionDefinition> GetDefinitions() override;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2017-05-12 12:51:55 +08:00
|
|
|
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value,
|
|
|
|
ExecutionContext *execution_context) override;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
|
|
|
void OptionParsingStarting(ExecutionContext *execution_context) override;
|
|
|
|
|
|
|
|
bool top_level;
|
|
|
|
bool unwind_on_error;
|
|
|
|
bool ignore_breakpoints;
|
|
|
|
bool allow_jit;
|
|
|
|
bool show_types;
|
|
|
|
bool show_summary;
|
|
|
|
bool debug;
|
|
|
|
uint32_t timeout;
|
|
|
|
bool try_all_threads;
|
|
|
|
lldb::LanguageType language;
|
|
|
|
LanguageRuntimeDescriptionDisplayVerbosity m_verbosity;
|
|
|
|
LazyBool auto_apply_fixits;
|
|
|
|
};
|
|
|
|
|
|
|
|
CommandObjectExpression(CommandInterpreter &interpreter);
|
|
|
|
|
|
|
|
~CommandObjectExpression() override;
|
2010-06-09 00:52:24 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
Options *GetOptions() override;
|
2010-06-09 00:52:24 +08:00
|
|
|
|
2018-08-31 01:29:37 +08:00
|
|
|
int HandleCompletion(CompletionRequest &request) override;
|
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
protected:
|
2016-09-07 04:57:50 +08:00
|
|
|
// IOHandler::Delegate functions
|
|
|
|
void IOHandlerInputComplete(IOHandler &io_handler,
|
|
|
|
std::string &line) override;
|
|
|
|
|
|
|
|
bool IOHandlerIsInputComplete(IOHandler &io_handler,
|
|
|
|
StringList &lines) override;
|
|
|
|
|
2018-07-13 06:28:52 +08:00
|
|
|
bool DoExecute(llvm::StringRef command, CommandReturnObject &result) override;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2018-07-13 06:28:52 +08:00
|
|
|
bool EvaluateExpression(llvm::StringRef expr, Stream *output_stream,
|
2016-09-07 04:57:50 +08:00
|
|
|
Stream *error_stream,
|
[lldb] NFC modernize codebase with modernize-use-nullptr
Summary:
NFC = [[ https://llvm.org/docs/Lexicon.html#nfc | Non functional change ]]
This commit is the result of modernizing the LLDB codebase by using
`nullptr` instread of `0` or `NULL`. See
https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-nullptr.html
for more information.
This is the command I ran and I to fix and format the code base:
```
run-clang-tidy.py \
-header-filter='.*' \
-checks='-*,modernize-use-nullptr' \
-fix ~/dev/llvm-project/lldb/.* \
-format \
-style LLVM \
-p ~/llvm-builds/debug-ninja-gcc
```
NOTE: There were also changes to `llvm/utils/unittest` but I did not
include them because I felt that maybe this library shall be updated in
isolation somehow.
NOTE: I know this is a rather large commit but it is a nobrainer in most
parts.
Reviewers: martong, espindola, shafik, #lldb, JDevlieghere
Reviewed By: JDevlieghere
Subscribers: arsenm, jvesely, nhaehnle, hiraditya, JDevlieghere, teemperor, rnkovacs, emaste, kubamracek, nemanjai, ki.stfu, javed.absar, arichardson, kbarton, jrtc27, MaskRay, atanasyan, dexonsmith, arphaman, jfb, jsji, jdoerfert, lldb-commits, llvm-commits
Tags: #lldb, #llvm
Differential Revision: https://reviews.llvm.org/D61847
llvm-svn: 361484
2019-05-23 19:14:47 +08:00
|
|
|
CommandReturnObject *result = nullptr);
|
2016-09-07 04:57:50 +08:00
|
|
|
|
|
|
|
void GetMultilineExpression();
|
|
|
|
|
|
|
|
OptionGroupOptions m_option_group;
|
|
|
|
OptionGroupFormat m_format_options;
|
|
|
|
OptionGroupValueObjectDisplay m_varobj_options;
|
|
|
|
OptionGroupBoolean m_repl_option;
|
|
|
|
CommandOptions m_command_options;
|
|
|
|
uint32_t m_expr_line_count;
|
|
|
|
std::string m_expr_lines; // Multi-line expression support
|
|
|
|
std::string m_fixed_expression; // Holds the current expression's fixed text.
|
2010-06-09 00:52:24 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace lldb_private
|
|
|
|
|
2015-09-02 17:33:09 +08:00
|
|
|
#endif // liblldb_CommandObjectExpression_h_
|