Added the ability to extract a ModuleSpecList (a new class) from an ObjectFile. This is designed to be used when you have an object file that contains one or more architectures (MacOSX universal (fat) files) and/or one or more objects (BSD archive (.a files)).

There is a new static ObjectFile function you can call:

size_t
ObjectFile::GetModuleSpecifications (const FileSpec &file,
                                     lldb::offset_t file_offset,
                                     ModuleSpecList &specs)

This will fill in "specs" which the details of all the module specs (file + arch + UUID (if there is one) + object name (for BSD archive objects eventually) + file offset to the object in question).

This helps us when a user specifies a file that contains a single architecture, and also helps us when we are given a debug symbol file (like a dSYM file on MacOSX) that contains one or more architectures and we need to be able to match it up to an existing Module that has no debug info.

llvm-svn: 180224
diff --git a/lldb/source/Core/PluginManager.cpp b/lldb/source/Core/PluginManager.cpp
index 4498182..0cc916b 100644
--- a/lldb/source/Core/PluginManager.cpp
+++ b/lldb/source/Core/PluginManager.cpp
@@ -870,7 +870,9 @@
     ObjectFileInstance() :
         name(),
         description(),
-        create_callback(NULL)
+        create_callback(NULL),
+        create_memory_callback (NULL),
+        get_module_specifications (NULL)
     {
     }
 
@@ -878,7 +880,7 @@
     std::string description;
     ObjectFileCreateInstance create_callback;
     ObjectFileCreateMemoryInstance create_memory_callback;
-
+    ObjectFileGetModuleSpecifications get_module_specifications;
 };
 
 typedef std::vector<ObjectFileInstance> ObjectFileInstances;
@@ -899,13 +901,11 @@
 
 
 bool
-PluginManager::RegisterPlugin
-(
-    const char *name,
-    const char *description,
-    ObjectFileCreateInstance create_callback,
-    ObjectFileCreateMemoryInstance create_memory_callback
-)
+PluginManager::RegisterPlugin (const char *name,
+                               const char *description,
+                               ObjectFileCreateInstance create_callback,
+                               ObjectFileCreateMemoryInstance create_memory_callback,
+                               ObjectFileGetModuleSpecifications get_module_specifications)
 {
     if (create_callback)
     {
@@ -916,6 +916,7 @@
             instance.description = description;
         instance.create_callback = create_callback;
         instance.create_memory_callback = create_memory_callback;
+        instance.get_module_specifications = get_module_specifications;
         Mutex::Locker locker (GetObjectFileMutex ());
         GetObjectFileInstances ().push_back (instance);
     }
@@ -964,6 +965,16 @@
     return NULL;
 }
 
+ObjectFileGetModuleSpecifications
+PluginManager::GetObjectFileGetModuleSpecificationsCallbackAtIndex (uint32_t idx)
+{
+    Mutex::Locker locker (GetObjectFileMutex ());
+    ObjectFileInstances &instances = GetObjectFileInstances ();
+    if (idx < instances.size())
+        return instances[idx].get_module_specifications;
+    return NULL;
+}
+
 ObjectFileCreateInstance
 PluginManager::GetObjectFileCreateCallbackForPluginName (const char *name)
 {
@@ -1012,13 +1023,16 @@
     ObjectContainerInstance() :
         name(),
         description(),
-        create_callback(NULL)
+        create_callback (NULL),
+        get_module_specifications (NULL)
     {
     }
 
     std::string name;
     std::string description;
     ObjectContainerCreateInstance create_callback;
+    ObjectFileGetModuleSpecifications get_module_specifications;
+
 };
 
 typedef std::vector<ObjectContainerInstance> ObjectContainerInstances;
@@ -1038,12 +1052,10 @@
 }
 
 bool
-PluginManager::RegisterPlugin
-(
-    const char *name,
-    const char *description,
-    ObjectContainerCreateInstance create_callback
-)
+PluginManager::RegisterPlugin (const char *name,
+                               const char *description,
+                               ObjectContainerCreateInstance create_callback,
+                               ObjectFileGetModuleSpecifications get_module_specifications)
 {
     if (create_callback)
     {
@@ -1053,6 +1065,7 @@
         if (description && description[0])
             instance.description = description;
         instance.create_callback = create_callback;
+        instance.get_module_specifications = get_module_specifications;
         Mutex::Locker locker (GetObjectContainerMutex ());
         GetObjectContainerInstances ().push_back (instance);
     }
@@ -1109,6 +1122,16 @@
     return NULL;
 }
 
+ObjectFileGetModuleSpecifications
+PluginManager::GetObjectContainerGetModuleSpecificationsCallbackAtIndex (uint32_t idx)
+{
+    Mutex::Locker locker (GetObjectContainerMutex ());
+    ObjectContainerInstances &instances = GetObjectContainerInstances ();
+    if (idx < instances.size())
+        return instances[idx].get_module_specifications;
+    return NULL;
+}
+
 #pragma mark LogChannel
 
 struct LogInstance