[Lldb-commits] [lldb] r331012 - Fix a thinko in the iteration over StructuredDataPlugin Create functions.

Jim Ingham via lldb-commits lldb-commits at lists.llvm.org
Thu Apr 26 18:57:40 PDT 2018


Author: jingham
Date: Thu Apr 26 18:57:40 2018
New Revision: 331012

URL: http://llvm.org/viewvc/llvm-project?rev=331012&view=rev
Log:
Fix a thinko in the iteration over StructuredDataPlugin Create functions.

The code was grabbing the first plugin, and then never getting
another one.

<rdar://problem/39779438>

Modified:
    lldb/trunk/source/Target/Process.cpp

Modified: lldb/trunk/source/Target/Process.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=331012&r1=331011&r2=331012&view=diff
==============================================================================
--- lldb/trunk/source/Target/Process.cpp (original)
+++ lldb/trunk/source/Target/Process.cpp Thu Apr 26 18:57:40 2018
@@ -6177,11 +6177,16 @@ void Process::MapSupportedStructuredData
 
   // For each StructuredDataPlugin, if the plugin handles any of the
   // types in the supported_type_names, map that type name to that plugin.
-  uint32_t plugin_index = 0;
-  for (auto create_instance =
+  // Stop when we've consumed all the type names.
+  // FIXME: should we return an error if there are type names nobody 
+  // supports?
+  for (uint32_t plugin_index = 0; !const_type_names.empty(); plugin_index++) {
+    auto create_instance =
            PluginManager::GetStructuredDataPluginCreateCallbackAtIndex(
                plugin_index);
-       create_instance && !const_type_names.empty(); ++plugin_index) {
+    if (!create_instance)
+      break;
+      
     // Create the plugin.
     StructuredDataPluginSP plugin_sp = (*create_instance)(*this);
     if (!plugin_sp) {




More information about the lldb-commits mailing list