summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp12
-rw-r--r--lldb/source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp11
2 files changed, 21 insertions, 2 deletions
diff --git a/lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp b/lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
index 4cfcdab6aab..4313d27e11e 100644
--- a/lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
+++ b/lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
@@ -914,15 +914,23 @@ Status NativeProcessNetBSD::ReinitializeThreads() {
m_threads.clear();
// Initialize new thread
+#ifdef PT_LWPSTATUS
+ struct ptrace_lwpstatus info = {};
+ int op = PT_LWPNEXT;
+#else
struct ptrace_lwpinfo info = {};
- Status error = PtraceWrapper(PT_LWPINFO, GetID(), &info, sizeof(info));
+ int op = PT_LWPINFO;
+#endif
+
+ Status error = PtraceWrapper(op, GetID(), &info, sizeof(info));
+
if (error.Fail()) {
return error;
}
// Reinitialize from scratch threads and register them in process
while (info.pl_lwpid != 0) {
AddThread(info.pl_lwpid);
- error = PtraceWrapper(PT_LWPINFO, GetID(), &info, sizeof(info));
+ error = PtraceWrapper(op, GetID(), &info, sizeof(info));
if (error.Fail()) {
return error;
}
diff --git a/lldb/source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp b/lldb/source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp
index 3dd14f0e1f6..dd2745d9330 100644
--- a/lldb/source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp
+++ b/lldb/source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp
@@ -158,6 +158,16 @@ void NativeThreadNetBSD::SetStepping() {
std::string NativeThreadNetBSD::GetName() {
Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_THREAD));
+#ifdef PT_LWPSTATUS
+ struct ptrace_lwpstatus info = {};
+ info.pl_lwpid = m_tid;
+ Status error = NativeProcessNetBSD::PtraceWrapper(
+ PT_LWPSTATUS, static_cast<int>(m_process.GetID()), &info, sizeof(info));
+ if (error.Fail()) {
+ return "";
+ }
+ return info.pl_name;
+#else
std::vector<struct kinfo_lwp> infos;
int mib[5] = {CTL_KERN, KERN_LWP, static_cast<int>(m_process.GetID()),
sizeof(struct kinfo_lwp), 0};
@@ -186,6 +196,7 @@ std::string NativeThreadNetBSD::GetName() {
LLDB_LOG(log, "unable to find lwp {0} in LWP infos", m_tid);
return "";
+#endif
}
lldb::StateType NativeThreadNetBSD::GetState() { return m_state; }
OpenPOWER on IntegriCloud