[Lldb-commits] [lldb] r259818 - Make HostThread SetName work on OS X. GetName doesn't currently work, the code that was in

Jim Ingham via lldb-commits lldb-commits at lists.llvm.org
Thu Feb 4 11:42:32 PST 2016


Author: jingham
Date: Thu Feb  4 13:42:32 2016
New Revision: 259818

URL: http://llvm.org/viewvc/llvm-project?rev=259818&view=rev
Log:
Make HostThread SetName work on OS X.  GetName doesn't currently work, the code that was in
GetName actually got the queue name not the thread name and anyway didn't actually work to do
that.  So I just deleted it with a fixme.

<rdar://problem/24487554>

Modified:
    lldb/trunk/include/lldb/Host/macosx/HostInfoMacOSX.h
    lldb/trunk/source/Host/macosx/HostInfoMacOSX.mm
    lldb/trunk/source/Host/macosx/ThisThread.cpp

Modified: lldb/trunk/include/lldb/Host/macosx/HostInfoMacOSX.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/macosx/HostInfoMacOSX.h?rev=259818&r1=259817&r2=259818&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/macosx/HostInfoMacOSX.h (original)
+++ lldb/trunk/include/lldb/Host/macosx/HostInfoMacOSX.h Thu Feb  4 13:42:32 2016
@@ -32,6 +32,7 @@ class HostInfoMacOSX : public HostInfoPo
     static bool GetOSBuildString(std::string &s);
     static bool GetOSKernelDescription(std::string &s);
     static FileSpec GetProgramFileSpec();
+    static uint32_t GetMaxThreadNameLength();
 
   protected:
     static bool ComputeSupportExeDirectory(FileSpec &file_spec);

Modified: lldb/trunk/source/Host/macosx/HostInfoMacOSX.mm
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/macosx/HostInfoMacOSX.mm?rev=259818&r1=259817&r2=259818&view=diff
==============================================================================
--- lldb/trunk/source/Host/macosx/HostInfoMacOSX.mm (original)
+++ lldb/trunk/source/Host/macosx/HostInfoMacOSX.mm Thu Feb  4 13:42:32 2016
@@ -370,3 +370,9 @@ HostInfoMacOSX::ComputeHostArchitectureS
         }
     }
 }
+
+uint32_t
+HostInfoMacOSX::GetMaxThreadNameLength()
+{
+    return 64;
+}

Modified: lldb/trunk/source/Host/macosx/ThisThread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/macosx/ThisThread.cpp?rev=259818&r1=259817&r2=259818&view=diff
==============================================================================
--- lldb/trunk/source/Host/macosx/ThisThread.cpp (original)
+++ lldb/trunk/source/Host/macosx/ThisThread.cpp Thu Feb  4 13:42:32 2016
@@ -10,30 +10,20 @@
 #include "lldb/Host/ThisThread.h"
 
 #include <pthread.h>
+#include "llvm/ADT/SmallVector.h"
 
 using namespace lldb_private;
 
 void
 ThisThread::SetName(llvm::StringRef name)
 {
-#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_5
-    ::pthread_setname_np(name);
+#if defined (__APPLE__)
+    ::pthread_setname_np(name.str().c_str());
 #endif
 }
 
 void
 ThisThread::GetName(llvm::SmallVectorImpl<char> &name)
 {
-#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_5
-    char pthread_name[1024];
-    dispatch_queue_t current_queue = ::dispatch_get_current_queue();
-    if (current_queue != NULL)
-    {
-        const char *queue_name = dispatch_queue_get_label(current_queue);
-        if (queue_name && queue_name[0])
-        {
-            name = queue_name;
-        }
-    }
-#endif
+    // FIXME - implement this.
 }




More information about the lldb-commits mailing list