[Lldb-commits] [lldb] r136765 - /lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp
Greg Clayton
gclayton at apple.com
Tue Aug 2 21:39:36 PDT 2011
Author: gclayton
Date: Tue Aug 2 23:39:36 2011
New Revision: 136765
URL: http://llvm.org/viewvc/llvm-project?rev=136765&view=rev
Log:
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.
Modified:
lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp
Modified: lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp?rev=136765&r1=136764&r2=136765&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp Tue Aug 2 23:39:36 2011
@@ -244,41 +244,33 @@
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;
}
More information about the lldb-commits
mailing list