Hi!

I wonder if it would be good to have valgrind remember the names of the 
threads.
Our application sets the name of the threads using

pthread_setname_np and that is implemented by calling the syscall 
prctl(PR_SET_NAME).

Using plain gdb, info threads also lists these user-defined names.
But valgrind and gdb+vgdb only show the thread-ids.


The only place in valgrind that already handles thread names is a 
helgrind client request.


I think it would be a good idea if valgrind could also show the thread name.
My first attempt is to add more code to POST(sys_prctl) and in case of 
VKI_PR_SET_NAME is called, store the set name into a new field of 
ThreadState.
Then in every user visible place where a threadid is printed, also print 
the name.
How could this look like?


==123== Thread 5 (MyThread1):

==123== Invalid read of size 1:
...

I will send a patch once this is done.


The other option would be to call prctl(PR_GET_NAME) at every place that 
needs a thread name.


Regards
Matthias


------------------------------------------------------------------------------
LogMeIn Central: Instant, anywhere, Remote PC access and management.
Stay in control, update software, and manage PCs from one command center
Diagnose problems and improve visibility into emerging IT issues
Automate, monitor and manage. Do more in less time with Central
http://p.sf.net/sfu/logmein12331_d2d
_______________________________________________
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to