Author: tfiala
Date: Thu Aug 28 16:21:39 2014
New Revision: 216686

URL: http://llvm.org/viewvc/llvm-project?rev=216686&view=rev
Log:
Ensure the Host wait4 thread is able to show pid in thread name.

For hosts that cannot support long thread names, shrink the host
wait4 thread name so that it does not truncate the PID in the thread name.

Change by Shawn Best.

Modified:
    lldb/trunk/source/Host/common/Host.cpp

Modified: lldb/trunk/source/Host/common/Host.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Host.cpp?rev=216686&r1=216685&r2=216686&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/Host.cpp (original)
+++ lldb/trunk/source/Host/common/Host.cpp Thu Aug 28 16:21:39 2014
@@ -131,7 +131,18 @@ Host::StartMonitoringChildProcess
     info_ptr->monitor_signals = monitor_signals;
     
     char thread_name[256];
-    ::snprintf (thread_name, sizeof(thread_name), "<lldb.host.wait4(pid=%" 
PRIu64 ")>", pid);
+
+    if (Host::MAX_THREAD_NAME_LENGTH <= 16)
+    {
+        // On some platforms, the thread name is limited to 16 characters.  We 
need to
+        // abbreviate there or the pid info would get truncated.
+        ::snprintf (thread_name, sizeof(thread_name), "wait4(%" PRIu64 ")", 
pid);
+    }
+    else
+    {
+        ::snprintf (thread_name, sizeof(thread_name), "<lldb.host.wait4(pid=%" 
PRIu64 ")>", pid);
+    }
+
     thread = ThreadCreate (thread_name,
                            MonitorChildProcessThreadFunction,
                            info_ptr,


_______________________________________________
lldb-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits

Reply via email to