This is an archive of the discontinued LLVM Phabricator instance.

[lldb] [Process/FreeBSDRemote] Implement thread GetName()
ClosedPublic

Authored by mgorny on Oct 28 2020, 4:43 AM.

Details

Summary

Implement NativeThreadFreeBSD::GetName(). This is based
on the equivalent code in the legacy FreeBSD plugin, except it is
modernized a bit to use llvm::Optional and std::vector for data storage.

Diff Detail

Event Timeline

mgorny created this revision.Oct 28 2020, 4:43 AM
mgorny requested review of this revision.Oct 28 2020, 4:43 AM
krytarowski added inline comments.Oct 28 2020, 5:25 AM
lldb/source/Plugins/Process/FreeBSDRemote/NativeThreadFreeBSD.cpp
151

It is probably fine, but I would use:

  1. PT_GETNUMLWPS
  2. PT_GETLWPLIST with optional caching
  3. Read pl_tdname from ptrace_lwpinfo
164

Isn't this call always synchronous and all the threads are stopped?

I am not sure that the caching is really needed, but this seems ok to me. I'm assuming that this fixes TestGdbRemoteThreadName.py...

lldb/source/Plugins/Process/FreeBSDRemote/NativeThreadFreeBSD.cpp
164

I would certainly expect so

171

just m_state, it's cleaner

mgorny marked 3 inline comments as done.Oct 28 2020, 9:51 AM
mgorny added inline comments.
lldb/source/Plugins/Process/FreeBSDRemote/NativeThreadFreeBSD.cpp
151

PT_GETLWPLIST returns only LWP IDs. struct ptrace_lwpinfo is used by PT_LWPINFO which returns info about the thread causing the process to stop, not an arbitrary thread.

mgorny updated this revision to Diff 301319.Oct 28 2020, 9:52 AM

Removed overallocation and put plain m_state into log message.

krytarowski accepted this revision.Oct 31 2020, 5:52 AM
This revision is now accepted and ready to land.Oct 31 2020, 5:52 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptNov 3 2020, 12:46 AM