diff options
author | Kamil Rytarowski <n54@gmx.com> | 2019-12-24 20:36:23 +0100 |
---|---|---|
committer | Kamil Rytarowski <n54@gmx.com> | 2019-12-24 20:36:23 +0100 |
commit | ab8a7a29bf15c6eb1d4393516cde1688dbe7dc45 (patch) | |
tree | acc16f5074b176d0128d086047da8eb6f61ea1b7 | |
parent | 4b8232d4f0bf5fd9f11ebef2b0f9e8e15f130fb3 (diff) | |
download | bcm5719-llvm-ab8a7a29bf15c6eb1d4393516cde1688dbe7dc45.tar.gz bcm5719-llvm-ab8a7a29bf15c6eb1d4393516cde1688dbe7dc45.zip |
[lldb] Adapt for NetBSD-9.99.30 ptrace(2) API changes
Switch from PT_LWPINFO to PT_LWPSTATUS/PT_LWPNEXT.
Keep compat support for < 9.99.30.
No functional change intended.
-rw-r--r-- | lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp | 12 | ||||
-rw-r--r-- | lldb/source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp | 11 |
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; } |