Author: jmolenda
Date: Wed Oct 21 22:50:28 2015
New Revision: 250979

URL: http://llvm.org/viewvc/llvm-project?rev=250979&view=rev
Log:
Change ModuleList::GetSharedModule so that it will reject "stub
libraries" altogether.  On Mac/iOS, these are libraries which have
a UUID and nlist records but no text or data.  If one of these
gets into the global module list, every time we try to search
for a given filename/arch/UUID, we'll get this stub library back.
We need to prevent them from getting added to the module list
altogether.

I thought about doing this down in ObjectFileMachO -- just rejecting
the file as a valid binary file altogether -- but Greg didn't want
to take that hard line approach at this point, he wanted to keep
the ability for lldb to read one of these if someone wanted to in
the future.

<rdar://problem/23035075> 


Modified:
    lldb/trunk/source/Core/ModuleList.cpp

Modified: lldb/trunk/source/Core/ModuleList.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ModuleList.cpp?rev=250979&r1=250978&r2=250979&view=diff
==============================================================================
--- lldb/trunk/source/Core/ModuleList.cpp (original)
+++ lldb/trunk/source/Core/ModuleList.cpp Wed Oct 21 22:50:28 2015
@@ -989,18 +989,31 @@ ModuleList::GetSharedModule
         // If we get in here we got the correct arch, now we just need
         // to verify the UUID if one was given
         if (uuid_ptr && *uuid_ptr != module_sp->GetUUID())
+        {
             module_sp.reset();
+        }
         else
         {
-            if (did_create_ptr)
-                *did_create_ptr = true;
+            if (module_sp->GetObjectFile() && 
module_sp->GetObjectFile()->GetType() == ObjectFile::eTypeStubLibrary)
+            {
+                module_sp.reset();
+            }
+            else
+            {
+                if (did_create_ptr)
+                {
+                    *did_create_ptr = true;
+                }
 
-            shared_module_list.ReplaceEquivalent(module_sp);
-            return error;
+                shared_module_list.ReplaceEquivalent(module_sp);
+                return error;
+            }
         }
     }
     else
+    {
         module_sp.reset();
+    }
 
     if (module_search_paths_ptr)
     {
@@ -1024,18 +1037,29 @@ ModuleList::GetSharedModule
                 // If we get in here we got the correct arch, now we just need
                 // to verify the UUID if one was given
                 if (uuid_ptr && *uuid_ptr != module_sp->GetUUID())
+                {
                     module_sp.reset();
+                }
                 else
                 {
-                    if (did_create_ptr)
-                        *did_create_ptr = true;
-
-                    shared_module_list.ReplaceEquivalent(module_sp);
-                    return Error();
+                    if (module_sp->GetObjectFile()->GetType() == 
ObjectFile::eTypeStubLibrary)
+                    {
+                        module_sp.reset();
+                    }
+                    else
+                    {
+                        if (did_create_ptr)
+                            *did_create_ptr = true;
+    
+                        shared_module_list.ReplaceEquivalent(module_sp);
+                        return Error();
+                    }
                 }
             }
             else
+            {
                 module_sp.reset();
+            }
         }
     }
 
@@ -1119,10 +1143,17 @@ ModuleList::GetSharedModule
             // By getting the object file we can guarantee that the 
architecture matches
             if (module_sp && module_sp->GetObjectFile())
             {
-                if (did_create_ptr)
-                    *did_create_ptr = true;
+                if (module_sp->GetObjectFile()->GetType() == 
ObjectFile::eTypeStubLibrary)
+                {
+                    module_sp.reset();
+                }
+                else
+                {
+                    if (did_create_ptr)
+                        *did_create_ptr = true;
 
-                shared_module_list.ReplaceEquivalent(module_sp);
+                    shared_module_list.ReplaceEquivalent(module_sp);
+                }
             }
             else
             {


_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to