summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2011-08-03 04:39:36 +0000
committerGreg Clayton <gclayton@apple.com>2011-08-03 04:39:36 +0000
commitfad9eef23bb17c79ef2cb124f21c4507c8358439 (patch)
tree36311f899fc47a452bfda331798e7e5441810762
parent9910bc855d55b4958182321cfc81140346aa2e9f (diff)
downloadbcm5719-llvm-fad9eef23bb17c79ef2cb124f21c4507c8358439.tar.gz
bcm5719-llvm-fad9eef23bb17c79ef2cb124f21c4507c8358439.zip
Fixed an issue with parsing object files from .a archives.
The entire .a file gets cached, and after the first .o file gets loaded, a cached version would get used when trying to extract the skinny slice from a fat BSD archive and would cause a code path to get taken in the BSD archive parser even if we aren't at a BSD archive offset. llvm-svn: 136765
-rw-r--r--lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp32
1 files changed, 12 insertions, 20 deletions
diff --git a/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp b/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp
index 757d0d13535..26cd0365b84 100644
--- a/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp
+++ b/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp
@@ -244,41 +244,33 @@ ObjectContainer *
ObjectContainerBSDArchive::CreateInstance
(
Module* module,
- DataBufferSP& dataSP,
+ DataBufferSP& data_sp,
const FileSpec *file,
addr_t offset,
addr_t length)
{
- if (file)
+ if (file && data_sp && ObjectContainerBSDArchive::MagicBytesMatch(data_sp))
{
- std::string object;
-
Archive::shared_ptr archive_sp (Archive::FindCachedArchive (*file, module->GetArchitecture(), module->GetModificationTime()));
-
+
if (archive_sp)
{
// We already have this archive in our cache, use it
- std::auto_ptr<ObjectContainerBSDArchive> container_ap(new ObjectContainerBSDArchive (module, dataSP, file, offset, length));
+ std::auto_ptr<ObjectContainerBSDArchive> container_ap(new ObjectContainerBSDArchive (module, data_sp, file, offset, length));
if (container_ap.get())
{
container_ap->SetArchive (archive_sp);
return container_ap.release();
}
}
-
- if (dataSP)
- {
- if (ObjectContainerBSDArchive::MagicBytesMatch(dataSP))
- {
- // Read everything since we need that in order to index all the
- // objects in the archive
- dataSP = file->ReadFileContents(offset, length);
-
- std::auto_ptr<ObjectContainerBSDArchive> container_ap(new ObjectContainerBSDArchive (module, dataSP, file, offset, length));
- if (container_ap->ParseHeader())
- return container_ap.release();
- }
- }
+
+ // Read everything since we need that in order to index all the
+ // objects in the archive
+ data_sp = file->ReadFileContents(offset, length);
+
+ std::auto_ptr<ObjectContainerBSDArchive> container_ap(new ObjectContainerBSDArchive (module, data_sp, file, offset, length));
+ if (container_ap->ParseHeader())
+ return container_ap.release();
}
return NULL;
}
OpenPOWER on IntegriCloud