[Lldb-commits] [lldb] r144297 - in /lldb/trunk/source: API/SBFrame.cpp Host/macosx/Host.mm Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp

Greg Clayton gclayton at apple.com
Thu Nov 10 10:31:53 PST 2011


Author: gclayton
Date: Thu Nov 10 12:31:53 2011
New Revision: 144297

URL: http://llvm.org/viewvc/llvm-project?rev=144297&view=rev
Log:
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.


Modified:
    lldb/trunk/source/API/SBFrame.cpp
    lldb/trunk/source/Host/macosx/Host.mm
    lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp

Modified: lldb/trunk/source/API/SBFrame.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBFrame.cpp?rev=144297&r1=144296&r2=144297&view=diff
==============================================================================
--- lldb/trunk/source/API/SBFrame.cpp (original)
+++ lldb/trunk/source/API/SBFrame.cpp Thu Nov 10 12:31:53 2011
@@ -765,6 +765,8 @@
                                                                                            keep_in_memory, 
                                                                                            fetch_dynamic_value, 
                                                                                            *expr_result);
+        
+        Host::SetCrashDescription (NULL);
     }
     
     if (expr_log)

Modified: lldb/trunk/source/Host/macosx/Host.mm
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/macosx/Host.mm?rev=144297&r1=144296&r2=144297&view=diff
==============================================================================
--- lldb/trunk/source/Host/macosx/Host.mm (original)
+++ lldb/trunk/source/Host/macosx/Host.mm Thu Nov 10 12:31:53 2011
@@ -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

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=144297&r1=144296&r2=144297&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Thu Nov 10 12:31:53 2011
@@ -4585,6 +4585,8 @@
                                                                                                     is_artificial);
                                                     LinkDeclContextToDIE(ClangASTContext::GetAsDeclContext(cxx_method_decl), die);
 
+                                                    Host::SetCrashDescription (NULL);
+
                                                     type_handled = cxx_method_decl != NULL;
                                                 }
                                             }





More information about the lldb-commits mailing list