summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Molenda <jmolenda@apple.com>2015-10-22 03:50:28 +0000
committerJason Molenda <jmolenda@apple.com>2015-10-22 03:50:28 +0000
commit9c077cf33d5a42ee0763d18228d59561f82c8917 (patch)
tree01bd56788c39e76dba8485692a1506e98538e4df
parent75f96bcfc4e884853512eb196aabe95bcde95902 (diff)
downloadbcm5719-llvm-9c077cf33d5a42ee0763d18228d59561f82c8917.tar.gz
bcm5719-llvm-9c077cf33d5a42ee0763d18228d59561f82c8917.zip
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> llvm-svn: 250979
-rw-r--r--lldb/source/Core/ModuleList.cpp55
1 files changed, 43 insertions, 12 deletions
diff --git a/lldb/source/Core/ModuleList.cpp b/lldb/source/Core/ModuleList.cpp
index 0116bf67a75..75b2ca11103 100644
--- a/lldb/source/Core/ModuleList.cpp
+++ b/lldb/source/Core/ModuleList.cpp
@@ -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
{
OpenPOWER on IntegriCloud