[Lldb-commits] [lldb] r296360 - Support NetBSD Thread ID in lldb-server tests

Kamil Rytarowski via lldb-commits lldb-commits at lists.llvm.org
Mon Feb 27 09:52:49 PST 2017


Author: kamil
Date: Mon Feb 27 11:52:48 2017
New Revision: 296360

URL: http://llvm.org/viewvc/llvm-project?rev=296360&view=rev
Log:
Support NetBSD Thread ID in lldb-server tests

Summary:
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>

Reviewers: joerg, labath, clayborg, emaste

Reviewed By: labath, clayborg

Subscribers: #lldb

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D30374

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

Modified: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/exit-code/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/exit-code/main.cpp?rev=296360&r1=296359&r2=296360&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/exit-code/main.cpp (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/exit-code/main.cpp Mon Feb 27 11:52:48 2017
@@ -18,6 +18,8 @@ __OSX_AVAILABLE_STARTING(__MAC_10_6, __I
 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 @@ static void print_thread_id() {
 #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

Modified: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/main.cpp?rev=296360&r1=296359&r2=296360&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/main.cpp (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/main.cpp Mon Feb 27 11:52:48 2017
@@ -27,6 +27,8 @@ __OSX_AVAILABLE_STARTING(__MAC_10_6, __I
 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 @@ static void print_thread_id() {
 #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




More information about the lldb-commits mailing list