On Thu, 2012-11-15 at 06:48 +0100, Matthias Schwarzott wrote:
> On 07.11.2012 16:54, Matthias Schwarzott wrote:
> > Hi!
> >
> > I wonder if it would be good to have valgrind remember the names of the
> > threads.
> >
> Here is a first implementation of this change.
Thanks for looking at this.

> It just enhances the struct ThreadState by a char array thread_name.
> The handler of prctl writes its argument there.
According to the (maybe too quick?) discussion in 
http://sourceforge.net/mailarchive/message.php?msg_id=30069236
this implementation will give wrong information for some kinds
of errors (typically when showing an error after a thread has
terminated).
Or do you think these cases can in fact not happen ?
Or maybe this is just making an existing bug more visible ?
=> would be worth digging more in depth in that.


> For the first thread it is initialized to "main" (without valgrind there 
> is the name of the executable by default, how could I get this).
If you do call prctl(PR_GET_NAME, ...) just at startup,
it returns the name of the executable (truncated to 15 characters).


> The testcase I started to write is also included.
Some first little comments about the (early) patch:
+        if (tst->thread_name[0]) {
+            VG_(umsg)("Thread %d %s:\n", err->tid, 
VG_(get_ThreadState)(err->tid)->thread_name);
Should (re-)use tst rather than (re-)get the thread state.

Indentation is not correct at a few places or lines are longer than 80 chars.

For the test case: is pthread_setname_np available in all the
supported platforms ? Otherwise I guess that some autoconf magic or a #ifdef or 
another
The .exp expected files are still expected :).

Philippe




------------------------------------------------------------------------------
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
_______________________________________________
Valgrind-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to