Author: florian
Date: Thu Jul 30 22:49:49 2015
New Revision: 15460
Log:
In VALGRIND_PRINTF write out the thread name to xml.
Patch by Matthias Schwarzott <zz...@ge...>.
Modified:
trunk/NEWS
trunk/coregrind/m_scheduler/scheduler.c
trunk/docs/internals/xml-output-protocol4.txt
trunk/memcheck/tests/threadname.c
trunk/memcheck/tests/threadname.stderr.exp
trunk/memcheck/tests/threadname_xml.stderr.exp
Modified: trunk/NEWS
==============================================================================
--- trunk/NEWS (original)
+++ trunk/NEWS Thu Jul 30 22:49:49 2015
@@ -277,6 +277,7 @@
n-i-bz Enable rt_sigpending syscall on ppc64 linux.
n-i-bz mremap did not work properly on shared memory
n-i-bz Fix incorrect sizeof expression in syswrap-xen.c reported by Coverity
+n-i-bz In VALGRIND_PRINTF write out thread name, if any, to xml
Release 3.10.1 (25 November 2014)
Modified: trunk/coregrind/m_scheduler/scheduler.c
==============================================================================
--- trunk/coregrind/m_scheduler/scheduler.c (original)
+++ trunk/coregrind/m_scheduler/scheduler.c Thu Jul 30 22:49:49 2015
@@ -1814,6 +1814,9 @@
VG_(printf_xml)( "<clientmsg>\n" );
VG_(printf_xml)( " <tid>%d</tid>\n", tid );
+ const ThreadState *tst = VG_(get_ThreadState)(tid);
+ if (tst->thread_name)
+ VG_(printf_xml)(" <threadname>%s</threadname>\n", tst->thread_name);
VG_(printf_xml)( " <text>" );
count = VG_(vprintf_xml)( xml_format, *vargsp );
VG_(printf_xml)( " </text>\n" );
Modified: trunk/docs/internals/xml-output-protocol4.txt
==============================================================================
--- trunk/docs/internals/xml-output-protocol4.txt (original)
+++ trunk/docs/internals/xml-output-protocol4.txt Thu Jul 30 22:49:49 2015
@@ -719,6 +719,7 @@
<clientmsg>
<tid>INT</tid>
+ <threadname>NAME</threadname> if set
<text>...</text>
</clientmsg>
@@ -726,12 +727,17 @@
<clientmsg>
<tid>INT</tid>
+ <threadname>NAME</threadname> if set
<text>...</text>
STACK
</clientmsg>
* The <tid> tag indicates the Valgrind thread number.
+* The <threadname> tag identifies the name of the thread if it was
+ set by the client application. If no name was set, the tag is
+ omitted.
+
* The <text> tag indicates the message as specified in the client request
(properly translated to XML).
Modified: trunk/memcheck/tests/threadname.c
==============================================================================
--- trunk/memcheck/tests/threadname.c (original)
+++ trunk/memcheck/tests/threadname.c Thu Jul 30 22:49:49 2015
@@ -11,7 +11,7 @@
#include <sys/types.h>
#include <unistd.h>
#include <assert.h>
-
+#include "valgrind.h"
static pthread_t children[3];
@@ -49,6 +49,7 @@
# endif
bad_things(3);
+ VALGRIND_PRINTF("%s", "I am in child_fn_1\n");
r = pthread_create(&children[2], NULL, child_fn_2, NULL);
assert(!r);
Modified: trunk/memcheck/tests/threadname.stderr.exp
==============================================================================
--- trunk/memcheck/tests/threadname.stderr.exp (original)
+++ trunk/memcheck/tests/threadname.stderr.exp Thu Jul 30 22:49:49 2015
@@ -1,20 +1,20 @@
Invalid write of size 1
at 0x........: bad_things (threadname.c:21)
- by 0x........: main (threadname.c:81)
+ by 0x........: main (threadname.c:82)
Address 0x........ is 0 bytes after a block of size 1 alloc'd
at 0x........: malloc (vg_replace_malloc.c:...)
by 0x........: bad_things (threadname.c:20)
- by 0x........: main (threadname.c:81)
+ by 0x........: main (threadname.c:82)
Thread 2:
Invalid write of size 1
at 0x........: bad_things (threadname.c:21)
- by 0x........: child_fn_0 (threadname.c:66)
+ by 0x........: child_fn_0 (threadname.c:67)
...
Address 0x........ is 0 bytes after a block of size 2 alloc'd
at 0x........: malloc (vg_replace_malloc.c:...)
by 0x........: bad_things (threadname.c:20)
- by 0x........: child_fn_0 (threadname.c:66)
+ by 0x........: child_fn_0 (threadname.c:67)
...
Thread 3 try1:
@@ -28,6 +28,7 @@
by 0x........: child_fn_1 (threadname.c:51)
...
+I am in child_fn_1
Thread 4 012345678901234:
Invalid write of size 1
at 0x........: bad_things (threadname.c:21)
@@ -42,9 +43,9 @@
Thread 1:
Invalid write of size 1
at 0x........: bad_things (threadname.c:21)
- by 0x........: main (threadname.c:89)
+ by 0x........: main (threadname.c:90)
Address 0x........ is 0 bytes after a block of size 5 alloc'd
at 0x........: malloc (vg_replace_malloc.c:...)
by 0x........: bad_things (threadname.c:20)
- by 0x........: main (threadname.c:89)
+ by 0x........: main (threadname.c:90)
Modified: trunk/memcheck/tests/threadname_xml.stderr.exp
==============================================================================
--- trunk/memcheck/tests/threadname_xml.stderr.exp (original)
+++ trunk/memcheck/tests/threadname_xml.stderr.exp Thu Jul 30 22:49:49 2015
@@ -185,6 +185,12 @@
</stack>
</error>
+<clientmsg>
+ <tid>...</tid>
+ <threadname>try1</threadname>
+ <text>I am in child_fn_1
+ </text>
+</clientmsg>
<error>
<unique>0x........</unique>
<tid>...</tid>
|