summaryrefslogtreecommitdiffstats
path: root/lldb/source
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source')
-rw-r--r--lldb/source/API/SBThread.cpp2
-rw-r--r--lldb/source/Core/Disassembler.cpp2
-rw-r--r--lldb/source/Core/Module.cpp8
-rw-r--r--lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp35
-rw-r--r--lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h19
-rw-r--r--lldb/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.cpp9
-rw-r--r--lldb/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.h2
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp21
-rw-r--r--lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp142
-rw-r--r--lldb/source/Symbol/ObjectFile.cpp105
-rw-r--r--lldb/source/Symbol/SymbolVendor.cpp15
-rw-r--r--lldb/source/Target/Process.cpp2
12 files changed, 180 insertions, 182 deletions
diff --git a/lldb/source/API/SBThread.cpp b/lldb/source/API/SBThread.cpp
index 90efc458da7..3f6a751d641 100644
--- a/lldb/source/API/SBThread.cpp
+++ b/lldb/source/API/SBThread.cpp
@@ -79,7 +79,7 @@ SBThread::~SBThread()
bool
SBThread::IsValid() const
{
- return m_opaque_sp != NULL;
+ return m_opaque_sp;
}
void
diff --git a/lldb/source/Core/Disassembler.cpp b/lldb/source/Core/Disassembler.cpp
index 40b6c780b4f..4d8247937d1 100644
--- a/lldb/source/Core/Disassembler.cpp
+++ b/lldb/source/Core/Disassembler.cpp
@@ -512,7 +512,7 @@ Instruction::ReadArray (FILE *in_file, Stream *out_stream, OptionValue::Type dat
{
if (!fgets (buffer, 1023, in_file))
{
- out_stream->Printf ("Instruction::ReadArray: Erroe reading file (fgets).\n");
+ out_stream->Printf ("Instruction::ReadArray: Error reading file (fgets).\n");
option_value_sp.reset ();
return option_value_sp;
}
diff --git a/lldb/source/Core/Module.cpp b/lldb/source/Core/Module.cpp
index 66195780020..d54f9699a49 100644
--- a/lldb/source/Core/Module.cpp
+++ b/lldb/source/Core/Module.cpp
@@ -68,7 +68,7 @@ Module::Module(const FileSpec& file_spec, const ArchSpec& arch, const ConstStrin
m_platform_file(),
m_object_name (),
m_object_offset (object_offset),
- m_objfile_ap (),
+ m_objfile_sp (),
m_symfile_ap (),
m_ast (),
m_did_load_objfile (false),
@@ -124,7 +124,7 @@ Module::~Module()
// here because symbol files can require the module object file. So we tear
// down the symbol file first, then the object file.
m_symfile_ap.reset();
- m_objfile_ap.reset();
+ m_objfile_sp.reset();
}
@@ -636,9 +636,9 @@ Module::GetObjectFile()
m_did_load_objfile = true;
Timer scoped_timer(__PRETTY_FUNCTION__,
"Module::GetObjectFile () module = %s", GetFileSpec().GetFilename().AsCString(""));
- m_objfile_ap.reset(ObjectFile::FindPlugin(this, &m_file, m_object_offset, m_file.GetByteSize()));
+ m_objfile_sp = ObjectFile::FindPlugin(this, &m_file, m_object_offset, m_file.GetByteSize());
}
- return m_objfile_ap.get();
+ return m_objfile_sp.get();
}
diff --git a/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp b/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp
index 26cd0365b84..771b00dd823 100644
--- a/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp
+++ b/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp
@@ -160,14 +160,33 @@ ObjectContainerBSDArchive::Archive::FindCachedArchive (const FileSpec &file, con
Mutex::Locker locker(Archive::GetArchiveCacheMutex ());
shared_ptr archive_sp;
Archive::Map &archive_map = Archive::GetArchiveCache ();
- Archive::Map::iterator pos;
- for (pos = archive_map.find (file); pos != archive_map.end() && pos->first == file; ++pos)
+ Archive::Map::iterator pos = archive_map.find (file);
+ // Don't cache a value for "archive_map.end()" below since we might
+ // delete an archive entry...
+ while (pos != archive_map.end() && pos->first == file)
{
- if (pos->second->GetArchitecture() == arch &&
- pos->second->GetModificationTime() == time)
+ if (pos->second->GetArchitecture() == arch)
{
- archive_sp = pos->second;
+ if (pos->second->GetModificationTime() == time)
+ {
+ return pos->second;
+ }
+ else
+ {
+ // We have a file at the same path with the same architecture
+ // whose modification time doesn't match. It doesn't make sense
+ // for us to continue to use this BSD archive since we cache only
+ // the object info which consists of file time info and also the
+ // file offset and file size of any contianed objects. Since
+ // this information is now out of date, we won't get the correct
+ // information if we go and extract the file data, so we should
+ // remove the old and outdated entry.
+ archive_map.erase (pos);
+ pos = archive_map.find (file);
+ continue;
+ }
}
+ ++pos;
}
return archive_sp;
}
@@ -266,7 +285,7 @@ ObjectContainerBSDArchive::CreateInstance
// Read everything since we need that in order to index all the
// objects in the archive
- data_sp = file->ReadFileContents(offset, length);
+ data_sp = file->MemoryMapFileContents (offset, length);
std::auto_ptr<ObjectContainerBSDArchive> container_ap(new ObjectContainerBSDArchive (module, data_sp, file, offset, length));
if (container_ap->ParseHeader())
@@ -363,7 +382,7 @@ ObjectContainerBSDArchive::Dump (Stream *s) const
s->EOL();
}
-ObjectFile *
+ObjectFileSP
ObjectContainerBSDArchive::GetObjectFile (const FileSpec *file)
{
if (m_module->GetObjectName() && m_archive_sp)
@@ -372,7 +391,7 @@ ObjectContainerBSDArchive::GetObjectFile (const FileSpec *file)
if (object)
return ObjectFile::FindPlugin (m_module, file, m_offset + object->ar_file_offset, object->ar_file_size);
}
- return NULL;
+ return ObjectFileSP();
}
diff --git a/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h b/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h
index 2b45a13d111..9343831997b 100644
--- a/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h
+++ b/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h
@@ -63,10 +63,17 @@ public:
virtual bool
ParseHeader ();
+ virtual size_t
+ GetNumObjects () const
+ {
+ if (m_archive_sp)
+ return m_archive_sp->GetNumObjects();
+ return 0;
+ }
virtual void
Dump (lldb_private::Stream *s) const;
- virtual lldb_private::ObjectFile *
+ virtual lldb::ObjectFileSP
GetObjectFile (const lldb_private::FileSpec *file);
//------------------------------------------------------------------
@@ -101,6 +108,7 @@ protected:
uint32_t ar_size; // size in bytes
uint32_t ar_file_offset; // file offset in bytes from the beginning of the file of the object data
uint32_t ar_file_size; // length of the object data
+ lldb::ObjectFileSP object_file_sp;
typedef std::vector<Object> collection;
typedef collection::iterator iterator;
@@ -136,6 +144,12 @@ protected:
~Archive ();
size_t
+ GetNumObjects () const
+ {
+ return m_objects.size();
+ }
+
+ size_t
ParseObjects (lldb_private::DataExtractor &data);
Object *
@@ -152,6 +166,9 @@ protected:
{
return m_arch;
}
+
+ bool
+ HasNoExternalReferences() const;
protected:
diff --git a/lldb/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.cpp b/lldb/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.cpp
index 83c58250a94..218e97e08d3 100644
--- a/lldb/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.cpp
+++ b/lldb/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.cpp
@@ -196,7 +196,7 @@ ObjectContainerUniversalMachO::GetArchitectureAtIndex (uint32_t idx, ArchSpec& a
return false;
}
-ObjectFile *
+ObjectFileSP
ObjectContainerUniversalMachO::GetObjectFile (const FileSpec *file)
{
uint32_t arch_idx = 0;
@@ -219,11 +219,14 @@ ObjectContainerUniversalMachO::GetObjectFile (const FileSpec *file)
{
if (arch == curr_arch)
{
- return ObjectFile::FindPlugin (m_module, file, m_offset + m_fat_archs[arch_idx].offset, m_fat_archs[arch_idx].size);
+ return ObjectFile::FindPlugin (m_module,
+ file,
+ m_offset + m_fat_archs[arch_idx].offset,
+ m_fat_archs[arch_idx].size);
}
}
}
- return NULL;
+ return ObjectFileSP();
}
diff --git a/lldb/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.h b/lldb/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.h
index 8cc0fbd1e35..989fd6df01a 100644
--- a/lldb/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.h
+++ b/lldb/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.h
@@ -68,7 +68,7 @@ public:
virtual bool
GetArchitectureAtIndex (uint32_t cpu_idx, lldb_private::ArchSpec& arch) const;
- virtual lldb_private::ObjectFile *
+ virtual lldb::ObjectFileSP
GetObjectFile (const lldb_private::FileSpec *file);
//------------------------------------------------------------------
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
index f615dc4342b..92c6f8f808d 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
@@ -166,19 +166,14 @@ SymbolFileDWARFDebugMap::GetModuleByCompUnitInfo (CompileUnitInfo *comp_unit_inf
if (oso_symbol)
{
FileSpec oso_file_spec(oso_symbol->GetMangled().GetName().AsCString(), true);
- // Don't allow cached .o files since we dress up each .o file with
- // new sections. We want them to be in the module list so we can
- // always find a shared pointer to the module but just don't share them.
- const bool always_create = true;
- ModuleList::GetSharedModule (oso_file_spec,
- m_obj_file->GetModule()->GetArchitecture(),
- NULL, // lldb_private::UUID pointer
- NULL, // object name
- 0, // object offset
- comp_unit_info->oso_module_sp,
- NULL,
- NULL,
- always_create);
+ // Always create a new module for .o files. Why? Because we
+ // use the debug map, to add new sections to each .o file and
+ // even though a .o file might not have changed, the sections
+ // that get added to the .o file can change.
+ comp_unit_info->oso_module_sp = new Module (oso_file_spec,
+ m_obj_file->GetModule()->GetArchitecture(),
+ NULL,
+ 0);
}
}
return comp_unit_info->oso_module_sp.get();
diff --git a/lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp b/lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp
index 3dd4a4d34bc..9b112205d61 100644
--- a/lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp
+++ b/lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp
@@ -50,132 +50,6 @@ UUIDsMatch(Module *module, ObjectFile *ofile)
return false;
}
-
-//ObjectFile *
-//LocateDSYMMachFileInDSYMBundle (Module* module, FileSpec& dsym_fspec)
-//{
-// ObjectFile *dsym_objfile = NULL;
-//
-// char path[PATH_MAX];
-//
-// if (dsym_fspec.GetPath(path, sizeof(path)))
-// {
-// size_t path_len = strlen(path);
-// const char *bundle_subpath = "/Contents/Resources/DWARF/";
-// if (path_len > 0)
-// {
-// if (path[path_len-1] == '/')
-// ::strncat (path, bundle_subpath + 1, sizeof(path));
-// else
-// ::strncat (path, bundle_subpath, sizeof(path));
-// ::strncat (path, dsym_fspec.GetFilename().AsCString(), sizeof(path));
-//
-// path_len = strlen(path);
-//
-// if (::strcasecmp (&path[path_len - strlen(".dSYM")], ".dSYM") == 0)
-// {
-// path[path_len - ::strlen(".dSYM")] = '\0';
-// dsym_fspec.SetFile(path);
-// dsym_objfile = ObjectFile::FindPlugin(module, &dsym_fspec, 0);
-// }
-// }
-// }
-// return dsym_objfile;
-//}
-//
-//CFURLRef DBGCopyFullDSYMURLForUUID (CFUUIDRef uuid, CFURLRef exec_url) __attribute__((weak_import));
-
-
-//ObjectFile *
-//FindDSYMUsingDebugSymbols (Module* module, FileSpec& dsym_fspec)
-//{
-// Timer scoped_locate("FindDSYMUsingDebugSymbols");
-// dsym_fspec.Clear();
-// ObjectFile *dsym_objfile = NULL;
-// if (module->GetUUID().IsValid())
-// {
-// // Try and locate the dSYM file using DebugSymbols first
-// const UInt8 *module_uuid = (const UInt8 *)module->GetUUID().GetBytes();
-// if (module_uuid != NULL)
-// {
-// CFUUIDRef module_uuid_ref;
-// module_uuid_ref = ::CFUUIDCreateWithBytes ( NULL,
-// module_uuid[0],
-// module_uuid[1],
-// module_uuid[2],
-// module_uuid[3],
-// module_uuid[4],
-// module_uuid[5],
-// module_uuid[6],
-// module_uuid[7],
-// module_uuid[8],
-// module_uuid[9],
-// module_uuid[10],
-// module_uuid[11],
-// module_uuid[12],
-// module_uuid[13],
-// module_uuid[14],
-// module_uuid[15]);
-//
-// if (module_uuid_ref)
-// {
-// CFURLRef dsym_url = NULL;
-// CFURLRef exec_url = NULL;
-//
-// // if (DBGCopyFullDSYMURLForUUID)
-// {
-// char exec_path[PATH_MAX];
-// if (module->GetFileSpec().GetPath(exec_path, sizeof(exec_path)))
-// {
-// exec_url = CFURLCreateFromFileSystemRepresentation ( NULL,
-// (const UInt8 *)exec_path,
-// strlen(exec_path),
-// FALSE);
-// }
-//
-// dsym_url = DBGCopyFullDSYMURLForUUID(module_uuid_ref, exec_url);
-// }
-// // else
-// // {
-// // dsym_url = DBGCopyDSYMURLForUUID(module_uuid_ref);
-// // }
-//
-// if (exec_url)
-// {
-// ::CFRelease (exec_url);
-// exec_url = NULL;
-// }
-//
-// ::CFRelease(module_uuid_ref);
-// module_uuid_ref = NULL;
-//
-// if (dsym_url)
-// {
-// char dsym_path[PATH_MAX];
-// Boolean success = CFURLGetFileSystemRepresentation (dsym_url, true, (UInt8*)dsym_path, sizeof(dsym_path)-1);
-//
-// ::CFRelease(dsym_url), dsym_url = NULL;
-//
-// if (success)
-// {
-// dsym_fspec.SetFile(dsym_path);
-//
-// // Some newer versions of DebugSymbols will return a full path into a dSYM bundle
-// // that points to the correct mach file within the dSYM bundle (MH_DSYM mach file
-// // type).
-// dsym_objfile = ObjectFile::FindPlugin(module, &dsym_fspec, 0);
-//
-// // Olders versions of DebugSymbols will return a path to a dSYM bundle.
-// if (dsym_objfile == NULL)
-// dsym_objfile = LocateDSYMMachFileInDSYMBundle (module, dsym_fspec);
-// }
-// }
-// }
-// }
-// }
-// return dsym_objfile;
-//}
-
static void
ReplaceDSYMSectionsWithExecutableSections (ObjectFile *exec_objfile, ObjectFile *dsym_objfile)
{
@@ -266,7 +140,7 @@ SymbolVendorMacOSX::CreateInstance(Module* module)
module->GetFileSpec().GetFilename().AsCString());
FileSpec dsym_fspec;
- std::auto_ptr<ObjectFile> dsym_objfile_ap;
+ ObjectFileSP dsym_objfile_sp;
const FileSpec &file_spec = obj_file->GetFileSpec();
if (file_spec)
{
@@ -274,20 +148,20 @@ SymbolVendorMacOSX::CreateInstance(Module* module)
if (dsym_fspec)
{
- dsym_objfile_ap.reset(ObjectFile::FindPlugin(module, &dsym_fspec, 0, dsym_fspec.GetByteSize()));
- if (UUIDsMatch(module, dsym_objfile_ap.get()))
+ dsym_objfile_sp = ObjectFile::FindPlugin(module, &dsym_fspec, 0, dsym_fspec.GetByteSize());
+ if (UUIDsMatch(module, dsym_objfile_sp.get()))
{
- ReplaceDSYMSectionsWithExecutableSections (obj_file, dsym_objfile_ap.get());
- symbol_vendor->AddSymbolFileRepresendation(dsym_objfile_ap.release());
+ ReplaceDSYMSectionsWithExecutableSections (obj_file, dsym_objfile_sp.get());
+ symbol_vendor->AddSymbolFileRepresendation(dsym_objfile_sp);
return symbol_vendor;
}
}
}
// Just create our symbol vendor using the current objfile as this is either
- // an executable with no dSYM (that we could locate), and executable with
- // a dSYM that has a UUID that doesn't match, or it is a dSYM file itself.
- symbol_vendor->AddSymbolFileRepresendation(obj_file);
+ // an executable with no dSYM (that we could locate), an executable with
+ // a dSYM that has a UUID that doesn't match.
+ symbol_vendor->AddSymbolFileRepresendation(obj_file->GetSP());
}
}
return symbol_vendor;
diff --git a/lldb/source/Symbol/ObjectFile.cpp b/lldb/source/Symbol/ObjectFile.cpp
index 3bb23727200..7411c0cdf5f 100644
--- a/lldb/source/Symbol/ObjectFile.cpp
+++ b/lldb/source/Symbol/ObjectFile.cpp
@@ -8,6 +8,8 @@
//===----------------------------------------------------------------------===//
#include "lldb/lldb-private.h"
+#include "lldb/lldb-private-log.h"
+#include "lldb/Core/Log.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/PluginManager.h"
#include "lldb/Core/RegularExpression.h"
@@ -19,15 +21,15 @@
using namespace lldb;
using namespace lldb_private;
-ObjectFile*
-ObjectFile::FindPlugin (Module* module, const FileSpec* file, lldb::addr_t file_offset, lldb::addr_t file_size)
+ObjectFileSP
+ObjectFile::FindPlugin (Module* module, const FileSpec* file, addr_t file_offset, addr_t file_size)
{
Timer scoped_timer (__PRETTY_FUNCTION__,
"ObjectFile::FindPlugin (module = %s/%s, file = %p, file_offset = 0x%z8.8x, file_size = 0x%z8.8x)",
module->GetFileSpec().GetDirectory().AsCString(),
module->GetFileSpec().GetFilename().AsCString(),
file, file_offset, file_size);
- std::auto_ptr<ObjectFile> object_file_ap;
+ ObjectFileSP object_file_sp;
if (module != NULL)
{
@@ -72,9 +74,9 @@ ObjectFile::FindPlugin (Module* module, const FileSpec* file, lldb::addr_t file_
ObjectFileCreateInstance create_object_file_callback;
for (idx = 0; (create_object_file_callback = PluginManager::GetObjectFileCreateCallbackAtIndex(idx)) != NULL; ++idx)
{
- object_file_ap.reset (create_object_file_callback(module, file_header_data_sp, file, file_offset, file_size));
- if (object_file_ap.get())
- return object_file_ap.release();
+ object_file_sp.reset (create_object_file_callback(module, file_header_data_sp, file, file_offset, file_size));
+ if (object_file_sp.get())
+ return object_file_sp;
}
// Check if this is a object container by iterating through
@@ -86,14 +88,87 @@ ObjectFile::FindPlugin (Module* module, const FileSpec* file, lldb::addr_t file_
std::auto_ptr<ObjectContainer> object_container_ap(create_object_container_callback(module, file_header_data_sp, file, file_offset, file_size));
if (object_container_ap.get())
- object_file_ap.reset (object_container_ap->GetObjectFile(file));
+ object_file_sp = object_container_ap->GetObjectFile(file);
- if (object_file_ap.get())
- return object_file_ap.release();
+ if (object_file_sp.get())
+ return object_file_sp;
}
}
}
- return NULL;
+ // We didn't find it, so clear our shared pointer in case it
+ // contains anything and return an empty shared pointer
+ object_file_sp.reset();
+ return object_file_sp;
+}
+
+ObjectFile::ObjectFile (Module* module,
+ const FileSpec *file_spec_ptr,
+ addr_t offset,
+ addr_t length,
+ DataBufferSP& headerDataSP) :
+ ModuleChild (module),
+ m_file (), // This file could be different from the original module's file
+ m_type (eTypeInvalid),
+ m_strata (eStrataInvalid),
+ m_offset (offset),
+ m_length (length),
+ m_data (headerDataSP, endian::InlHostByteOrder(), 4),
+ m_unwind_table (*this)
+{
+ if (file_spec_ptr)
+ m_file = *file_spec_ptr;
+ LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
+ if (log)
+ {
+ if (m_file)
+ {
+ log->Printf ("%p ObjectFile::ObjectFile () module = %s/%s, file = %s/%s, offset = 0x%8.8llx, size = %llu\n",
+ this,
+ m_module->GetFileSpec().GetDirectory().AsCString(),
+ m_module->GetFileSpec().GetFilename().AsCString(),
+ m_file.GetDirectory().AsCString(),
+ m_file.GetFilename().AsCString(),
+ m_offset,
+ m_length);
+ }
+ else
+ {
+ log->Printf ("%p ObjectFile::ObjectFile () module = %s/%s, file = <NULL>, offset = 0x%8.8llx, size = %llu\n",
+ this,
+ m_module->GetFileSpec().GetDirectory().AsCString(),
+ m_module->GetFileSpec().GetFilename().AsCString(),
+ m_offset,
+ m_length);
+ }
+ }
+}
+
+ObjectFile::~ObjectFile()
+{
+ LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
+ if (log)
+ {
+ if (m_file)
+ {
+ log->Printf ("%p ObjectFile::~ObjectFile () module = %s/%s, file = %s/%s, offset = 0x%8.8llx, size = %llu\n",
+ this,
+ m_module->GetFileSpec().GetDirectory().AsCString(),
+ m_module->GetFileSpec().GetFilename().AsCString(),
+ m_file.GetDirectory().AsCString(),
+ m_file.GetFilename().AsCString(),
+ m_offset,
+ m_length);
+ }
+ else
+ {
+ log->Printf ("%p ObjectFile::~ObjectFile () module = %s/%s, file = <NULL>, offset = 0x%8.8llx, size = %llu\n",
+ this,
+ m_module->GetFileSpec().GetDirectory().AsCString(),
+ m_module->GetFileSpec().GetFilename().AsCString(),
+ m_offset,
+ m_length);
+ }
+ }
}
bool
@@ -103,7 +178,7 @@ ObjectFile::SetModulesArchitecture (const ArchSpec &new_arch)
}
AddressClass
-ObjectFile::GetAddressClass (lldb::addr_t file_addr)
+ObjectFile::GetAddressClass (addr_t file_addr)
{
Symtab *symtab = GetSymtab();
if (symtab)
@@ -188,4 +263,12 @@ ObjectFile::GetAddressClass (lldb::addr_t file_addr)
return eAddressClassUnknown;
}
+ObjectFileSP
+ObjectFile::GetSP ()
+{
+ // This object contains an instrusive ref count base class so we can
+ // easily make a shared pointer to this object
+ return ObjectFileSP (this);
+}
+
diff --git a/lldb/source/Symbol/SymbolVendor.cpp b/lldb/source/Symbol/SymbolVendor.cpp
index 391d22529b0..b228780e8de 100644
--- a/lldb/source/Symbol/SymbolVendor.cpp
+++ b/lldb/source/Symbol/SymbolVendor.cpp
@@ -55,7 +55,11 @@ SymbolVendor::FindPlugin (Module* module)
// file representation for the module.
instance_ap.reset(new SymbolVendor(module));
if (instance_ap.get())
- instance_ap->AddSymbolFileRepresendation(module->GetObjectFile());
+ {
+ ObjectFile *objfile = module->GetObjectFile();
+ if (objfile)
+ instance_ap->AddSymbolFileRepresendation(objfile->GetSP());
+ }
return instance_ap.release();
}
@@ -82,11 +86,14 @@ SymbolVendor::~SymbolVendor()
// Add a represantion given an object file.
//----------------------------------------------------------------------
void
-SymbolVendor::AddSymbolFileRepresendation(ObjectFile *obj_file)
+SymbolVendor::AddSymbolFileRepresendation(const ObjectFileSP &objfile_sp)
{
Mutex::Locker locker(m_mutex);
- if (obj_file != NULL)
- m_sym_file_ap.reset(SymbolFile::FindPlugin(obj_file));
+ if (objfile_sp)
+ {
+ m_objfile_sp = objfile_sp;
+ m_sym_file_ap.reset(SymbolFile::FindPlugin(objfile_sp.get()));
+ }
}
bool
diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp
index c1deb46ac5d..417c274d5dd 100644
--- a/lldb/source/Target/Process.cpp
+++ b/lldb/source/Target/Process.cpp
@@ -3381,7 +3381,7 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx,
uint32_t selected_tid;
StackID selected_stack_id;
- if (selected_thread_sp != NULL)
+ if (selected_thread_sp)
{
selected_tid = selected_thread_sp->GetIndexID();
selected_stack_id = selected_thread_sp->GetSelectedFrame()->GetStackID();
OpenPOWER on IntegriCloud