llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: Ebuka Ezike (da-viper)

<details>
<summary>Changes</summary>

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

---
Full diff: https://github.com/llvm/llvm-project/pull/176998.diff


2 Files Affected:

- (modified) lldb/source/Interpreter/CommandInterpreter.cpp (+2-1) 
- (modified) 
lldb/test/API/functionalities/plugins/command_plugin/TestPluginCommands.py 
(+3-1) 


``````````diff
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(

``````````

</details>


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

Reply via email to