[Lldb-commits] [lldb] r111812 - /lldb/trunk/source/Host/macosx/Host.mm

Johnny Chen johnny.chen at apple.com
Mon Aug 23 10:13:12 PDT 2010


Author: johnny
Date: Mon Aug 23 12:13:12 2010
New Revision: 111812

URL: http://llvm.org/viewvc/llvm-project?rev=111812&view=rev
Log:
Fixed a crasher where during shutdown, loggings attempted to access the
thread name but the static map instance had already been destructed.

rdar://problem/8153284

Modified:
    lldb/trunk/source/Host/macosx/Host.mm

Modified: lldb/trunk/source/Host/macosx/Host.mm
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/macosx/Host.mm?rev=111812&r1=111811&r2=111812&view=diff
==============================================================================
--- lldb/trunk/source/Host/macosx/Host.mm (original)
+++ lldb/trunk/source/Host/macosx/Host.mm Mon Aug 23 12:13:12 2010
@@ -325,7 +325,13 @@
     Mutex::Locker locker(&g_mutex);
 
     typedef std::map<uint64_t, std::string> thread_name_map;
-    static thread_name_map g_thread_names;
+    // rdar://problem/8153284
+    // Fixed a crasher where during shutdown, loggings attempted to access the
+    // thread name but the static map instance had already been destructed.
+    // Another approach is to introduce a static guard object which monitors its
+    // own destruction and raises a flag, but this incurs more overhead.
+    static thread_name_map *g_thread_names_ptr = new thread_name_map();
+    thread_name_map &g_thread_names = *g_thread_names_ptr;
 
     if (get)
     {





More information about the lldb-commits mailing list