|
23 | 23 | #include <mutex> |
24 | 24 | #include <unistd.h> |
25 | 25 |
|
| 26 | +#include <sys/syscall.h> |
| 27 | + |
| 28 | +pid_t _workaround_gettid() { return ((pid_t)syscall(SYS_gettid)); } |
| 29 | + |
26 | 30 | using namespace lldb_private; |
27 | 31 |
|
28 | 32 | namespace { |
@@ -91,7 +95,7 @@ lldb::TargetSP CreateTarget(lldb::DebuggerSP &debugger_sp, ArchSpec &arch) { |
91 | 95 |
|
92 | 96 | lldb::ThreadSP CreateThread(lldb::ProcessSP &process_sp) { |
93 | 97 | lldb::ThreadSP thread_sp = |
94 | | - std::make_shared<DummyThread>(*process_sp.get(), gettid()); |
| 98 | + std::make_shared<DummyThread>(*process_sp.get(), _workaround_gettid()); |
95 | 99 | if (thread_sp == nullptr) { |
96 | 100 | return nullptr; |
97 | 101 | } |
@@ -167,8 +171,8 @@ TEST_F(ElfCoreTest, PopulatePrStatusTest) { |
167 | 171 | ASSERT_EQ(prstatus_opt->pr_cursig, 0); |
168 | 172 | ASSERT_EQ(prstatus_opt->pr_sigpend, 0UL); |
169 | 173 | ASSERT_EQ(prstatus_opt->pr_sighold, 0UL); |
170 | | - ASSERT_EQ(prstatus_opt->pr_pid, static_cast<uint32_t>(gettid())); |
| 174 | + ASSERT_EQ(prstatus_opt->pr_pid, static_cast<uint32_t>(_workaround_gettid())); |
171 | 175 | ASSERT_EQ(prstatus_opt->pr_ppid, static_cast<uint32_t>(getppid())); |
172 | 176 | ASSERT_EQ(prstatus_opt->pr_pgrp, static_cast<uint32_t>(getpgrp())); |
173 | | - ASSERT_EQ(prstatus_opt->pr_sid, static_cast<uint32_t>(getsid(gettid()))); |
| 177 | + ASSERT_EQ(prstatus_opt->pr_sid, static_cast<uint32_t>(getsid(_workaround_gettid()))); |
174 | 178 | } |
0 commit comments