This is an archive of the discontinued LLVM Phabricator instance.

[lldb] [Process/NetBSD] Implement thread name getting
ClosedPublic

Authored by mgorny on Nov 17 2019, 1:08 PM.

Details

Summary

Implement thread name getting sysctl() on NetBSD. Also fix the incorrect type in pthread_setname_np() in the relevant test.

Diff Detail

Event Timeline

mgorny created this revision.Nov 17 2019, 1:08 PM
mgorny updated this revision to Diff 229730.Nov 17 2019, 2:31 PM
mgorny retitled this revision from [lldb] [test] Fix lldb-server/thread-name test code for NetBSD to [lldb] [Process/NetBSD] Implement thread name getting.
mgorny edited the summary of this revision. (Show Details)

Went a bit further and implemented the missing feature.

mgorny edited the summary of this revision. (Show Details)Nov 17 2019, 3:10 PM
krytarowski added inline comments.Nov 17 2019, 3:33 PM
lldb/source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp
23

Please include before this header <sys/types.h>. If it works, that header is likely pulled from some indirect location.

mgorny updated this revision to Diff 229751.Nov 17 2019, 11:32 PM

Added sys/types.h.

mgorny marked an inline comment as done.Nov 17 2019, 11:33 PM
labath accepted this revision.Nov 18 2019, 12:05 AM
labath added inline comments.
lldb/packages/Python/lldbsuite/test/tools/lldb-server/thread-name/main.cpp
13

I think const_cast<char *>(name) ought to be enough.

lldb/source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp
123

Thread-safety technically doesn't matter in this part of the code, but I think it would be good practice to use llvm::StrError (llvm/Support/Errno.h) anyway.

This revision is now accepted and ready to land.Nov 18 2019, 12:05 AM
krytarowski accepted this revision.Nov 18 2019, 12:16 AM
krytarowski added inline comments.
lldb/source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp
123

strerror is thread safe on NetBSD, but probably better to pick llvm interfaces.

mgorny updated this revision to Diff 229765.Nov 18 2019, 1:25 AM
mgorny marked 3 inline comments as done.

Implemented review suggestions. Thanks!

This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptNov 18 2019, 2:22 AM