[Lldb-commits] [PATCH] D30374: Support NetBSD Thread ID in lldb-server

Kamil Rytarowski via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Feb 24 23:11:26 PST 2017


krytarowski created this revision.
krytarowski added a project: LLDB.

Native Thread ID is retrieved with _lwp_self() on NetBSD.

The returned value is of type int32_t, but for consistency with other Operating Systems cast it to uint64_t.

Sponsored by <The NetBSD Foundation>


Repository:
  rL LLVM

https://reviews.llvm.org/D30374

Files:
  packages/Python/lldbsuite/test/tools/lldb-server/exit-code/main.cpp
  packages/Python/lldbsuite/test/tools/lldb-server/main.cpp


Index: packages/Python/lldbsuite/test/tools/lldb-server/main.cpp
===================================================================
--- packages/Python/lldbsuite/test/tools/lldb-server/main.cpp
+++ packages/Python/lldbsuite/test/tools/lldb-server/main.cpp
@@ -27,6 +27,8 @@
 int pthread_threadid_np(pthread_t, __uint64_t *);
 #elif defined(__linux__)
 #include <sys/syscall.h>
+#elif defined(__NetBSD__)
+#include <lwp.h>
 #endif
 
 static const char *const RETVAL_PREFIX = "retval:";
@@ -71,6 +73,9 @@
 #elif defined(__linux__)
   // This is a call to gettid() via syscall.
   printf("%" PRIx64, static_cast<uint64_t>(syscall(__NR_gettid)));
+#elif defined(__NetBSD__)
+  // Technically lwpid_t is 32-bit signed integer
+  printf("%" PRIx64, static_cast<uint64_t>(_lwp_self()));
 #else
   printf("{no-tid-support}");
 #endif
Index: packages/Python/lldbsuite/test/tools/lldb-server/exit-code/main.cpp
===================================================================
--- packages/Python/lldbsuite/test/tools/lldb-server/exit-code/main.cpp
+++ packages/Python/lldbsuite/test/tools/lldb-server/exit-code/main.cpp
@@ -18,6 +18,8 @@
 int pthread_threadid_np(pthread_t, __uint64_t *);
 #elif defined(__linux__)
 #include <sys/syscall.h>
+#elif defined(__NetBSD__)
+#include <lwp.h>
 #endif
 
 static const char *const RETVAL_PREFIX = "retval:";
@@ -62,6 +64,9 @@
 #elif defined(__linux__)
   // This is a call to gettid() via syscall.
   printf("%" PRIx64, static_cast<uint64_t>(syscall(__NR_gettid)));
+#elif defined(__NetBSD__)
+  // Technically lwpid_t is 32-bit signed integer
+  printf("%" PRIx64, static_cast<uint64_t>(_lwp_self()));
 #else
   printf("{no-tid-support}");
 #endif


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D30374.89778.patch
Type: text/x-patch
Size: 1684 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20170225/7b0146a7/attachment.bin>


More information about the lldb-commits mailing list