[Lldb-commits] [lldb] r151476 - in /lldb/trunk: include/lldb/ include/lldb/Core/ include/lldb/Host/ include/lldb/Target/ source/API/ source/Commands/ source/Core/ source/Host/common/ source/Host/macosx/ source/Plugins/DynamicLoader/Darwin-Kernel/ source/Plugins/DynamicLoader/MacOSX-DYLD/ source/Plugins/Platform/MacOSX/ source/Plugins/Process/gdb-remote/ source/Plugins/Process/mach-core/ source/Plugins/SymbolVendor/MacOSX/ source/Symbol/ source/Target/

Greg Clayton gclayton at apple.com
Sat Feb 25 21:51:37 PST 2012


Author: gclayton
Date: Sat Feb 25 23:51:37 2012
New Revision: 151476

URL: http://llvm.org/viewvc/llvm-project?rev=151476&view=rev
Log:
Made a ModuleSpec class in Module.h which can specify a module using one or
more of the local path, platform path, associated symbol file, UUID, arch,
object name and object offset. This allows many of the calls that were
GetSharedModule to reduce the number of arguments that were used in a call
to these functions. It also allows a module to be created with a ModuleSpec
which allows many things to be specified prior to any accessors being called
on the Module class itself. 

I was running into problems when adding support for "target symbol add"
where you can specify a stand alone debug info file after debugging has started
where I needed to specify the associated symbol file path and if I waited until
after construction, the wrong  symbol file had already been located. By using
the ModuleSpec it allows us to construct a module with as little or as much
information as needed and not have to change the parameter list.


Modified:
    lldb/trunk/include/lldb/Core/Module.h
    lldb/trunk/include/lldb/Core/ModuleList.h
    lldb/trunk/include/lldb/Host/Symbols.h
    lldb/trunk/include/lldb/Target/Platform.h
    lldb/trunk/include/lldb/Target/Target.h
    lldb/trunk/include/lldb/lldb-forward.h
    lldb/trunk/source/API/SBTarget.cpp
    lldb/trunk/source/Commands/CommandObjectSource.cpp
    lldb/trunk/source/Commands/CommandObjectTarget.cpp
    lldb/trunk/source/Core/Module.cpp
    lldb/trunk/source/Core/ModuleList.cpp
    lldb/trunk/source/Host/common/Symbols.cpp
    lldb/trunk/source/Host/macosx/Symbols.cpp
    lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
    lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
    lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
    lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.h
    lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp
    lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h
    lldb/trunk/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp
    lldb/trunk/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.h
    lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
    lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.cpp
    lldb/trunk/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp
    lldb/trunk/source/Symbol/SymbolContext.cpp
    lldb/trunk/source/Target/Platform.cpp
    lldb/trunk/source/Target/Target.cpp

Modified: lldb/trunk/include/lldb/Core/Module.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Module.h?rev=151476&r1=151475&r2=151476&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/Module.h (original)
+++ lldb/trunk/include/lldb/Core/Module.h Sat Feb 25 23:51:37 2012
@@ -43,6 +43,243 @@
 //----------------------------------------------------------------------
 namespace lldb_private {
 
+class ModuleSpec
+{
+public:
+    ModuleSpec () :
+        m_file (),
+        m_platform_file (),
+        m_symbol_file (),
+        m_arch (),
+        m_uuid (),
+        m_object_name (),
+        m_object_offset (0)
+    {
+    }
+
+    ModuleSpec (const FileSpec &file_spec) :
+        m_file (file_spec),
+        m_platform_file (),
+        m_symbol_file (),
+        m_arch (),
+        m_uuid (),
+        m_object_name (),
+        m_object_offset (0)
+    {
+    }
+
+    ModuleSpec (const FileSpec &file_spec, const ArchSpec &arch) :
+        m_file (file_spec),
+        m_platform_file (),
+        m_symbol_file (),
+        m_arch (arch),
+        m_uuid (),
+        m_object_name (),
+        m_object_offset (0)
+    {
+    }
+    
+    ModuleSpec (const ModuleSpec &rhs) :
+        m_file (rhs.m_file),
+        m_platform_file (rhs.m_platform_file),
+        m_symbol_file (rhs.m_symbol_file),
+        m_arch (rhs.m_arch),
+        m_uuid (rhs.m_uuid),
+        m_object_name (rhs.m_object_name),
+        m_object_offset (rhs.m_object_offset)
+    {
+    }
+
+    ModuleSpec &
+    operator = (const ModuleSpec &rhs)
+    {
+        if (this != &rhs)
+        {
+            m_file = rhs.m_file;
+            m_platform_file = rhs.m_platform_file;
+            m_symbol_file = rhs.m_symbol_file;
+            m_arch = rhs.m_arch;
+            m_uuid = rhs.m_uuid;
+            m_object_name = rhs.m_object_name;
+            m_object_offset = rhs.m_object_offset;
+        }
+        return *this;
+    }
+
+    FileSpec *
+    GetFileSpecPtr ()
+    {
+        if (m_file)
+            return &m_file;
+        return NULL;
+    }
+
+    const FileSpec *
+    GetFileSpecPtr () const
+    {
+        if (m_file)
+            return &m_file;
+        return NULL;
+    }
+    
+    FileSpec &
+    GetFileSpec ()
+    {
+        return m_file;
+    }
+    const FileSpec &
+    GetFileSpec () const
+    {
+        return m_file;
+    }
+
+    FileSpec *
+    GetPlatformFileSpecPtr ()
+    {
+        if (m_platform_file)
+            return &m_platform_file;
+        return NULL;
+    }
+
+    const FileSpec *
+    GetPlatformFileSpecPtr () const
+    {
+        if (m_platform_file)
+            return &m_platform_file;
+        return NULL;
+    }
+
+    FileSpec &
+    GetPlatformFileSpec ()
+    {
+        return m_platform_file;
+    }
+
+    const FileSpec &
+    GetPlatformFileSpec () const
+    {
+        return m_platform_file;
+    }
+
+    FileSpec *
+    GetSymbolFileSpecPtr ()
+    {
+        if (m_symbol_file)
+            return &m_symbol_file;
+        return NULL;
+    }
+    
+    const FileSpec *
+    GetSymbolFileSpecPtr () const
+    {
+        if (m_symbol_file)
+            return &m_symbol_file;
+        return NULL;
+    }
+    
+    FileSpec &
+    GetSymbolFileSpec ()
+    {
+        return m_symbol_file;
+    }
+    
+    const FileSpec &
+    GetSymbolFileSpec () const
+    {
+        return m_symbol_file;
+    }
+
+    
+    ArchSpec *
+    GetArchitecturePtr ()
+    {
+        if (m_arch.IsValid())
+            return &m_arch;
+        return NULL;
+    }
+    
+    const ArchSpec *
+    GetArchitecturePtr () const
+    {
+        if (m_arch.IsValid())
+            return &m_arch;
+        return NULL;
+    }
+    
+    ArchSpec &
+    GetArchitecture ()
+    {
+        return m_arch;
+    }
+    
+    const ArchSpec &
+    GetArchitecture () const
+    {
+        return m_arch;
+    }
+
+    UUID *
+    GetUUIDPtr ()
+    {
+        if (m_uuid.IsValid())
+            return &m_uuid;
+        return NULL;
+    }
+    
+    const UUID *
+    GetUUIDPtr () const
+    {
+        if (m_uuid.IsValid())
+            return &m_uuid;
+        return NULL;
+    }
+    
+    UUID &
+    GetUUID ()
+    {
+        return m_uuid;
+    }
+    
+    const UUID &
+    GetUUID () const
+    {
+        return m_uuid;
+    }
+
+    ConstString &
+    GetObjectName ()
+    {
+        return m_object_name;
+    }
+
+    const ConstString &
+    GetObjectName () const
+    {
+        return m_object_name;
+    }
+
+    uint64_t
+    GetObjectOffset () const
+    {
+        return m_object_offset;
+    }
+
+    void
+    SetObjectOffset (uint64_t object_offset)
+    {
+        m_object_offset = object_offset;
+    }
+
+protected:
+    FileSpec m_file;
+    FileSpec m_platform_file;
+    FileSpec m_symbol_file;
+    ArchSpec m_arch;
+    UUID m_uuid;
+    ConstString m_object_name;
+    uint64_t m_object_offset;
+};
+
 class Module :
     public std::tr1::enable_shared_from_this<Module>,
     public SymbolContextScope
@@ -96,12 +333,15 @@
             const ConstString *object_name = NULL,
             off_t object_offset = 0);
 
+    Module (const ModuleSpec &module_spec);
     //------------------------------------------------------------------
     /// Destructor.
     //------------------------------------------------------------------
     virtual 
     ~Module ();
 
+    bool
+    MatchesModuleSpec (const ModuleSpec &module_ref);
     
     //------------------------------------------------------------------
     /// Set the load address for all sections in a module to be the

Modified: lldb/trunk/include/lldb/Core/ModuleList.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ModuleList.h?rev=151476&r1=151475&r2=151476&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/ModuleList.h (original)
+++ lldb/trunk/include/lldb/Core/ModuleList.h Sat Feb 25 23:51:37 2012
@@ -275,10 +275,7 @@
     ///     The number of matching modules found by the search.
     //------------------------------------------------------------------
     size_t
