Made the Host::SetCrashDescription(const char *) function copy the incoming
string to avoid possible later crashes.

Modified the locations that do set the crash description to NULL out the 
string when they are done doing their tasks.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@144297 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/API/SBFrame.cpp b/source/API/SBFrame.cpp
index f72f8bf..300ae2e 100644
--- a/source/API/SBFrame.cpp
+++ b/source/API/SBFrame.cpp
@@ -765,6 +765,8 @@
                                                                                            keep_in_memory, 
                                                                                            fetch_dynamic_value, 
                                                                                            *expr_result);
+        
+        Host::SetCrashDescription (NULL);
     }
     
     if (expr_log)
diff --git a/source/Host/macosx/Host.mm b/source/Host/macosx/Host.mm
index 0b09d35..c8df2e9 100644
--- a/source/Host/macosx/Host.mm
+++ b/source/Host/macosx/Host.mm
@@ -503,7 +503,10 @@
     {
         const char *shell_executable = getenv("SHELL");
         std::string safe_arg;
-        command.Printf(" -- %s -c '", shell_executable);
+        if (launch_info.GetArchitecture().IsValid())
+            command.Printf(" -- %s -c 'exec /usr/bin/arch -arch %s ", shell_executable, launch_info.GetArchitecture().GetArchitectureName());
+        else
+            command.Printf(" -- %s -c 'exec ", shell_executable);
         const char **argv = launch_info.GetArguments().GetConstArgumentVector ();
         if (argv)
         {
@@ -644,7 +647,16 @@
 Host::SetCrashDescription (const char *cstr)
 {
     Mutex::Locker locker (GetCrashReporterMutex ());
-    __crashreporter_info__ = cstr;
+    static std::string g_crash_description;
+    if (cstr)
+    {
+        g_crash_description.assign (cstr);
+        __crashreporter_info__ = g_crash_description.c_str();
+    }
+    else
+    {
+        __crashreporter_info__ = NULL;
+    }
 }
 
 bool
diff --git a/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index d10e254..b7f63ae 100644
--- a/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -4585,6 +4585,8 @@
                                                                                                     is_artificial);
                                                     LinkDeclContextToDIE(ClangASTContext::GetAsDeclContext(cxx_method_decl), die);
 
+                                                    Host::SetCrashDescription (NULL);
+
                                                     type_handled = cxx_method_decl != NULL;
                                                 }
                                             }