[Lldb-commits] [lldb] r275151 - Add some safety checks to Platform::GetRemoteSharedModule so if it

Jason Molenda via lldb-commits lldb-commits at lists.llvm.org
Mon Jul 11 20:25:22 PDT 2016


Author: jmolenda
Date: Mon Jul 11 22:25:22 2016
New Revision: 275151

URL: http://llvm.org/viewvc/llvm-project?rev=275151&view=rev
Log:
Add some safety checks to Platform::GetRemoteSharedModule so if it
is passed a ModuleSpec with a UUID, it won't accept a file it finds
with a matching FileSpec & ArchSpec, but with a different UUID.

<rdar://problem/27258864> 

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

Modified: lldb/trunk/source/Target/Platform.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Platform.cpp?rev=275151&r1=275150&r2=275151&view=diff
==============================================================================
--- lldb/trunk/source/Target/Platform.cpp (original)
+++ lldb/trunk/source/Target/Platform.cpp Mon Jul 11 22:25:22 2016
@@ -1802,14 +1802,30 @@ Platform::GetRemoteSharedModule (const M
     {
         // Try to get module information from the process
         if (process->GetModuleSpec (module_spec.GetFileSpec (), module_spec.GetArchitecture (), resolved_module_spec))
-            got_module_spec = true;
+        {
+            if (module_spec.GetUUID().IsValid() == false || module_spec.GetUUID() == resolved_module_spec.GetUUID())
+            {
+                got_module_spec = true;
+            }
+        }
     }
 
     if (!got_module_spec)
     {
         // Get module information from a target.
         if (!GetModuleSpec (module_spec.GetFileSpec (), module_spec.GetArchitecture (), resolved_module_spec))
-            return module_resolver (module_spec);
+        {
+            if (module_spec.GetUUID().IsValid() == false || module_spec.GetUUID() == resolved_module_spec.GetUUID())
+            {
+                return module_resolver (module_spec);
+            }
+        }
+    }
+
+    // If we are looking for a specific UUID, make sure resolved_module_spec has the same one before we search.
+    if (module_spec.GetUUID().IsValid())
+    {
+        resolved_module_spec.GetUUID() = module_spec.GetUUID();
     }
 
     // Trying to find a module by UUID on local file system.




More information about the lldb-commits mailing list