Author: Ebuka Ezike
Date: 2026-01-21T12:28:22Z
New Revision: a97ee96383a9e66fa8a42bb7b23535f141343911

URL: 
https://github.com/llvm/llvm-project/commit/a97ee96383a9e66fa8a42bb7b23535f141343911
DIFF: 
https://github.com/llvm/llvm-project/commit/a97ee96383a9e66fa8a42bb7b23535f141343911.diff

LOG: [lldb] Check multiword command in `UserCommandExists` (#176998)

User created multiword command is not reported when querying
`SBCommandInterpreter::UserCommandExists`

Added: 
    

Modified: 
    lldb/source/Interpreter/CommandInterpreter.cpp
    lldb/test/API/functionalities/plugins/command_plugin/TestPluginCommands.py

Removed: 
    


################################################################################
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(


        
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to