aboutsummaryrefslogtreecommitdiff
path: root/lldb/source
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2020-09-01 17:28:29 -0700
committerJonas Devlieghere <jonas@devlieghere.com>2020-09-01 17:33:39 -0700
commit9390b346fc207c3edabbca9665e77260b030cfe0 (patch)
tree3fd25e064b1c6013a3624c561f575c1d30cdb516 /lldb/source
parent202766947edb5407b84484185608aac077085608 (diff)
downloadllvm-9390b346fc207c3edabbca9665e77260b030cfe0.zip
llvm-9390b346fc207c3edabbca9665e77260b030cfe0.tar.gz
llvm-9390b346fc207c3edabbca9665e77260b030cfe0.tar.bz2
[lldb] Move ScriptCommand and RegexCommand under Commands (NFC)
Move the CommandObjectScript and CommandObjectRegexCommand under Commands where all the other CommandObject implementations live. Although neither implementations currently use the TableGen-generated CommandOptions.inc, this move would have been necessary anyway if they were to in the future.
Diffstat (limited to 'lldb/source')
-rw-r--r--lldb/source/Commands/CMakeLists.txt2
-rw-r--r--lldb/source/Commands/CommandObjectCommands.cpp5
-rw-r--r--lldb/source/Commands/CommandObjectRegexCommand.cpp (renamed from lldb/source/Interpreter/CommandObjectRegexCommand.cpp)5
-rw-r--r--lldb/source/Commands/CommandObjectRegexCommand.h61
-rw-r--r--lldb/source/Commands/CommandObjectScript.cpp (renamed from lldb/source/Interpreter/CommandObjectScript.cpp)0
-rw-r--r--lldb/source/Commands/CommandObjectScript.h (renamed from lldb/source/Interpreter/CommandObjectScript.h)0
-rw-r--r--lldb/source/Interpreter/CMakeLists.txt2
-rw-r--r--lldb/source/Interpreter/CommandInterpreter.cpp5
8 files changed, 69 insertions, 11 deletions
diff --git a/lldb/source/Commands/CMakeLists.txt b/lldb/source/Commands/CMakeLists.txt
index 28bcfac..3e57670 100644
--- a/lldb/source/Commands/CMakeLists.txt
+++ b/lldb/source/Commands/CMakeLists.txt
@@ -21,8 +21,10 @@ add_lldb_library(lldbCommands
CommandObjectPlugin.cpp
CommandObjectProcess.cpp
CommandObjectQuit.cpp
+ CommandObjectRegexCommand.cpp
CommandObjectRegister.cpp
CommandObjectReproducer.cpp
+ CommandObjectScript.cpp
CommandObjectSession.cpp
CommandObjectSettings.cpp
CommandObjectSource.cpp
diff --git a/lldb/source/Commands/CommandObjectCommands.cpp b/lldb/source/Commands/CommandObjectCommands.cpp
index 92730b6..96ce82d 100644
--- a/lldb/source/Commands/CommandObjectCommands.cpp
+++ b/lldb/source/Commands/CommandObjectCommands.cpp
@@ -6,15 +6,13 @@
//
//===----------------------------------------------------------------------===//
-#include "llvm/ADT/StringRef.h"
-
#include "CommandObjectCommands.h"
#include "CommandObjectHelp.h"
+#include "CommandObjectRegexCommand.h"
#include "lldb/Core/Debugger.h"
#include "lldb/Core/IOHandler.h"
#include "lldb/Interpreter/CommandHistory.h"
#include "lldb/Interpreter/CommandInterpreter.h"
-#include "lldb/Interpreter/CommandObjectRegexCommand.h"
#include "lldb/Interpreter/CommandReturnObject.h"
#include "lldb/Interpreter/OptionArgParser.h"
#include "lldb/Interpreter/OptionValueBoolean.h"
@@ -24,6 +22,7 @@
#include "lldb/Interpreter/ScriptInterpreter.h"
#include "lldb/Utility/Args.h"
#include "lldb/Utility/StringList.h"
+#include "llvm/ADT/StringRef.h"
using namespace lldb;
using namespace lldb_private;
diff --git a/lldb/source/Interpreter/CommandObjectRegexCommand.cpp b/lldb/source/Commands/CommandObjectRegexCommand.cpp
index 7485fd76..1bf29d3 100644
--- a/lldb/source/Interpreter/CommandObjectRegexCommand.cpp
+++ b/lldb/source/Commands/CommandObjectRegexCommand.cpp
@@ -6,8 +6,7 @@
//
//===----------------------------------------------------------------------===//
-#include "lldb/Interpreter/CommandObjectRegexCommand.h"
-
+#include "CommandObjectRegexCommand.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Interpreter/CommandReturnObject.h"
@@ -17,7 +16,7 @@ using namespace lldb_private;
// CommandObjectRegexCommand constructor
CommandObjectRegexCommand::CommandObjectRegexCommand(
CommandInterpreter &interpreter, llvm::StringRef name, llvm::StringRef help,
- llvm::StringRef syntax, uint32_t max_matches, uint32_t completion_type_mask,
+ llvm::StringRef syntax, uint32_t max_matches, uint32_t completion_type_mask,
bool is_removable)
: CommandObjectRaw(interpreter, name, help, syntax),
m_max_matches(max_matches), m_completion_type_mask(completion_type_mask),
diff --git a/lldb/source/Commands/CommandObjectRegexCommand.h b/lldb/source/Commands/CommandObjectRegexCommand.h
new file mode 100644
index 0000000..2f65c2c
--- /dev/null
+++ b/lldb/source/Commands/CommandObjectRegexCommand.h
@@ -0,0 +1,61 @@
+//===-- CommandObjectRegexCommand.h -----------------------------*- C++ -*-===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_INTERPRETER_COMMANDOBJECTREGEXCOMMAND_H
+#define LLDB_INTERPRETER_COMMANDOBJECTREGEXCOMMAND_H
+
+#include <list>
+
+#include "lldb/Interpreter/CommandObject.h"
+#include "lldb/Utility/CompletionRequest.h"
+#include "lldb/Utility/RegularExpression.h"
+
+namespace lldb_private {
+
+// CommandObjectRegexCommand
+
+class CommandObjectRegexCommand : public CommandObjectRaw {
+public:
+ CommandObjectRegexCommand(CommandInterpreter &interpreter,
+ llvm::StringRef name, llvm::StringRef help,
+ llvm::StringRef syntax, uint32_t max_matches,
+ uint32_t completion_type_mask, bool is_removable);
+
+ ~CommandObjectRegexCommand() override;
+
+ bool IsRemovable() const override { return m_is_removable; }
+
+ bool AddRegexCommand(llvm::StringRef re_cstr, llvm::StringRef command_cstr);
+
+ bool HasRegexEntries() const { return !m_entries.empty(); }
+
+ void HandleCompletion(CompletionRequest &request) override;
+
+protected:
+ bool DoExecute(llvm::StringRef command, CommandReturnObject &result) override;
+
+ struct Entry {
+ RegularExpression regex;
+ std::string command;
+ };
+
+ typedef std::list<Entry> EntryCollection;
+ const uint32_t m_max_matches;
+ const uint32_t m_completion_type_mask;
+ EntryCollection m_entries;
+ bool m_is_removable;
+
+private:
+ CommandObjectRegexCommand(const CommandObjectRegexCommand &) = delete;
+ const CommandObjectRegexCommand &
+ operator=(const CommandObjectRegexCommand &) = delete;
+};
+
+} // namespace lldb_private
+
+#endif // LLDB_INTERPRETER_COMMANDOBJECTREGEXCOMMAND_H
diff --git a/lldb/source/Interpreter/CommandObjectScript.cpp b/lldb/source/Commands/CommandObjectScript.cpp
index e5ae244..e5ae244 100644
--- a/lldb/source/Interpreter/CommandObjectScript.cpp
+++ b/lldb/source/Commands/CommandObjectScript.cpp
diff --git a/lldb/source/Interpreter/CommandObjectScript.h b/lldb/source/Commands/CommandObjectScript.h
index 40abf8b..40abf8b 100644
--- a/lldb/source/Interpreter/CommandObjectScript.h
+++ b/lldb/source/Commands/CommandObjectScript.h
diff --git a/lldb/source/Interpreter/CMakeLists.txt b/lldb/source/Interpreter/CMakeLists.txt
index 7a8c826..af9b0ce 100644
--- a/lldb/source/Interpreter/CMakeLists.txt
+++ b/lldb/source/Interpreter/CMakeLists.txt
@@ -11,8 +11,6 @@ add_lldb_library(lldbInterpreter
CommandHistory.cpp
CommandInterpreter.cpp
CommandObject.cpp
- CommandObjectRegexCommand.cpp
- CommandObjectScript.cpp
CommandOptionValidators.cpp
CommandReturnObject.cpp
OptionArgParser.cpp
diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp
index 60e0834..8c77227 100644
--- a/lldb/source/Interpreter/CommandInterpreter.cpp
+++ b/lldb/source/Interpreter/CommandInterpreter.cpp
@@ -12,9 +12,6 @@
#include <string>
#include <vector>
-#include "CommandObjectScript.h"
-#include "lldb/Interpreter/CommandObjectRegexCommand.h"
-
#include "Commands/CommandObjectApropos.h"
#include "Commands/CommandObjectBreakpoint.h"
#include "Commands/CommandObjectCommands.h"
@@ -30,8 +27,10 @@
#include "Commands/CommandObjectPlugin.h"
#include "Commands/CommandObjectProcess.h"
#include "Commands/CommandObjectQuit.h"
+#include "Commands/CommandObjectRegexCommand.h"
#include "Commands/CommandObjectRegister.h"
#include "Commands/CommandObjectReproducer.h"
+#include "Commands/CommandObjectScript.h"
#include "Commands/CommandObjectSession.h"
#include "Commands/CommandObjectSettings.h"
#include "Commands/CommandObjectSource.h"