Intercept prctl(PR_SET_NAME, name) and store the thread name so it
can be used in error messages. That should be helpful when debugging
multithreaded applications.
Patch by Matthias Schwarzott <zzam@gentoo.org> with some minor
modifications. Fixes BZ 322254.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13553 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/pub_core_threadstate.h b/coregrind/pub_core_threadstate.h
index 54dce4a..cfe2121 100644
--- a/coregrind/pub_core_threadstate.h
+++ b/coregrind/pub_core_threadstate.h
@@ -357,6 +357,9 @@
    /* Per-thread jmp_buf to resume scheduler after a signal */
    Bool               sched_jmpbuf_valid;
    VG_MINIMAL_JMP_BUF(sched_jmpbuf);
+
+   /* This thread's name. NULL, if no name. */
+   HChar *thread_name;
 }
 ThreadState;