diff --git a/configure.ac b/configure.ac
index d32d03b63..22c98be1f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2201,6 +2201,7 @@ AC_CHECK_FUNCS([ \
pthread_rwlock_timedwrlock \
pthread_spin_lock \
pthread_yield \
+ pthread_setname_np \
readlinkat \
semtimedop \
signalfd \
@@ -2227,6 +2228,8 @@ AM_CONDITIONAL([HAVE_PTHREAD_MUTEX_TIMEDLOCK],
[test x$ac_cv_func_pthread_mutex_timedlock = xyes])
AM_CONDITIONAL([HAVE_PTHREAD_SPINLOCK],
[test x$ac_cv_func_pthread_spin_lock = xyes])
+AM_CONDITIONAL([HAVE_PTHREAD_SETNAME_NP],
+ [test x$ac_cv_func_pthread_setname_np = xyes])
if test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \
-o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX ; then
diff --git a/drd/tests/annotate_barrier_xml.stderr.exp b/drd/tests/annotate_barrier_xml.stderr.exp
index 52e49506d..b34c787e8 100644
--- a/drd/tests/annotate_barrier_xml.stderr.exp
+++ b/drd/tests/annotate_barrier_xml.stderr.exp
@@ -185,11 +185,6 @@
drd_pthread_intercepts.c
...
-
- 0x........
- ...
- start_thread
-
Address 0x........ is at offset 0 from 0x.........
diff --git a/memcheck/tests/Makefile.am b/memcheck/tests/Makefile.am
index 2951423dd..f66e76b93 100644
--- a/memcheck/tests/Makefile.am
+++ b/memcheck/tests/Makefile.am
@@ -261,9 +261,8 @@ EXTRA_DIST = \
wrap8.stdout.exp2 wrap8.stderr.exp2 \
writev1.stderr.exp writev1.vgtest \
xml1.stderr.exp xml1.stdout.exp xml1.vgtest xml1.stderr.exp-s390x-mvc \
- threadname.vgtest threadname.stdout.exp threadname.stderr.exp \
- threadname_xml.vgtest threadname_xml.stdout.exp \
- threadname_xml.stderr.exp
+ threadname.vgtest threadname.stderr.exp \
+ threadname_xml.vgtest threadname_xml.stderr.exp
check_PROGRAMS = \
accounting \
@@ -338,8 +337,7 @@ check_PROGRAMS = \
wcs \
xml1 \
wrap1 wrap2 wrap3 wrap4 wrap5 wrap6 wrap7 wrap7so.so wrap8 \
- writev1 \
- threadname
+ writev1
if DWARF4
check_PROGRAMS += dw4
@@ -349,6 +347,10 @@ if HAVE_GNU_STPNCPY
check_PROGRAMS += stpncpy
endif
+if HAVE_PTHREAD_SETNAME_NP
+check_PROGRAMS += threadname
+endif
+
AM_CFLAGS += $(AM_FLAG_M3264_PRI)
AM_CXXFLAGS += $(AM_FLAG_M3264_PRI)
diff --git a/memcheck/tests/filter_xml b/memcheck/tests/filter_xml
index c26b138c7..6de4e930b 100755
--- a/memcheck/tests/filter_xml
+++ b/memcheck/tests/filter_xml
@@ -1,6 +1,9 @@
#! /bin/sh
+dir=`dirname $0`
+
./filter_stderr "$@" |
+$dir/../../tests/filter_xml_frames |
sed "s/[0-9]*<\/tid>/...<\/tid>/" |
sed "s/[0-9]*<\/pid>/...<\/pid>/" |
sed "s/[0-9]*<\/ppid>/...<\/ppid>/" |
diff --git a/memcheck/tests/threadname.c b/memcheck/tests/threadname.c
index 2eabfd5e7..69d8b2223 100644
--- a/memcheck/tests/threadname.c
+++ b/memcheck/tests/threadname.c
@@ -1,4 +1,4 @@
-//#define _GNU_SOURCE
+#define _GNU_SOURCE
#include
#include
#include
diff --git a/memcheck/tests/threadname.vgtest b/memcheck/tests/threadname.vgtest
index 4cffb8edd..2692bd078 100644
--- a/memcheck/tests/threadname.vgtest
+++ b/memcheck/tests/threadname.vgtest
@@ -1,2 +1,3 @@
prog: threadname
+prereq: test -e ./threadname
vgopts: -q
diff --git a/memcheck/tests/threadname_xml.stderr.exp b/memcheck/tests/threadname_xml.stderr.exp
index 7ecc85086..067b2ff13 100644
--- a/memcheck/tests/threadname_xml.stderr.exp
+++ b/memcheck/tests/threadname_xml.stderr.exp
@@ -102,14 +102,6 @@
threadname.c
...
-
- 0x........
- ...
- start_thread
- ...
- pthread_create.c
- ...
-
Address 0x........ is 0 bytes after a block of size 2 alloc'd
@@ -137,14 +129,6 @@
threadname.c
...
-
- 0x........
- ...
- start_thread
- ...
- pthread_create.c
- ...
-
@@ -171,14 +155,6 @@
threadname.c
...
-
- 0x........
- ...
- start_thread
- ...
- pthread_create.c
- ...
-
Address 0x........ is 0 bytes after a block of size 3 alloc'd
@@ -206,14 +182,6 @@
threadname.c
...
-
- 0x........
- ...
- start_thread
- ...
- pthread_create.c
- ...
-
@@ -240,14 +208,6 @@
threadname.c
...
-
- 0x........
- ...
- start_thread
- ...
- pthread_create.c
- ...
-
Address 0x........ is 0 bytes after a block of size 4 alloc'd
@@ -275,14 +235,6 @@
threadname.c
...
-
- 0x........
- ...
- start_thread
- ...
- pthread_create.c
- ...
-
diff --git a/memcheck/tests/threadname_xml.vgtest b/memcheck/tests/threadname_xml.vgtest
index 730fe72a5..7796ac2c8 100644
--- a/memcheck/tests/threadname_xml.vgtest
+++ b/memcheck/tests/threadname_xml.vgtest
@@ -1,3 +1,4 @@
prog: threadname
+prereq: test -e ./threadname
vgopts: --xml=yes --xml-fd=2 --log-file=/dev/null
stderr_filter: filter_xml
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 0303a6175..e323374e8 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -12,6 +12,7 @@ dist_noinst_SCRIPTS = \
filter_numbers \
filter_stderr_basic \
filter_sink \
+ filter_xml_frames \
platform_test \
vg_regtest
diff --git a/tests/filter_xml_frames b/tests/filter_xml_frames
new file mode 100755
index 000000000..fc92542a4
--- /dev/null
+++ b/tests/filter_xml_frames
@@ -0,0 +1,40 @@
+#! /usr/bin/env perl
+
+# Remove ..... containing an poining to
+# some system library.
+
+use strict;
+use warnings;
+
+my $in_frame = 0;
+my $frame = "";
+my $ignore_frame = 0;
+
+while (my $line = <>)
+{
+ if (! $in_frame) {
+ if ($line =~ //) {
+ $frame = $line;
+ $in_frame = 1;
+ $ignore_frame = 0
+ } else {
+ print $line;
+ }
+ next;
+ }
+
+# We're in a frame
+ $frame .= $line;
+ if ($line =~ /<\/frame>/) {
+ if (! $ignore_frame) {
+ print $frame;
+ }
+ $in_frame = 0;
+ } else {
+# The may require tweaking; currently /lib and /usr/lib are matched
+ $ignore_frame = 1 if ($line =~ /\/lib/);
+ $ignore_frame = 1 if ($line =~ /\/usr\/lib/);
+ }
+}
+
+exit 0;