<rdar://problem/12586350>

This commit does three things:
(a) introduces a new notification model for adding/removing/changing modules to a ModuleList, and applies it to the Target's ModuleList, so that we make sure to always trigger the right set of actions
whenever modules come and go in a target. Certain spots in the code still need to "manually" notify the Target for several reasons, so this is a work in progress
(b) adds a new capability to the Platforms: locating a scripting resources associated to a module. A scripting resource is a Python file that can load commands, formatters, ... and any other action
of interest corresponding to the loading of a module. At the moment, this is only implemented on Mac OS X and only for files inside .dSYM bundles - the next step is going to be letting
the frameworks themselves hold their scripting resources. Implementors of platforms for other systems are free to implement "the right thing" for their own worlds
(c) hooking up items (a) and (b) so that targets auto-load the scripting resources as the corresponding modules get loaded in a target. This has a few caveats at the moment:
 - the user needs to manually add the .py file to the dSYM (soon, it will also work in the framework itself)
 - if two modules with the same name show up during the lifetime of an LLDB session, the second one won't be able to load its scripting resource, but will otherwise work just fine



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@167569 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Commands/CommandObjectTarget.cpp b/source/Commands/CommandObjectTarget.cpp
index 679c5dd..14018a4 100644
--- a/source/Commands/CommandObjectTarget.cpp
+++ b/source/Commands/CommandObjectTarget.cpp
@@ -2255,7 +2255,7 @@
             if (command.GetArgumentCount() == 0)
             {
                 // Dump all sections for all modules images
-                ModuleList &target_modules = target->GetImages();
+                const ModuleList &target_modules = target->GetImages();
                 Mutex::Locker modules_locker (target_modules.GetMutex());
                 const uint32_t num_modules = target_modules.GetSize();
                 if (num_modules > 0)
@@ -2368,7 +2368,7 @@
                 {
                     FileSpec file_spec(arg_cstr, false);
                     
-                    ModuleList &target_modules = target->GetImages();
+                    const ModuleList &target_modules = target->GetImages();
                     Mutex::Locker modules_locker(target_modules.GetMutex());
                     const uint32_t num_modules = target_modules.GetSize();
                     if (num_modules > 0)
@@ -2940,7 +2940,7 @@
             Mutex::Locker locker;      // This locker will be locked on the mutex in module_list_ptr if it is non-NULL.
                                        // Otherwise it will lock the AllocationModuleCollectionMutex when accessing
                                        // the global module list directly.
-            ModuleList *module_list_ptr = NULL;
+            const ModuleList *module_list_ptr = NULL;
             const size_t argc = command.GetArgumentCount();
             if (argc == 0)
             {
@@ -3825,7 +3825,7 @@
                 
                 // Dump all sections for all other modules
                 
-                ModuleList &target_modules = target->GetImages();
+                const ModuleList &target_modules = target->GetImages();
                 Mutex::Locker modules_locker(target_modules.GetMutex());
                 const uint32_t num_modules = target_modules.GetSize();
                 if (num_modules > 0)