-    FindModules (const FileSpec *file_spec_ptr,
-                 const ArchSpec *arch_ptr,
-                 const lldb_private::UUID *uuid_ptr,
-                 const ConstString *object_name,
+    FindModules (const ModuleSpec &module_spec,
                  ModuleList& matching_module_list) const;
 
     lldb::ModuleSP
@@ -295,14 +292,7 @@
     FindModule (const UUID &uuid);
     
     lldb::ModuleSP
-    FindFirstModuleForFileSpec (const FileSpec &file_spec,
-                                const ArchSpec *arch_ptr,
-                                const ConstString *object_name);
-
-    lldb::ModuleSP
-    FindFirstModuleForPlatormFileSpec (const FileSpec &platform_file_spec, 
-                                       const ArchSpec *arch_ptr,
-                                       const ConstString *object_name);
+    FindFirstModule (const ModuleSpec &module_spec);
 
     size_t
     FindSymbolsWithNameAndType (const ConstString &name,
@@ -410,11 +400,7 @@
     ModuleIsInCache (const Module *module_ptr);
 
     static Error
-    GetSharedModule (const FileSpec& file_spec,
-                     const ArchSpec& arch,
-                     const lldb_private::UUID *uuid_ptr,
-                     const ConstString *object_name,
-                     off_t object_offset,
+    GetSharedModule (const ModuleSpec &module_spec,
                      lldb::ModuleSP &module_sp,
                      const FileSpecList *module_search_paths_ptr,
                      lldb::ModuleSP *old_module_sp_ptr,
@@ -425,10 +411,7 @@
     RemoveSharedModule (lldb::ModuleSP &module_sp);
 
     static size_t
-    FindSharedModules (const FileSpec& in_file_spec,
-                       const ArchSpec& arch,
-                       const lldb_private::UUID *uuid_ptr,
-                       const ConstString *object_name_ptr,
+    FindSharedModules (const ModuleSpec &module_spec,
                        ModuleList &matching_module_list);
 
     static uint32_t

Modified: lldb/trunk/include/lldb/Host/Symbols.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/Symbols.h?rev=151476&r1=151475&r2=151476&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/Symbols.h (original)
+++ lldb/trunk/include/lldb/Host/Symbols.h Sat Feb 25 23:51:37 2012
@@ -25,10 +25,10 @@
 {
 public:
     static FileSpec
-    LocateExecutableObjectFile (const FileSpec *in_exec, const ArchSpec* arch, const lldb_private::UUID *uuid);
+    LocateExecutableObjectFile (const ModuleSpec &module_spec);
 
     static FileSpec
-    LocateExecutableSymbolFile (const FileSpec *in_exec, const ArchSpec* arch, const lldb_private::UUID *uuid);
+    LocateExecutableSymbolFile (const ModuleSpec &module_spec);
 };
 
 } // namespace lldb_private

Modified: lldb/trunk/include/lldb/Target/Platform.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Platform.h?rev=151476&r1=151475&r2=151476&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/Platform.h (original)
+++ lldb/trunk/include/lldb/Target/Platform.h Sat Feb 25 23:51:37 2012
@@ -232,11 +232,7 @@
                  FileSpec &local_file);
 
         virtual Error
-        GetSharedModule (const FileSpec &platform_file, 
-                         const ArchSpec &arch,
-                         const UUID *uuid_ptr,
-                         const ConstString *object_name_ptr,
-                         off_t object_offset,
+        GetSharedModule (const ModuleSpec &module_spec, 
                          lldb::ModuleSP &module_sp,
                          const FileSpecList *module_search_paths_ptr,
                          lldb::ModuleSP *old_module_sp_ptr,

Modified: lldb/trunk/include/lldb/Target/Target.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Target.h?rev=151476&r1=151475&r2=151476&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/Target.h (original)
+++ lldb/trunk/include/lldb/Target/Target.h Sat Feb 25 23:51:37 2012
@@ -346,11 +346,7 @@
     UpdateInstanceName ();
 
     lldb::ModuleSP
-    GetSharedModule (const FileSpec& file_spec,
-                     const ArchSpec& arch,
-                     const lldb_private::UUID *uuid = NULL,
-                     const ConstString *object_name = NULL,
-                     off_t object_offset = 0,
+    GetSharedModule (const ModuleSpec &module_spec,
                      Error *error_ptr = NULL);
 private:
     //------------------------------------------------------------------

Modified: lldb/trunk/include/lldb/lldb-forward.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-forward.h?rev=151476&r1=151475&r2=151476&view=diff
==============================================================================
--- lldb/trunk/include/lldb/lldb-forward.h (original)
+++ lldb/trunk/include/lldb/lldb-forward.h Sat Feb 25 23:51:37 2012
@@ -107,6 +107,7 @@
 class   Mangled;
 class   Module;
 class   ModuleList;
+class   ModuleSpec;
 class   Mutex;
 struct  NameSearchContext;
 class   ObjCLanguageRuntime;

Modified: lldb/trunk/source/API/SBTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTarget.cpp?rev=151476&r1=151475&r2=151476&view=diff
==============================================================================
--- lldb/trunk/source/API/SBTarget.cpp (original)
+++ lldb/trunk/source/API/SBTarget.cpp Sat Feb 25 23:51:37 2012
@@ -1627,22 +1627,17 @@
     TargetSP target_sp(GetSP());
     if (target_sp)
     {
-        FileSpec module_file_spec;
-        UUID module_uuid;
-        ArchSpec module_arch;
-
+        ModuleSpec module_spec;
         if (path)
-            module_file_spec.SetFile(path, false);
+            module_spec.GetFileSpec().SetFile(path, false);
 
         if (uuid_cstr)
-            module_uuid.SetfromCString(uuid_cstr);
+            module_spec.GetUUID().SetfromCString(uuid_cstr);
 
         if (triple)
-            module_arch.SetTriple (triple, target_sp->GetPlatform ().get());
+            module_spec.GetArchitecture().SetTriple (triple, target_sp->GetPlatform ().get());
 
-        sb_module.SetSP(target_sp->GetSharedModule (module_file_spec,
-                                                      module_arch,
-                                                      uuid_cstr ? &module_uuid : NULL));
+        sb_module.SetSP(target_sp->GetSharedModule (module_spec));
     }
     return sb_module;
 }
@@ -1697,8 +1692,9 @@
     TargetSP target_sp(GetSP());
     if (target_sp && sb_file_spec.IsValid())
     {
+        ModuleSpec module_spec(*sb_file_spec);
         // The module list is thread safe, no need to lock
-        sb_module.SetSP (target_sp->GetImages().FindFirstModuleForFileSpec (*sb_file_spec, NULL, NULL));
+        sb_module.SetSP (target_sp->GetImages().FindFirstModule (module_spec));
     }
     return sb_module;
 }

Modified: lldb/trunk/source/Commands/CommandObjectSource.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectSource.cpp?rev=151476&r1=151475&r2=151476&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectSource.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectSource.cpp Sat Feb 25 23:51:37 2012
@@ -308,11 +308,12 @@
                 ModuleList matching_modules;
                 for (unsigned i = 0, e = m_options.modules.size(); i != e; i++)
                 {
-                    FileSpec module_spec(m_options.modules[i].c_str(), false);
-                    if (module_spec)
+                    FileSpec module_file_spec(m_options.modules[i].c_str(), false);
+                    if (module_file_spec)
                     {
+                        ModuleSpec module_spec (module_file_spec);
                         matching_modules.Clear();
-                        target->GetImages().FindModules (&module_spec, NULL, NULL, NULL, matching_modules);
+                        target->GetImages().FindModules (module_spec, matching_modules);
                         num_matches += matching_modules.FindFunctions (name, eFunctionNameTypeAuto, include_symbols, include_inlines, append, sc_list);
                     }
                 }
@@ -502,11 +503,12 @@
                 ModuleList matching_modules;
                 for (unsigned i = 0, e = m_options.modules.size(); i != e; i++)
                 {
-                    FileSpec module_spec(m_options.modules[i].c_str(), false);
-                    if (module_spec)
+                    FileSpec module_file_spec(m_options.modules[i].c_str(), false);
+                    if (module_file_spec)
                     {
+                        ModuleSpec module_spec (module_file_spec);
                         matching_modules.Clear();
-                        target->GetImages().FindModules (&module_spec, NULL, NULL, NULL, matching_modules);
+                        target->GetImages().FindModules (module_spec, matching_modules);
                         num_matches += matching_modules.ResolveSymbolContextForFilePath (filename,
                                                                                          0,
                                                                                          check_inlines,

Modified: lldb/trunk/source/Commands/CommandObjectTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectTarget.cpp?rev=151476&r1=151475&r2=151476&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectTarget.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectTarget.cpp Sat Feb 25 23:51:37 2012
@@ -1658,6 +1658,7 @@
 {
 // Dump specified images (by basename or fullpath)
     FileSpec module_file_spec(module_name, false);
+    ModuleSpec module_spec (module_file_spec);
     
     const size_t initial_size = module_list.GetSize ();
 
@@ -1665,29 +1666,20 @@
     
     if (target)
     {
-        num_matches = target->GetImages().FindModules (&module_file_spec, 
-                                                       NULL, 
-                                                       NULL, 
-                                                       NULL, 
-                                                       module_list);
+        num_matches = target->GetImages().FindModules (module_spec, module_list);
     
         // Not found in our module list for our target, check the main
         // shared module list in case it is a extra file used somewhere
         // else
         if (num_matches == 0)
-            num_matches = ModuleList::FindSharedModules (module_file_spec, 
-                                                         target->GetArchitecture(), 
-                                                         NULL, 
-                                                         NULL, 
-                                                         module_list);
+        {
+            module_spec.GetArchitecture() = target->GetArchitecture();
+            num_matches = ModuleList::FindSharedModules (module_spec, module_list);
+        }
     }
     else
     {
-        num_matches = ModuleList::FindSharedModules (module_file_spec, 
-                                                     ArchSpec(),
-                                                     NULL, 
-                                                     NULL, 
-                                                     module_list);
+        num_matches = ModuleList::FindSharedModules (module_spec,module_list);
     }
     
     if (check_global_list && num_matches == 0)
@@ -1702,7 +1694,7 @@
             
             if (module)
             {
-                if (FileSpec::Equal(module->GetFileSpec(), module_file_spec, true))
+                if (module->MatchesModuleSpec (module_spec))
                 {
                     module_sp = module->shared_from_this();
                     module_list.AppendIfNeeded(module_sp);
@@ -2395,10 +2387,10 @@
                     if (path)
                     {
                         FileSpec file_spec(path, true);
-                        ArchSpec arch;
                         if (file_spec.Exists())
                         {
-                            ModuleSP module_sp (target->GetSharedModule(file_spec, arch));
+                            ModuleSpec module_spec (file_spec);
+                            ModuleSP module_sp (target->GetSharedModule (module_spec));
                             if (!module_sp)
                             {
                                 result.AppendError ("one or more executable image paths must be specified");
@@ -2492,23 +2484,25 @@
         else
         {
             const size_t argc = args.GetArgumentCount();
-            const FileSpec *file_ptr = NULL;
-            const UUID *uuid_ptr = NULL;
+            ModuleSpec module_spec;
+            bool search_using_module_spec = false;
             if (m_file_option.GetOptionValue().OptionWasSet())
-                file_ptr = &m_file_option.GetOptionValue().GetCurrentValue();
+            {
+                search_using_module_spec = true;
+                module_spec.GetFileSpec() = m_file_option.GetOptionValue().GetCurrentValue();
+            }
             
             if (m_uuid_option_group.GetOptionValue().OptionWasSet())
-                uuid_ptr = &m_uuid_option_group.GetOptionValue().GetCurrentValue();
+            {
+                search_using_module_spec = true;
+                module_spec.GetUUID() = m_uuid_option_group.GetOptionValue().GetCurrentValue();
+            }
 
-            if (file_ptr || uuid_ptr)
+            if (search_using_module_spec)
             {
                 
                 ModuleList matching_modules;
-                const size_t num_matches = target->GetImages().FindModules (file_ptr,   // File spec to match (can be NULL to match by UUID only)
-                                                                            NULL,       // Architecture
-                                                                            uuid_ptr,   // UUID to match (can be NULL to not match on UUID)
-                                                                            NULL,       // Object name
-                                                                            matching_modules);
+                const size_t num_matches = target->GetImages().FindModules (module_spec, matching_modules);
 
                 char path[PATH_MAX];
                 if (num_matches == 1)
@@ -2630,13 +2624,14 @@
                 else
                 {
                     char uuid_cstr[64];
-                    if (file_ptr)
-                        file_ptr->GetPath (path, sizeof(path));
+                    
+                    if (module_spec.GetFileSpec())
+                        module_spec.GetFileSpec().GetPath (path, sizeof(path));
                     else
                         path[0] = '\0';
 
-                    if (uuid_ptr)
-                        uuid_ptr->GetAsCString(uuid_cstr, sizeof(uuid_cstr));
+                    if (module_spec.GetUUIDPtr())
+                        module_spec.GetUUID().GetAsCString(uuid_cstr, sizeof(uuid_cstr));
                     else
                         uuid_cstr[0] = '\0';
                     if (num_matches > 1)
@@ -3576,9 +3571,8 @@
                                         
                                         ModuleSP target_exe_module_sp (target->GetExecutableModule());
                                         const bool adding_symbols_to_executable = target_exe_module_sp.get() == old_module_sp.get();
-                                        FileSpec target_module_file (old_module_sp->GetFileSpec());
-                                        ArchSpec target_module_arch (old_module_sp->GetArchitecture());
-
+                                        ModuleSpec module_spec (old_module_sp->GetFileSpec(), old_module_sp->GetArchitecture());
+                                        module_spec.GetSymbolFileSpec() = symfile_spec;
                                         // Unload the old module
                                         ModuleList module_list;
                                         module_list.Append (old_module_sp);
@@ -3590,7 +3584,14 @@
                                         // Now create the new module and load it
                                         module_list.Clear();
                                         //ModuleSP new_module_sp (new Module (target_module_file, target_module_arch));
-                                        ModuleSP new_module_sp (target->GetSharedModule(target_module_file, target_module_arch));
+                                        ModuleSP new_module_sp;
+                                                                
+                                        Error error (ModuleList::GetSharedModule (module_spec, 
+                                                                                  new_module_sp, 
+                                                                                  &target->GetExecutableSearchPaths(),
+                                                                                  NULL,
+                                                                                  NULL));
+                                                        
                                         if (new_module_sp)
                                         {
                                             new_module_sp->SetSymbolFileFileSpec (symfile_module_sp->GetFileSpec());

Modified: lldb/trunk/source/Core/Module.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Module.cpp?rev=151476&r1=151475&r2=151476&view=diff
==============================================================================
--- lldb/trunk/source/Core/Module.cpp (original)
+++ lldb/trunk/source/Core/Module.cpp Sat Feb 25 23:51:37 2012
@@ -114,6 +114,44 @@
 
 #endif
     
+Module::Module (const ModuleSpec &module_spec) :
+    m_mutex (Mutex::eMutexTypeRecursive),
+    m_mod_time (module_spec.GetFileSpec().GetModificationTime()),
+    m_arch (module_spec.GetArchitecture()),
+    m_uuid (),
+    m_file (module_spec.GetFileSpec()),
+    m_platform_file(module_spec.GetPlatformFileSpec()),
+    m_symfile_spec (module_spec.GetSymbolFileSpec()),
+    m_object_name (module_spec.GetObjectName()),
+    m_object_offset (module_spec.GetObjectOffset()),
+    m_objfile_sp (),
+    m_symfile_ap (),
+    m_ast (),
+    m_did_load_objfile (false),
+    m_did_load_symbol_vendor (false),
+    m_did_parse_uuid (false),
+    m_did_init_ast (false),
+    m_is_dynamic_loader_module (false),
+    m_was_modified (false)
+{
+    // Scope for locker below...
+    {
+        Mutex::Locker locker (GetAllocationModuleCollectionMutex());
+        GetModuleCollection().push_back(this);
+    }
+    
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
+    if (log)
+        log->Printf ("%p Module::Module((%s) '%s/%s%s%s%s')",
+                     this,
+                     m_arch.GetArchitectureName(),
+                     m_file.GetDirectory().AsCString(""),
+                     m_file.GetFilename().AsCString(""),
+                     m_object_name.IsEmpty() ? "" : "(",
+                     m_object_name.IsEmpty() ? "" : m_object_name.AsCString(""),
+                     m_object_name.IsEmpty() ? "" : ")");
+}
+
 Module::Module(const FileSpec& file_spec, 
                const ArchSpec& arch, 
                const ConstString *object_name, 
@@ -1073,3 +1111,48 @@
     return false;
 }
 
+
+bool
+Module::MatchesModuleSpec (const ModuleSpec &module_ref)
+{
+    const UUID &uuid = module_ref.GetUUID();
+    
+    if (uuid.IsValid())
+    {
+        // If the UUID matches, then nothing more needs to match...
+        if (uuid == GetUUID())
+            return true;
+        else
+            return false;
+    }
+    
+    const FileSpec &file_spec = module_ref.GetFileSpec();
+    if (file_spec)
+    {
+        if (!FileSpec::Equal (file_spec, m_file, file_spec.GetDirectory()))
+            return false;
+    }
+
+    const FileSpec &platform_file_spec = module_ref.GetPlatformFileSpec();
+    if (platform_file_spec)
+    {
+        if (!FileSpec::Equal (platform_file_spec, m_platform_file, platform_file_spec.GetDirectory()))
+            return false;
+    }
+    
+    const ArchSpec &arch = module_ref.GetArchitecture();
+    if (arch.IsValid())
+    {
+        if (m_arch != arch)
+            return false;
+    }
+    
+    const ConstString &object_name = module_ref.GetObjectName();
+    if (object_name)
+    {
+        if (object_name != GetObjectName())
+            return false;
+    }
+    return true;
+}
+

Modified: lldb/trunk/source/Core/ModuleList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ModuleList.cpp?rev=151476&r1=151475&r2=151476&view=diff
==============================================================================
--- lldb/trunk/source/Core/ModuleList.cpp (original)
+++ lldb/trunk/source/Core/ModuleList.cpp Sat Feb 25 23:51:37 2012
@@ -289,109 +289,18 @@
     return sc_list.GetSize() - initial_size;
 }
 
-class ModuleMatches
-{
-public:
-    //--------------------------------------------------------------
-    /// Construct with the user ID to look for.
-    //--------------------------------------------------------------
-    ModuleMatches (const FileSpec *file_spec_ptr,
-                   const ArchSpec *arch_ptr,
-                   const lldb_private::UUID *uuid_ptr,
-                   const ConstString *object_name,
-                   bool file_spec_is_platform) :
-        m_file_spec_ptr (file_spec_ptr),
-        m_arch_ptr (arch_ptr),
-        m_uuid_ptr (uuid_ptr),
-        m_object_name (object_name),
-        m_file_spec_compare_basename_only (false),
-        m_file_spec_is_platform (file_spec_is_platform)
-    {
-        if (file_spec_ptr)
-            m_file_spec_compare_basename_only = file_spec_ptr->GetDirectory();
-    }
-
-    
-    //--------------------------------------------------------------
-    /// Unary predicate function object callback.
-    //--------------------------------------------------------------
-    bool
-    operator () (const ModuleSP& module_sp) const
-    {
-        if (m_file_spec_ptr)
-        {
-            if (m_file_spec_is_platform)
-            {
-                if (!FileSpec::Equal (*m_file_spec_ptr, 
-                                      module_sp->GetPlatformFileSpec(), 
-                                      m_file_spec_compare_basename_only))
-                    return false;
-        
-            }
-            else
-            {
-                if (!FileSpec::Equal (*m_file_spec_ptr, 
-                                      module_sp->GetFileSpec(), 
-                                      m_file_spec_compare_basename_only))
-                    return false;
-            }
-        }
-
-        if (m_arch_ptr && m_arch_ptr->IsValid())
-        {
-            if (module_sp->GetArchitecture() != *m_arch_ptr)
-                return false;
-        }
-
-        if (m_uuid_ptr && m_uuid_ptr->IsValid())
-        {
-            if (module_sp->GetUUID() != *m_uuid_ptr)
-                return false;
-        }
-
-        if (m_object_name)
-        {
-            if (module_sp->GetObjectName() != *m_object_name)
-                return false;
-        }
-        return true;
-    }
-
-private:
-    //--------------------------------------------------------------
-    // Member variables.
-    //--------------------------------------------------------------
-    const FileSpec *            m_file_spec_ptr;
-    const ArchSpec *            m_arch_ptr;
-    const lldb_private::UUID *  m_uuid_ptr;
-    const ConstString *         m_object_name;
-    bool                        m_file_spec_compare_basename_only;
-    bool                        m_file_spec_is_platform;
-};
-
 size_t
-ModuleList::FindModules
-(
-    const FileSpec *file_spec_ptr,
-    const ArchSpec *arch_ptr,
-    const lldb_private::UUID *uuid_ptr,
-    const ConstString *object_name,
-    ModuleList& matching_module_list
-) const
+ModuleList::FindModules (const ModuleSpec &module_spec, ModuleList& matching_module_list) const
 {
     size_t existing_matches = matching_module_list.GetSize();
-    ModuleMatches matcher (file_spec_ptr, arch_ptr, uuid_ptr, object_name, false);
 
     Mutex::Locker locker(m_modules_mutex);
-    collection::const_iterator end = m_modules.end();
-    collection::const_iterator pos;
-
-    for (pos = std::find_if (m_modules.begin(), end, matcher);
-         pos != end;
-         pos = std::find_if (++pos, end, matcher))
+    collection::const_iterator pos, end = m_modules.end();
+    for (pos = m_modules.begin(); pos != end; ++pos)
     {
         ModuleSP module_sp(*pos);
-        matching_module_list.Append(module_sp);
+        if (module_sp->MatchesModuleSpec (module_spec))
+            matching_module_list.Append(module_sp);
     }
     return matching_module_list.GetSize() - existing_matches;
 }
@@ -464,58 +373,21 @@
 }
 
 ModuleSP
-ModuleList::FindFirstModuleForFileSpec (const FileSpec &file_spec, 
-                                        const ArchSpec *arch_ptr,
-                                        const ConstString *object_name)
+ModuleList::FindFirstModule (const ModuleSpec &module_spec)
 {
     ModuleSP module_sp;
-    ModuleMatches matcher (&file_spec, 
-                           arch_ptr, 
-                           NULL, 
-                           object_name, 
-                           false);
-
-    // Scope for "locker"
+    Mutex::Locker locker(m_modules_mutex);
+    collection::const_iterator pos, end = m_modules.end();
+    for (pos = m_modules.begin(); pos != end; ++pos)
     {
-        Mutex::Locker locker(m_modules_mutex);
-        collection::const_iterator end = m_modules.end();
-        collection::const_iterator pos = m_modules.begin();
-
-        pos = std::find_if (pos, end, matcher);
-        if (pos != end)
-            module_sp = (*pos);
+        ModuleSP module_sp(*pos);
+        if (module_sp->MatchesModuleSpec (module_spec))
+            return module_sp;
     }
     return module_sp;
 
 }
 
-ModuleSP
-ModuleList::FindFirstModuleForPlatormFileSpec (const FileSpec &file_spec, 
-                                               const ArchSpec *arch_ptr,
-                                               const ConstString *object_name)
-{
-    ModuleSP module_sp;
-    ModuleMatches matcher (&file_spec, 
-                           arch_ptr, 
-                           NULL, 
-                           object_name, 
-                           true);
-    
-    // Scope for "locker"
-    {
-        Mutex::Locker locker(m_modules_mutex);
-        collection::const_iterator end = m_modules.end();
-        collection::const_iterator pos = m_modules.begin();
-        
-        pos = std::find_if (pos, end, matcher);
-        if (pos != end)
-            module_sp = (*pos);
-    }
-    return module_sp;
-    
-}
-
-
 size_t
 ModuleList::GetSize() const
 {
@@ -674,17 +546,9 @@
 }
 
 size_t
-ModuleList::FindSharedModules 
-(
-    const FileSpec& in_file_spec,
-    const ArchSpec& arch,
-    const lldb_private::UUID *uuid_ptr,
-    const ConstString *object_name_ptr,
-    ModuleList &matching_module_list
-)
+ModuleList::FindSharedModules (const ModuleSpec &module_spec, ModuleList &matching_module_list)
 {
-    ModuleList &shared_module_list = GetSharedModuleList ();
-    return shared_module_list.FindModules (&in_file_spec, &arch, uuid_ptr, object_name_ptr, matching_module_list);
+    return GetSharedModuleList ().FindModules (module_spec, matching_module_list);
 }
 
 uint32_t
@@ -692,42 +556,11 @@
 {
     return GetSharedModuleList ().RemoveOrphans();    
 }
-//#define ENABLE_MODULE_SP_LOGGING
-#if defined (ENABLE_MODULE_SP_LOGGING)
-#include "lldb/Core/StreamFile.h"
-#include "lldb/Host/Host.h"
-static void 
-ModuleSharedPtrLogger(void* p, const ModuleSP& sp, bool will_decrement)
-{
-    if (sp.get())
-    {
-        const char *module_basename = sp->GetFileSpec().GetFilename().GetCString();
-        // If "p" is set, then it is the basename of a module to watch for. This
-        // basename MUST be uniqued first by getting it from a ConstString or this
-        // won't work.
-        if (p && p != module_basename)
-        {
-            return;
-        }
-        long use_count = sp.use_count();
-        if (will_decrement)
-            --use_count;
-
-        printf("\nModuleSP(%p): %c %p {%lu} %s/%s\n", &sp, will_decrement ? '-' : '+', sp.get(), use_count, sp->GetFileSpec().GetDirectory().GetCString(), module_basename);
-        StreamFile stdout_strm(stdout, false);
-        Host::Backtrace (stdout_strm, 512);
-    }
-}
-#endif
 
 Error
 ModuleList::GetSharedModule
 (
-    const FileSpec& in_file_spec,
-    const ArchSpec& arch,
-    const lldb_private::UUID *uuid_ptr,
-    const ConstString *object_name_ptr,
-    off_t object_offset,
+    const ModuleSpec &module_spec,
     ModuleSP &module_sp,
     const FileSpecList *module_search_paths_ptr,
     ModuleSP *old_module_sp_ptr,
@@ -749,82 +582,68 @@
     if (old_module_sp_ptr)
         old_module_sp_ptr->reset();
 
-
-    // First just try and get the file where it purports to be (path in
-    // in_file_spec), then check and uuid.
-
-    if (in_file_spec)
+    const UUID *uuid_ptr = module_spec.GetUUIDPtr();
+    const FileSpec &module_file_spec = module_spec.GetFileSpec();
+    const ArchSpec &arch = module_spec.GetArchitecture();
+
+    // Make sure no one else can try and get or create a module while this
+    // function is actively working on it by doing an extra lock on the
+    // global mutex list.
+    if (always_create == false)
     {
-        // Make sure no one else can try and get or create a module while this
-        // function is actively working on it by doing an extra lock on the
-        // global mutex list.
-        if (always_create == false)
+        ModuleList matching_module_list;
+        const size_t num_matching_modules = shared_module_list.FindModules (module_spec, matching_module_list);
+        if (num_matching_modules > 0)
         {
-            ModuleList matching_module_list;
-            const size_t num_matching_modules = shared_module_list.FindModules (&in_file_spec, &arch, NULL, object_name_ptr, matching_module_list);
-            if (num_matching_modules > 0)
+            for (uint32_t module_idx = 0; module_idx < num_matching_modules; ++module_idx)
             {
-                for (uint32_t module_idx = 0; module_idx < num_matching_modules; ++module_idx)
+                module_sp = matching_module_list.GetModuleAtIndex(module_idx);
+                if (module_file_spec)
                 {
-                    module_sp = matching_module_list.GetModuleAtIndex(module_idx);
-                    if (uuid_ptr && uuid_ptr->IsValid())
+                    // If we didn't have a UUID in mind when looking for the object file,
+                    // then we should make sure the modification time hasn't changed!
+                    TimeValue file_spec_mod_time(module_file_spec.GetModificationTime());
+                    if (file_spec_mod_time.IsValid())
                     {
-                        // We found the module we were looking for.
-                        if (module_sp->GetUUID() == *uuid_ptr)
+                        if (file_spec_mod_time == module_sp->GetModificationTime())
                             return error;
                     }
-                    else
-                    {
-                        // If we didn't have a UUID in mind when looking for the object file,
-                        // then we should make sure the modification time hasn't changed!
-                        TimeValue file_spec_mod_time(in_file_spec.GetModificationTime());
-                        if (file_spec_mod_time.IsValid())
-                        {
-                            if (file_spec_mod_time == module_sp->GetModificationTime())
-                                return error;
-                        }
-                    }
-                    if (old_module_sp_ptr && !old_module_sp_ptr->get())
-                        *old_module_sp_ptr = module_sp;
-                    shared_module_list.Remove (module_sp);
-                    module_sp.reset();
                 }
+                if (old_module_sp_ptr && !old_module_sp_ptr->get())
+                    *old_module_sp_ptr = module_sp;
+                shared_module_list.Remove (module_sp);
+                module_sp.reset();
             }
         }
+    }
 
+    if (module_sp)
+        return error;
+    else
+    {
+        module_sp.reset (new Module (module_spec));
+        // Make sure there are a module and an object file since we can specify
+        // a valid file path with an architecture that might not be in that file.
+        // By getting the object file we can guarantee that the architecture matches
         if (module_sp)
-            return error;
-        else
         {
-#if defined ENABLE_MODULE_SP_LOGGING
-            ModuleSP logging_module_sp (new Module (in_file_spec, arch, object_name_ptr, object_offset), ModuleSharedPtrLogger, (void *)ConstString("a.out").GetCString());
-            module_sp = logging_module_sp;
-#else
-            module_sp.reset (new Module (in_file_spec, arch, object_name_ptr, object_offset));
-#endif
-            // Make sure there are a module and an object file since we can specify
-            // a valid file path with an architecture that might not be in that file.
-            // By getting the object file we can guarantee that the architecture matches
-            if (module_sp)
+            if (module_sp->GetObjectFile())
             {
-                if (module_sp->GetObjectFile())
+                // 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 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.Append(module_sp);
-                        return error;
-                    }
+                    if (did_create_ptr)
+                        *did_create_ptr = true;
+                    
+                    shared_module_list.Append(module_sp);
+                    return error;
                 }
-                else
-                    module_sp.reset();
             }
+            else
+                module_sp.reset();
         }
     }
 
@@ -834,19 +653,17 @@
 
     // Fixup the incoming path in case the path points to a valid file, yet
     // the arch or UUID (if one was passed in) don't match.
-    FileSpec file_spec = Symbols::LocateExecutableObjectFile (in_file_spec ? &in_file_spec : NULL, 
-                                                              arch.IsValid() ? &arch : NULL, 
-                                                              uuid_ptr);
+    FileSpec file_spec = Symbols::LocateExecutableObjectFile (module_spec);
 
     // Don't look for the file if it appears to be the same one we already
     // checked for above...
-    if (file_spec != in_file_spec)
+    if (file_spec != module_file_spec)
     {
         if (!file_spec.Exists())
         {
             file_spec.GetPath(path, sizeof(path));
             if (path[0] == '\0')
-                in_file_spec.GetPath(path, sizeof(path));
+                module_file_spec.GetPath(path, sizeof(path));
             if (file_spec.Exists())
             {
                 if (uuid_ptr && uuid_ptr->IsValid())
@@ -877,13 +694,13 @@
         // function is actively working on it by doing an extra lock on the
         // global mutex list.
         ModuleList matching_module_list;
-        if (shared_module_list.FindModules (&file_spec, &arch, uuid_ptr, object_name_ptr, matching_module_list) > 0)
+        if (shared_module_list.FindModules (module_spec, matching_module_list) > 0)
         {
             module_sp = matching_module_list.GetModuleAtIndex(0);
 
             // If we didn't have a UUID in mind when looking for the object file,
             // then we should make sure the modification time hasn't changed!
-            if (uuid_ptr == NULL)
+            if (module_spec.GetUUIDPtr() == NULL)
             {
                 TimeValue file_spec_mod_time(file_spec.GetModificationTime());
                 if (file_spec_mod_time.IsValid())
@@ -901,12 +718,7 @@
 
         if (module_sp.get() == NULL)
         {
-#if defined ENABLE_MODULE_SP_LOGGING
-            ModuleSP logging_module_sp (new Module (file_spec, arch, object_name_ptr, object_offset), ModuleSharedPtrLogger, 0);
-            module_sp = logging_module_sp;
-#else
-            module_sp.reset (new Module (file_spec, arch, object_name_ptr, object_offset));
-#endif
+            module_sp.reset (new Module (module_spec));
             // Make sure there are a module and an object file since we can specify
             // a valid file path with an architecture that might not be in that file.
             // By getting the object file we can guarantee that the architecture matches

Modified: lldb/trunk/source/Host/common/Symbols.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Symbols.cpp?rev=151476&r1=151475&r2=151476&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/Symbols.cpp (original)
+++ lldb/trunk/source/Host/common/Symbols.cpp Sat Feb 25 23:51:37 2012
@@ -15,14 +15,14 @@
 #if !defined (__APPLE__)
 
 FileSpec
-Symbols::LocateExecutableObjectFile (const FileSpec *exec_fspec, const ArchSpec* arch, const lldb_private::UUID *uuid)
+Symbols::LocateExecutableObjectFile (const ModuleSpec &module_spec)
 {
     // FIXME
     return FileSpec();
 }
 
 FileSpec
-Symbols::LocateExecutableSymbolFile (const FileSpec *exec_fspec, const ArchSpec* arch, const lldb_private::UUID *uuid)
+Symbols::LocateExecutableSymbolFile (const ModuleSpec &module_spec)
 {
     // FIXME
     return FileSpec();

Modified: lldb/trunk/source/Host/macosx/Symbols.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/macosx/Symbols.cpp?rev=151476&r1=151475&r2=151476&view=diff
==============================================================================
--- lldb/trunk/source/Host/macosx/Symbols.cpp (original)
+++ lldb/trunk/source/Host/macosx/Symbols.cpp Sat Feb 25 23:51:37 2012
@@ -21,6 +21,7 @@
 #include "lldb/Core/ArchSpec.h"
 #include "lldb/Core/DataBuffer.h"
 #include "lldb/Core/DataExtractor.h"
+#include "lldb/Core/Module.h"
 #include "lldb/Core/Timer.h"
 #include "lldb/Core/UUID.h"
 #include "lldb/Host/Endian.h"
@@ -286,9 +287,7 @@
 static int
 LocateMacOSXFilesUsingDebugSymbols
 (
-    const FileSpec *exec_fspec, // An executable path that may or may not be correct if UUID is specified
-    const ArchSpec* arch,       // Limit the search to files with this architecture if non-NULL
-    const lldb_private::UUID *uuid,           // Match the UUID value if non-NULL,
+    const ModuleSpec &module_spec,
     FileSpec *out_exec_fspec,   // If non-NULL, try and find the executable
     FileSpec *out_dsym_fspec    // If non-NULL try and find the debug symbol file
 )
@@ -303,6 +302,9 @@
 
 #if !defined (__arm__) // No DebugSymbols on the iOS devices
 
+    const UUID *uuid = module_spec.GetUUIDPtr();
+    const ArchSpec *arch = module_spec.GetArchitecturePtr();
+
     if (uuid && uuid->IsValid())
     {
         // Try and locate the dSYM file using DebugSymbols first
@@ -330,7 +332,7 @@
             if (module_uuid_ref.get())
             {
                 CFCReleaser<CFURLRef> exec_url;
-
+                const FileSpec *exec_fspec = module_spec.GetFileSpecPtr();
                 if (exec_fspec)
                 {
                     char exec_cf_path[PATH_MAX];
@@ -450,8 +452,9 @@
 }
 
 static bool
-LocateDSYMInVincinityOfExecutable (const FileSpec *exec_fspec, const ArchSpec* arch, const lldb_private::UUID *uuid, FileSpec &dsym_fspec)
+LocateDSYMInVincinityOfExecutable (const ModuleSpec &module_spec, FileSpec &dsym_fspec)
 {
+    const FileSpec *exec_fspec = module_spec.GetFileSpecPtr();
     if (exec_fspec)
     {
         char path[PATH_MAX];
@@ -466,7 +469,7 @@
 
                 dsym_fspec.SetFile(path, false);
 
-                if (dsym_fspec.Exists() && FileAtPathContainsArchAndUUID (dsym_fspec, arch, uuid))
+                if (dsym_fspec.Exists() && FileAtPathContainsArchAndUUID (dsym_fspec, module_spec.GetArchitecturePtr(), module_spec.GetUUIDPtr()))
                 {
                     return true;
                 }
@@ -484,7 +487,7 @@
                             strncat(path, ".dSYM/Contents/Resources/DWARF/", sizeof(path));
                             strncat(path, exec_fspec->GetFilename().AsCString(), sizeof(path));
                             dsym_fspec.SetFile(path, false);
-                            if (dsym_fspec.Exists() && FileAtPathContainsArchAndUUID (dsym_fspec, arch, uuid))
+                            if (dsym_fspec.Exists() && FileAtPathContainsArchAndUUID (dsym_fspec, module_spec.GetArchitecturePtr(), module_spec.GetUUIDPtr()))
                                 return true;
                             else
                             {
@@ -510,8 +513,11 @@
 }
 
 FileSpec
-Symbols::LocateExecutableObjectFile (const FileSpec *exec_fspec, const ArchSpec* arch, const lldb_private::UUID *uuid)
+Symbols::LocateExecutableObjectFile (const ModuleSpec &module_spec)
 {
+    const FileSpec *exec_fspec = module_spec.GetFileSpecPtr();
+    const ArchSpec *arch = module_spec.GetArchitecturePtr();
+    const UUID *uuid = module_spec.GetUUIDPtr();
     Timer scoped_timer (__PRETTY_FUNCTION__,
                         "LocateExecutableObjectFile (file = %s, arch = %s, uuid = %p)",
                         exec_fspec ? exec_fspec->GetFilename().AsCString ("<NULL>") : "<NULL>",
@@ -519,16 +525,20 @@
                         uuid);
 
     FileSpec objfile_fspec;
-    if (exec_fspec && FileAtPathContainsArchAndUUID (*exec_fspec, arch, uuid))
-        objfile_fspec = *exec_fspec;
+    if (exec_fspec && FileAtPathContainsArchAndUUID (exec_fspec, arch, uuid))
+        objfile_fspec = exec_fspec;
     else
-        LocateMacOSXFilesUsingDebugSymbols (exec_fspec, arch, uuid, &objfile_fspec, NULL);
+        LocateMacOSXFilesUsingDebugSymbols (module_spec, &objfile_fspec, NULL);
     return objfile_fspec;
 }
 
 FileSpec
-Symbols::LocateExecutableSymbolFile (const FileSpec *exec_fspec, const ArchSpec* arch, const lldb_private::UUID *uuid)
+Symbols::LocateExecutableSymbolFile (const ModuleSpec &module_spec)
 {
+    const FileSpec *exec_fspec = module_spec.GetFileSpecPtr();
+    const ArchSpec *arch = module_spec.GetArchitecturePtr();
+    const UUID *uuid = module_spec.GetUUIDPtr();
+
     Timer scoped_timer (__PRETTY_FUNCTION__,
                         "LocateExecutableSymbolFile (file = %s, arch = %s, uuid = %p)",
                         exec_fspec ? exec_fspec->GetFilename().AsCString ("<NULL>") : "<NULL>",
@@ -538,10 +548,10 @@
     FileSpec symbol_fspec;
     // First try and find the dSYM in the same directory as the executable or in
     // an appropriate parent directory
-    if (LocateDSYMInVincinityOfExecutable (exec_fspec, arch, uuid, symbol_fspec) == false)
+    if (LocateDSYMInVincinityOfExecutable (module_spec, symbol_fspec) == false)
     {
         // We failed to easily find the dSYM above, so use DebugSymbols
-        LocateMacOSXFilesUsingDebugSymbols (exec_fspec, arch, uuid, NULL, &symbol_fspec);
+        LocateMacOSXFilesUsingDebugSymbols (module_spec, NULL, &symbol_fspec);
     }
     return symbol_fspec;
 }

Modified: lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp?rev=151476&r1=151475&r2=151476&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp (original)
+++ lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp Sat Feb 25 23:51:37 2012
@@ -190,7 +190,11 @@
             module_sp = target_images.FindModule(uuid);
             
             if (!module_sp)
-                module_sp = target.GetSharedModule (FileSpec(), target.GetArchitecture(), &uuid);
+            {
+                ModuleSpec module_spec (FileSpec(), target.GetArchitecture());
+                module_spec.GetUUID() = uuid;
+                module_sp = target.GetSharedModule (module_spec);
+            }
         }
     }
     

Modified: lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp?rev=151476&r1=151475&r2=151476&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp (original)
+++ lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp Sat Feb 25 23:51:37 2012
@@ -274,41 +274,26 @@
 {
     if (did_create_ptr)
         *did_create_ptr = false;
-    ModuleSP module_sp;
     ModuleList &target_images = m_process->GetTarget().GetImages();
-    const bool image_info_uuid_is_valid = image_info.uuid.IsValid();
-    if (image_info_uuid_is_valid)
-        module_sp = target_images.FindModule(image_info.uuid);
+    ModuleSpec module_spec (image_info.file_spec, image_info.GetArchitecture ());
+    module_spec.GetUUID() = image_info.uuid;
+    ModuleSP module_sp (target_images.FindFirstModule (module_spec));
     
-    if (!module_sp)
+    if (module_sp)
     {
-        ArchSpec arch(image_info.GetArchitecture ());
-
-        module_sp = target_images.FindFirstModuleForFileSpec (image_info.file_spec, &arch, NULL);
+        // No UUID, we must rely upon the cached module modification 
+        // time and the modification time of the file on disk
+        if (module_sp->GetModificationTime() != module_sp->GetFileSpec().GetModificationTime())
+            module_sp.reset();
+    }
 
+    if (!module_sp)
+    {
         if (can_create)
         {
-            if (module_sp)
-            {
-                if (image_info_uuid_is_valid)
-                {
-                    if (module_sp->GetUUID() != image_info.uuid)
-                        module_sp.reset();
-                }
-                else
-                {
-                    // No UUID, we must rely upon the cached module modification 
-                    // time and the modification time of the file on disk
-                    if (module_sp->GetModificationTime() != module_sp->GetFileSpec().GetModificationTime())
-                        module_sp.reset();
-                }
-            }
-            
             if (!module_sp)
             {
-                module_sp = m_process->GetTarget().GetSharedModule (image_info.file_spec,
-                                                                    arch,
-                                                                    image_info_uuid_is_valid ? &image_info.uuid : NULL);
+                module_sp = m_process->GetTarget().GetSharedModule (module_spec);
                 if (!module_sp || module_sp->GetObjectFile() == NULL)
                 {
                     const bool add_image_to_target = true;
@@ -822,19 +807,13 @@
                     if (commpage_section)
                     {
                         ModuleList& target_images = m_process->GetTarget().GetImages();
-                        const FileSpec objfile_file_spec = objfile->GetFileSpec();
-                        ArchSpec arch (image_infos[idx].GetArchitecture ());
-                        ModuleSP commpage_image_module_sp(target_images.FindFirstModuleForFileSpec (objfile_file_spec, 
-                                                                                                    &arch, 
-                                                                                                    &commpage_dbstr));
+                        ModuleSpec module_spec (objfile->GetFileSpec(), image_infos[idx].GetArchitecture ());
+                        module_spec.GetObjectName() = commpage_dbstr;
+                        ModuleSP commpage_image_module_sp(target_images.FindFirstModule (module_spec));
                         if (!commpage_image_module_sp)
                         {
-                            commpage_image_module_sp 
-                                    = m_process->GetTarget().GetSharedModule (image_infos[idx].file_spec,
-                                                                              arch,
-                                                                              NULL,
-                                                                              &commpage_dbstr,
-                                                                              objfile->GetOffset() + commpage_section->GetFileOffset());
+                            module_spec.SetObjectOffset (objfile->GetOffset() + commpage_section->GetFileOffset());
+                            commpage_image_module_sp  = m_process->GetTarget().GetSharedModule (module_spec);
                             if (!commpage_image_module_sp || commpage_image_module_sp->GetObjectFile() == NULL)
                             {
                                 const bool add_image_to_target = true;
@@ -1305,9 +1284,10 @@
         if (!exe_module_sp)
         {
             ArchSpec exe_arch_spec (image_infos[exe_idx].GetArchitecture ());
-            exe_module_sp = m_process->GetTarget().GetSharedModule (image_infos[exe_idx].file_spec,
-                                                                    exe_arch_spec,
-                                                                    &image_infos[exe_idx].uuid);
+            ModuleSpec module_spec (image_infos[exe_idx].file_spec, 
+                                    image_infos[exe_idx].GetArchitecture ());
+            module_spec.GetUUID() = image_infos[exe_idx].uuid;
+            exe_module_sp = m_process->GetTarget().GetSharedModule (module_spec);
             if (!exe_module_sp || exe_module_sp->GetObjectFile() == NULL)
             {
                 const bool add_image_to_target = true;

Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp?rev=151476&r1=151475&r2=151476&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp Sat Feb 25 23:51:37 2012
@@ -106,13 +106,10 @@
 
     if (error.Success())
     {
-        if (exe_arch.IsValid())
+        ModuleSpec module_spec (resolved_exe_file, exe_arch);
+        if (module_spec.GetArchitecture().IsValid())
         {
-            error = ModuleList::GetSharedModule (resolved_exe_file, 
-                                                 exe_arch, 
-                                                 NULL,
-                                                 NULL, 
-                                                 0, 
+            error = ModuleList::GetSharedModule (module_spec, 
                                                  exe_module_sp, 
                                                  module_search_paths_ptr,
                                                  NULL, 
@@ -134,14 +131,9 @@
             // the architectures that we should be using (in the correct order)
             // and see if we can find a match that way
             StreamString arch_names;
-            ArchSpec platform_arch;
-            for (uint32_t idx = 0; GetSupportedArchitectureAtIndex (idx, platform_arch); ++idx)
+            for (uint32_t idx = 0; GetSupportedArchitectureAtIndex (idx, module_spec.GetArchitecture()); ++idx)
             {
-                error = ModuleList::GetSharedModule (resolved_exe_file, 
-                                                     platform_arch, 
-                                                     NULL,
-                                                     NULL, 
-                                                     0, 
+                error = ModuleList::GetSharedModule (module_spec, 
                                                      exe_module_sp, 
                                                      module_search_paths_ptr,
                                                      NULL, 
@@ -157,7 +149,7 @@
                 
                 if (idx > 0)
                     arch_names.PutCString (", ");
-                arch_names.PutCString (platform_arch.GetArchitectureName());
+                arch_names.PutCString (module_spec.GetArchitecture().GetArchitectureName());
             }
             
             if (error.Fail() || !exe_module_sp)
@@ -178,11 +170,7 @@
 
 
 Error
-PlatformDarwin::GetSharedModule (const FileSpec &platform_file, 
-                                 const ArchSpec &arch,
-                                 const UUID *uuid_ptr,
-                                 const ConstString *object_name_ptr,
-                                 off_t object_offset,
+PlatformDarwin::GetSharedModule (const ModuleSpec &module_spec,
                                  ModuleSP &module_sp,
                                  const FileSpecList *module_search_paths_ptr,
                                  ModuleSP *old_module_sp_ptr,
@@ -197,11 +185,7 @@
         // the shared module first.
         if (m_remote_platform_sp)
         {
-            error = m_remote_platform_sp->GetSharedModule (platform_file,
-                                                           arch,
-                                                           uuid_ptr,
-                                                           object_name_ptr,
-                                                           object_offset,
+            error = m_remote_platform_sp->GetSharedModule (module_spec,
                                                            module_sp,
                                                            module_search_paths_ptr,
                                                            old_module_sp_ptr,
@@ -212,16 +196,13 @@
     if (!module_sp)
     {
         // Fall back to the local platform and find the file locally
-        error = Platform::GetSharedModule (platform_file,
-                                           arch,
-                                           uuid_ptr,
-                                           object_name_ptr,
-                                           object_offset,
+        error = Platform::GetSharedModule (module_spec,
                                            module_sp,
                                            module_search_paths_ptr,
                                            old_module_sp_ptr,
                                            did_create_ptr);
         
+        const FileSpec &platform_file = module_spec.GetFileSpec();
         if (!module_sp && module_search_paths_ptr && platform_file)
         {
             // We can try to pull off part of the file path up to the bundle
@@ -244,11 +225,9 @@
                         FileSpec new_file_spec (new_path, false);
                         if (new_file_spec.Exists())
                         {
-                            Error new_error (Platform::GetSharedModule (new_file_spec,
-                                                                        arch,
-                                                                        uuid_ptr,
-                                                                        object_name_ptr,
-                                                                        object_offset,
+                            ModuleSpec new_module_spec (module_spec);
+                            new_module_spec.GetFileSpec() = new_file_spec;
+                            Error new_error (Platform::GetSharedModule (new_module_spec,
                                                                         module_sp,
                                                                         NULL,
                                                                         old_module_sp_ptr,
@@ -266,7 +245,7 @@
         }
     }
     if (module_sp)
-        module_sp->SetPlatformFileSpec(platform_file);
+        module_sp->SetPlatformFileSpec(module_spec.GetFileSpec());
     return error;
 }
 

Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.h?rev=151476&r1=151475&r2=151476&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.h (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.h Sat Feb 25 23:51:37 2012
@@ -34,11 +34,7 @@
                        const lldb_private::FileSpecList *module_search_paths_ptr);
 
     virtual lldb_private::Error
-    GetSharedModule (const lldb_private::FileSpec &platform_file, 
-                     const lldb_private::ArchSpec &arch,
-                     const lldb_private::UUID *uuid_ptr,
-                     const lldb_private::ConstString *object_name_ptr,
-                     off_t object_offset,
+    GetSharedModule (const lldb_private::ModuleSpec &module_spec,
                      lldb::ModuleSP &module_sp,
                      const lldb_private::FileSpecList *module_search_paths_ptr,
                      lldb::ModuleSP *old_module_sp_ptr,

Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp?rev=151476&r1=151475&r2=151476&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp Sat Feb 25 23:51:37 2012
@@ -142,11 +142,8 @@
     {
         if (exe_arch.IsValid())
         {
-            error = ModuleList::GetSharedModule (resolved_exe_file, 
-                                                 exe_arch, 
-                                                 NULL,
-                                                 NULL, 
-                                                 0, 
+            ModuleSpec module_spec (resolved_exe_file, exe_arch);
+            error = ModuleList::GetSharedModule (module_spec,
                                                  exe_module_sp, 
                                                  NULL,
                                                  NULL, 
@@ -163,11 +160,8 @@
         ArchSpec platform_arch;
         for (uint32_t idx = 0; GetSupportedArchitectureAtIndex (idx, platform_arch); ++idx)
         {
-            error = ModuleList::GetSharedModule (resolved_exe_file, 
-                                                 platform_arch, 
-                                                 NULL,
-                                                 NULL, 
-                                                 0, 
+            ModuleSpec module_spec (resolved_exe_file, platform_arch);
+            error = ModuleList::GetSharedModule (module_spec, 
                                                  exe_module_sp, 
                                                  NULL,
                                                  NULL, 
@@ -363,11 +357,7 @@
 }
 
 Error
-PlatformRemoteiOS::GetSharedModule (const FileSpec &platform_file, 
-                                    const ArchSpec &arch,
-                                    const UUID *uuid_ptr,
-                                    const ConstString *object_name_ptr,
-                                    off_t object_offset,
+PlatformRemoteiOS::GetSharedModule (const ModuleSpec &module_spec,
                                     ModuleSP &module_sp,
                                     const FileSpecList *module_search_paths_ptr,
                                     ModuleSP *old_module_sp_ptr,
@@ -377,21 +367,18 @@
     // system. So first we ask for the file in the cached SDK,
     // then we attempt to get a shared module for the right architecture
     // with the right UUID.
-    Error error;
+    const FileSpec &platform_file = module_spec.GetFileSpec();
+
     FileSpec local_file;
-    error = GetFile (platform_file, uuid_ptr, local_file);
+    Error error (GetFile (platform_file, module_spec.GetUUIDPtr(), local_file));
     if (error.Success())
     {
-        error = ResolveExecutable (local_file, arch, module_sp, module_search_paths_ptr);
+        error = ResolveExecutable (local_file, module_spec.GetArchitecture(), module_sp, module_search_paths_ptr);
     }
     else
     {
         const bool always_create = false;
-        error = ModuleList::GetSharedModule (platform_file, 
-                                             arch, 
-                                             uuid_ptr, 
-                                             object_name_ptr, 
-                                             object_offset, 
+        error = ModuleList::GetSharedModule (module_spec, 
                                              module_sp,
                                              module_search_paths_ptr,
                                              old_module_sp_ptr,

Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h?rev=151476&r1=151475&r2=151476&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h Sat Feb 25 23:51:37 2012
@@ -94,11 +94,7 @@
              lldb_private::FileSpec &local_file);
 
     virtual lldb_private::Error
-    GetSharedModule (const lldb_private::FileSpec &platform_file, 
-                     const lldb_private::ArchSpec &arch,
-                     const lldb_private::UUID *uuid_ptr,
-                     const lldb_private::ConstString *object_name_ptr,
-                     off_t object_offset,
+    GetSharedModule (const lldb_private::ModuleSpec &module_spec,
                      lldb::ModuleSP &module_sp,
                      const lldb_private::FileSpecList *module_search_paths_ptr,
                      lldb::ModuleSP *old_module_sp_ptr,

Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp?rev=151476&r1=151475&r2=151476&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp Sat Feb 25 23:51:37 2012
@@ -140,13 +140,10 @@
 
     if (resolved_exe_file.Exists())
     {
+        ModuleSpec module_spec(resolved_exe_file, exe_arch);
         if (exe_arch.IsValid())
         {
-            error = ModuleList::GetSharedModule (resolved_exe_file, 
-                                                 exe_arch, 
-                                                 NULL,
-                                                 NULL, 
-                                                 0, 
+            error = ModuleList::GetSharedModule (module_spec, 
                                                  exe_module_sp, 
                                                  NULL,
                                                  NULL, 
@@ -161,13 +158,10 @@
         // using (in the correct order) and see if we can find a match that way
         StreamString arch_names;
         ArchSpec platform_arch;
-        for (uint32_t idx = 0; GetSupportedArchitectureAtIndex (idx, platform_arch); ++idx)
+        for (uint32_t idx = 0; GetSupportedArchitectureAtIndex (idx, module_spec.GetArchitecture()); ++idx)
         {
-            error = ModuleList::GetSharedModule (resolved_exe_file, 
-                                                 platform_arch, 
-                                                 NULL,
-                                                 NULL, 
-                                                 0, 
+            
+            error = ModuleList::GetSharedModule (module_spec, 
                                                  exe_module_sp, 
                                                  NULL,
                                                  NULL, 
@@ -314,11 +308,7 @@
 }
 
 Error
-PlatformiOSSimulator::GetSharedModule (const FileSpec &platform_file, 
-                                       const ArchSpec &arch,
-                                       const UUID *uuid_ptr,
-                                       const ConstString *object_name_ptr,
-                                       off_t object_offset,
+PlatformiOSSimulator::GetSharedModule (const ModuleSpec &module_spec,
                                        ModuleSP &module_sp,
                                        const FileSpecList *module_search_paths_ptr,
                                        ModuleSP *old_module_sp_ptr,
@@ -330,19 +320,16 @@
     // with the right UUID.
     Error error;
     FileSpec local_file;
-    error = GetFile (platform_file, uuid_ptr, local_file);
+    const FileSpec &platform_file = module_spec.GetFileSpec();
+    error = GetFile (platform_file, module_spec.GetUUIDPtr(), local_file);
     if (error.Success())
     {
-        error = ResolveExecutable (local_file, arch, module_sp, module_search_paths_ptr);
+        error = ResolveExecutable (local_file, module_spec.GetArchitecture(), module_sp, module_search_paths_ptr);
     }
     else
     {
         const bool always_create = false;
-        error = ModuleList::GetSharedModule (platform_file, 
-                                             arch, 
-                                             uuid_ptr, 
-                                             object_name_ptr, 
-                                             object_offset, 
+        error = ModuleList::GetSharedModule (module_spec, 
                                              module_sp,
                                              module_search_paths_ptr,
                                              old_module_sp_ptr,

Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.h?rev=151476&r1=151475&r2=151476&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.h (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.h Sat Feb 25 23:51:37 2012
@@ -94,11 +94,7 @@
              lldb_private::FileSpec &local_file);
 
     virtual lldb_private::Error
-    GetSharedModule (const lldb_private::FileSpec &platform_file, 
-                     const lldb_private::ArchSpec &arch,
-                     const lldb_private::UUID *uuid_ptr,
-                     const lldb_private::ConstString *object_name_ptr,
-                     off_t object_offset,
+    GetSharedModule (const lldb_private::ModuleSpec &module_spec,
                      lldb::ModuleSP &module_sp,
                      const lldb_private::FileSpecList *module_search_paths_ptr,
                      lldb::ModuleSP *old_module_sp_ptr,

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=151476&r1=151475&r2=151476&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Sat Feb 25 23:51:37 2012
@@ -2467,13 +2467,15 @@
         {
             static ConstString g_dispatch_queue_offsets_symbol_name ("dispatch_queue_offsets");
             const Symbol *dispatch_queue_offsets_symbol = NULL;
-            ModuleSP module_sp(GetTarget().GetImages().FindFirstModuleForFileSpec (FileSpec("libSystem.B.dylib", false), NULL, NULL));
+            ModuleSpec libSystem_module_spec (FileSpec("libSystem.B.dylib", false));
+            ModuleSP module_sp(GetTarget().GetImages().FindFirstModule (libSystem_module_spec));
             if (module_sp)
                 dispatch_queue_offsets_symbol = module_sp->FindFirstSymbolWithNameAndType (g_dispatch_queue_offsets_symbol_name, eSymbolTypeData);
             
             if (dispatch_queue_offsets_symbol == NULL)
             {
-                module_sp = GetTarget().GetImages().FindFirstModuleForFileSpec (FileSpec("libdispatch.dylib", false), NULL, NULL);
+                ModuleSpec libdispatch_module_spec (FileSpec("libdispatch.dylib", false));
+                module_sp = GetTarget().GetImages().FindFirstModule (libdispatch_module_spec);
                 if (module_sp)
                     dispatch_queue_offsets_symbol = module_sp->FindFirstSymbolWithNameAndType (g_dispatch_queue_offsets_symbol_name, eSymbolTypeData);
             }

Modified: lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.cpp?rev=151476&r1=151475&r2=151476&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.cpp (original)
+++ lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.cpp Sat Feb 25 23:51:37 2012
@@ -71,11 +71,8 @@
     // For now we are just making sure the file exists for a given module
     if (!m_core_module_sp && m_core_file.Exists())
     {
-        Error error (ModuleList::GetSharedModule (m_core_file, 
-                                                  target.GetArchitecture(), 
-                                                  NULL, 
-                                                  NULL, 
-                                                  0, 
+        ModuleSpec core_module_spec(m_core_file, target.GetArchitecture());
+        Error error (ModuleList::GetSharedModule (core_module_spec, 
                                                   m_core_module_sp, 
                                                   NULL,
                                                   NULL, 

Modified: lldb/trunk/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp?rev=151476&r1=151475&r2=151476&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp Sat Feb 25 23:51:37 2012
@@ -150,7 +150,11 @@
                 // one ourselves.
                 const FileSpec &file_spec = obj_file->GetFileSpec();
                 if (file_spec)
-                    dsym_fspec = Symbols::LocateExecutableSymbolFile (&file_spec, &module_sp->GetArchitecture(), &module_sp->GetUUID());
+                {
+                    ModuleSpec module_spec(file_spec, module_sp->GetArchitecture());
+                    module_spec.GetUUID() = module_sp->GetUUID();
+                    dsym_fspec = Symbols::LocateExecutableSymbolFile (module_spec);
+                }
             }
             
             if (dsym_fspec)

Modified: lldb/trunk/source/Symbol/SymbolContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/SymbolContext.cpp?rev=151476&r1=151475&r2=151476&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/SymbolContext.cpp (original)
+++ lldb/trunk/source/Symbol/SymbolContext.cpp Sat Feb 25 23:51:37 2012
@@ -632,8 +632,9 @@
     case eModuleSpecified:
         {
             // See if we can find the Module, if so stick it in the SymbolContext.
-            FileSpec module_spec(spec_string, false);
-            lldb::ModuleSP module_sp = m_target_sp->GetImages().FindFirstModuleForFileSpec (module_spec, NULL, NULL);
+            FileSpec module_file_spec(spec_string, false);
+            ModuleSpec module_spec (module_file_spec);
+            lldb::ModuleSP module_sp (m_target_sp->GetImages().FindFirstModule (module_spec));
             m_type |= eModuleSpecified;
             if (module_sp)
                 m_module_sp = module_sp;

Modified: lldb/trunk/source/Target/Platform.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Platform.cpp?rev=151476&r1=151475&r2=151476&view=diff
==============================================================================
--- lldb/trunk/source/Target/Platform.cpp (original)
+++ lldb/trunk/source/Target/Platform.cpp Sat Feb 25 23:51:37 2012
@@ -88,11 +88,7 @@
 }
 
 Error
-Platform::GetSharedModule (const FileSpec &platform_file, 
-                           const ArchSpec &arch,
-                           const UUID *uuid_ptr,
-                           const ConstString *object_name_ptr,
-                           off_t object_offset,
+Platform::GetSharedModule (const ModuleSpec &module_spec,
                            ModuleSP &module_sp,
                            const FileSpecList *module_search_paths_ptr,
                            ModuleSP *old_module_sp_ptr,
@@ -106,11 +102,7 @@
     // remote target, or might implement a download and cache 
     // locally implementation.
     const bool always_create = false;
-    return ModuleList::GetSharedModule (platform_file, 
-                                        arch, 
-                                        uuid_ptr, 
-                                        object_name_ptr, 
-                                        object_offset, 
+    return ModuleList::GetSharedModule (module_spec, 
                                         module_sp,
                                         module_search_paths_ptr,
                                         old_module_sp_ptr,
@@ -411,13 +403,10 @@
     Error error;
     if (exe_file.Exists())
     {
-        if (exe_arch.IsValid())
+        ModuleSpec module_spec (exe_file, exe_arch);
+        if (module_spec.GetArchitecture().IsValid())
         {
-            error = ModuleList::GetSharedModule (exe_file, 
-                                                 exe_arch, 
-                                                 NULL,
-                                                 NULL, 
-                                                 0, 
+            error = ModuleList::GetSharedModule (module_spec, 
                                                  exe_module_sp, 
                                                  module_search_paths_ptr,
                                                  NULL, 
@@ -428,14 +417,9 @@
             // No valid architecture was specified, ask the platform for
             // the architectures that we should be using (in the correct order)
             // and see if we can find a match that way
-            ArchSpec platform_arch;
-            for (uint32_t idx = 0; GetSupportedArchitectureAtIndex (idx, platform_arch); ++idx)
+            for (uint32_t idx = 0; GetSupportedArchitectureAtIndex (idx, module_spec.GetArchitecture()); ++idx)
             {
-                error = ModuleList::GetSharedModule (exe_file, 
-                                                     platform_arch, 
-                                                     NULL,
-                                                     NULL, 
-                                                     0, 
+                error = ModuleList::GetSharedModule (module_spec, 
                                                      exe_module_sp, 
                                                      module_search_paths_ptr,
                                                      NULL, 

Modified: lldb/trunk/source/Target/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=151476&r1=151475&r2=151476&view=diff
==============================================================================
--- lldb/trunk/source/Target/Target.cpp (original)
+++ lldb/trunk/source/Target/Target.cpp Sat Feb 25 23:51:37 2012
@@ -849,8 +849,8 @@
                 else
                     platform_dependent_file_spec = dependent_file_spec;
 
-                ModuleSP image_module_sp(GetSharedModule (platform_dependent_file_spec,
-                                                          m_arch));
+                ModuleSpec module_spec (platform_dependent_file_spec, m_arch);
+                ModuleSP image_module_sp(GetSharedModule (module_spec));
                 if (image_module_sp.get())
                 {
                     ObjectFile *objfile = image_module_sp->GetObjectFile();
@@ -893,16 +893,12 @@
         
         if (executable_sp)
         {
-            FileSpec exec_file_spec = executable_sp->GetFileSpec();
-            Error error = ModuleList::GetSharedModule(exec_file_spec, 
-                                                      arch_spec, 
-                                                      NULL, 
-                                                      NULL, 
-                                                      0, 
-                                                      executable_sp, 
-                                                      &GetExecutableSearchPaths(),
-                                                      NULL, 
-                                                      NULL);
+            ModuleSpec module_spec (executable_sp->GetFileSpec(), arch_spec);
+            Error error = ModuleList::GetSharedModule (module_spec, 
+                                                       executable_sp, 
+                                                       &GetExecutableSearchPaths(),
+                                                       NULL, 
+                                                       NULL);
                                           
             if (!error.Fail() && executable_sp)
             {
@@ -964,7 +960,7 @@
 
 
 bool
-Target::ModuleIsExcludedForNonModuleSpecificSearches (const FileSpec &module_spec)
+Target::ModuleIsExcludedForNonModuleSpecificSearches (const FileSpec &module_file_spec)
 {
 
     if (!m_breakpoints_use_platform_avoid)
@@ -972,10 +968,8 @@
     else
     {
         ModuleList matchingModules;
-        const ArchSpec *arch_ptr = NULL;
-        const lldb_private::UUID *uuid_ptr= NULL;
-        const ConstString *object_name = NULL;
-        size_t num_modules = GetImages().FindModules(&module_spec, arch_ptr, uuid_ptr, object_name, matchingModules);
+        ModuleSpec module_spec (module_file_spec);
+        size_t num_modules = GetImages().FindModules(module_spec, matchingModules);
         
         // If there is more than one module for this file spec, only return true if ALL the modules are on the
         // black list.
@@ -1238,15 +1232,7 @@
 }
 
 ModuleSP
-Target::GetSharedModule
-(
-    const FileSpec& file_spec,
-    const ArchSpec& arch,
-    const lldb_private::UUID *uuid_ptr,
-    const ConstString *object_name,
-    off_t object_offset,
-    Error *error_ptr
-)
+Target::GetSharedModule (const ModuleSpec &module_spec, Error *error_ptr)
 {
     // Don't pass in the UUID so we can tell if we have a stale value in our list
     ModuleSP old_module_sp; // This will get filled in if we have a new version of the library
@@ -1258,15 +1244,11 @@
     // If there are image search path entries, try to use them first to acquire a suitable image.
     if (m_image_search_paths.GetSize())
     {
-        FileSpec transformed_spec;        
-        if (m_image_search_paths.RemapPath (file_spec.GetDirectory(), transformed_spec.GetDirectory()))
+        ModuleSpec transformed_spec (module_spec);
+        if (m_image_search_paths.RemapPath (module_spec.GetFileSpec().GetDirectory(), transformed_spec.GetFileSpec().GetDirectory()))
         {
-            transformed_spec.GetFilename() = file_spec.GetFilename();
+            transformed_spec.GetFileSpec().GetFilename() = module_spec.GetFileSpec().GetFilename();
             error = ModuleList::GetSharedModule (transformed_spec, 
-                                                 arch, 
-                                                 uuid_ptr, 
-                                                 object_name, 
-                                                 object_offset, 
                                                  module_sp, 
                                                  &GetExecutableSearchPaths(),
                                                  &old_module_sp, 
@@ -1279,11 +1261,7 @@
     if (m_platform_sp)
     {
         FileSpec platform_file_spec;        
-        error = m_platform_sp->GetSharedModule (file_spec, 
-                                                arch, 
-                                                uuid_ptr, 
-                                                object_name, 
-                                                object_offset, 
+        error = m_platform_sp->GetSharedModule (module_spec, 
                                                 module_sp, 
                                                 &GetExecutableSearchPaths(),
                                                 &old_module_sp, 





More information about the lldb-commits mailing list