Bug 393182

Summary: Add support for pthread_setname_np() to set thread name
Product: [Developer tools] valgrind Reporter: Daniel <bugzilla>
Component: generalAssignee: Julian Seward <jseward>
Status: REPORTED ---    
Severity: normal CC: kde-bugs
Priority: NOR    
Version First Reported In: 3.12.0   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Daniel 2018-04-16 07:57:54 UTC
Some versions of pthreads (e.g. on Linux x86_64) have pthread_setname_np(), which allows to set thread name. Some tools like gdb can use it to display friendly name for thread. Please add support for it in Valgrind too, to capture and display thread names in helgrind and drd tools.

BTW, Valgrind currently supports ANNOTATE_THREAD_NAME() which provide similar functionality. However this is limited to drd tool only, and requires modification to user program.
Comment 1 Julian Seward 2018-09-03 06:05:11 UTC
I thought we already did support this, by intercepting the underlying system
call.  Are you sure this doesn't work?
Comment 2 Daniel 2018-10-08 13:31:13 UTC
I use Valgrind 3.13.0 (shipped with CentOS 7.5) and it does not work there. Looks that something is still broken, at least in Helgrind.

BTW, I found that I logged Bug 323046 few years ago for the same issue. You can mark is as a duplicate.
Comment 3 Mark Wielaard 2021-02-28 23:55:13 UTC
*** Bug 323046 has been marked as a duplicate of this bug. ***