Cleaned up code that wasn't using the Initialize and Terminate paradigm by
changing it to use it. There was an extra parameter added to the static
accessor global user settings controllers that wasn't needed. A bool was being
used as a parameter to the accessor just so it could be used to clean up 
the global user settings controller which is now fixed by splitting up the
initialization into the "static void Class::Initialize()", access into the
"static UserSettingsControllerSP & Class::GetSettingsController()", and
cleanup into "static void Class::Terminate()".

Also added initialize and terminate calls to the logging code to avoid issues
when LLDB is shutting down. There were cases after the logging was switched
over to use shared pointers where we could crash if the global destructor
chain was being run and it causes the log to be destroyed and any any logging
occurred.




git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@119757 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/lldb.cpp b/source/lldb.cpp
index 4d26a15..082274b 100644
--- a/source/lldb.cpp
+++ b/source/lldb.cpp
@@ -57,12 +57,13 @@
     if (!g_inited)
     {
         g_inited = true;
+        Log::Initialize();
         Timer::Initialize ();
         Timer scoped_timer (__PRETTY_FUNCTION__, __PRETTY_FUNCTION__);
-
-        Log::Callbacks log_callbacks = { DisableLog, EnableLog, ListLogCategories };
-
-        Log::RegisterLogChannel ("lldb", log_callbacks);
+        
+        Target::Initialize ();
+        Process::Initialize ();
+        Thread::Initialize ();
         DisassemblerLLVM::Initialize();
         ObjectContainerBSDArchive::Initialize();
         ObjectFileELF::Initialize();
@@ -86,10 +87,6 @@
         //ProcessMacOSX::Initialize();
         SymbolVendorMacOSX::Initialize();
 #endif
-	Debugger::GetSettingsController (false);
-        Target::GetSettingsController (false);
-	Process::GetSettingsController (false);
-        Thread::GetSettingsController (false);
 #ifdef __linux__
         ProcessLinux::Initialize();
 #endif
@@ -128,14 +125,15 @@
     SymbolVendorMacOSX::Terminate();
 #endif
 
-    Thread::GetSettingsController (true);
-    Process::GetSettingsController (true);
-    Target::GetSettingsController (true);
-    Debugger::GetSettingsController (true);
-    
+    Thread::Terminate ();
+    Process::Terminate ();
+    Target::Terminate ();
+
 #ifdef __linux__
     ProcessLinux::Terminate();
 #endif
+
+    Log::Terminate();
 }
 
 extern "C" const double LLDBVersionNumber;