[Lldb-commits] [lldb] [lldb] Check multiword command in `UserCommandExists` (PR #176998)
Ebuka Ezike via lldb-commits
lldb-commits at lists.llvm.org
Tue Jan 20 11:01:30 PST 2026
https://github.com/da-viper created https://github.com/llvm/llvm-project/pull/176998
User created multiword command is not reported when querying `SBCommandInterpreter::UserCommandExists`
>From 706399f6e4f736b083b1e30f8670926382fdffb1 Mon Sep 17 00:00:00 2001
From: Ebuka Ezike <yerimyah1 at gmail.com>
Date: Tue, 20 Jan 2026 18:59:38 +0000
Subject: [PATCH] [lldb] Check multiword command in `UserCommandExists`
User created multiword command is not reported when querying
`SBCommandInterpreter::UserCommandExists`
---
lldb/source/Interpreter/CommandInterpreter.cpp | 3 ++-
.../plugins/command_plugin/TestPluginCommands.py | 4 +++-
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp
index 7be7ce000ee60..fdde65428326c 100644
--- a/lldb/source/Interpreter/CommandInterpreter.cpp
+++ b/lldb/source/Interpreter/CommandInterpreter.cpp
@@ -1544,7 +1544,8 @@ bool CommandInterpreter::AliasExists(llvm::StringRef cmd) const {
}
bool CommandInterpreter::UserCommandExists(llvm::StringRef cmd) const {
- return m_user_dict.find(cmd) != m_user_dict.end();
+ return llvm::is_contained(m_user_dict, cmd) ||
+ llvm::is_contained(m_user_mw_dict, cmd);
}
bool CommandInterpreter::UserMultiwordCommandExists(llvm::StringRef cmd) const {
diff --git a/lldb/test/API/functionalities/plugins/command_plugin/TestPluginCommands.py b/lldb/test/API/functionalities/plugins/command_plugin/TestPluginCommands.py
index d2df036683bf6..f7fb0ed7fd680 100644
--- a/lldb/test/API/functionalities/plugins/command_plugin/TestPluginCommands.py
+++ b/lldb/test/API/functionalities/plugins/command_plugin/TestPluginCommands.py
@@ -31,10 +31,12 @@ def test_load_plugin(self):
retobj = lldb.SBCommandReturnObject()
- retval = self.dbg.GetCommandInterpreter().HandleCommand(
+ cinterpreter = self.dbg.GetCommandInterpreter()
+ retval = cinterpreter.HandleCommand(
"plugin load %s" % self.getBuildArtifact(plugin_lib_name), retobj
)
+ self.assertTrue(cinterpreter.UserCommandExists("plugin_loaded_command"))
retobj.Clear()
retval = self.dbg.GetCommandInterpreter().HandleCommand(
More information about the lldb-commits
mailing list