aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Interpreter/CommandInterpreter.cpp
diff options
context:
space:
mode:
authorwalter erquinigo <walter@modular.com>2023-04-26 19:09:26 -0500
committerwalter erquinigo <walter@modular.com>2023-04-26 19:31:19 -0500
commitb1465cd49efcbc114a75220b153f5a055ce7911f (patch)
tree590bbc4b010cf791e1ce78e345d41a6d73dde848 /lldb/source/Interpreter/CommandInterpreter.cpp
parentd7fa92126cc398b993f301273816739b23ed8740 (diff)
downloadllvm-b1465cd49efcbc114a75220b153f5a055ce7911f.zip
llvm-b1465cd49efcbc114a75220b153f5a055ce7911f.tar.gz
llvm-b1465cd49efcbc114a75220b153f5a055ce7911f.tar.bz2
[lldb] Create a way to force remove commands
Some LLDB set ups need to hide certain commands for security reasons, so I'm adding a flag that allows removing non-user commands. Differential Revision: https://reviews.llvm.org/D149312
Diffstat (limited to 'lldb/source/Interpreter/CommandInterpreter.cpp')
-rw-r--r--lldb/source/Interpreter/CommandInterpreter.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp
index 09fc8e2..cee17df 100644
--- a/lldb/source/Interpreter/CommandInterpreter.cpp
+++ b/lldb/source/Interpreter/CommandInterpreter.cpp
@@ -1374,11 +1374,12 @@ bool CommandInterpreter::RemoveAlias(llvm::StringRef alias_name) {
return false;
}
-bool CommandInterpreter::RemoveCommand(llvm::StringRef cmd) {
+bool CommandInterpreter::RemoveCommand(llvm::StringRef cmd, bool force) {
auto pos = m_command_dict.find(std::string(cmd));
if (pos != m_command_dict.end()) {
- if (pos->second->IsRemovable()) {
- // Only regular expression objects or python commands are removable
+ if (force || pos->second->IsRemovable()) {
+ // Only regular expression objects or python commands are removable under
+ // normal circumstances.
m_command_dict.erase(pos);
return true;
}