/drd/tests/*.stderr.out
/drd/tests/*.stdout.diff*
/drd/tests/*.stdout.out
+/drd/tests/filter_error_count
+/drd/tests/filter_error_summary
+/drd/tests/filter_stderr
+/drd/tests/filter_stderr_and_thread_no_and_offset
+/drd/tests/filter_thread_no
+/drd/tests/filter_xml_and_thread_no
/drd/tests/.deps
/drd/tests/annotate_barrier
/drd/tests/annotate_hb_err
/helgrind/tests/*.stderr.out
/helgrind/tests/*.stdout.diff*
/helgrind/tests/*.stdout.out
+/helgrind/tests/filter_stderr
/helgrind/tests/.deps
/helgrind/tests/annotate_hbefore
/helgrind/tests/annotate_rwlock
[chmod +x tests/filter_stderr_basic])
AC_CONFIG_FILES([tests/filter_discards],
[chmod +x tests/filter_discards])
+AC_CONFIG_FILES([drd/tests/filter_stderr],
+ [chmod +x drd/tests/filter_stderr])
+AC_CONFIG_FILES([drd/tests/filter_error_count],
+ [chmod +x drd/tests/filter_error_count])
+AC_CONFIG_FILES([drd/tests/filter_error_summary],
+ [chmod +x drd/tests/filter_error_summary])
+AC_CONFIG_FILES([drd/tests/filter_stderr_and_thread_no_and_offset],
+ [chmod +x drd/tests/filter_stderr_and_thread_no_and_offset])
+AC_CONFIG_FILES([drd/tests/filter_thread_no],
+ [chmod +x drd/tests/filter_thread_no])
+AC_CONFIG_FILES([drd/tests/filter_xml_and_thread_no],
+ [chmod +x drd/tests/filter_xml_and_thread_no])
+AC_CONFIG_FILES([helgrind/tests/filter_stderr],
+ [chmod +x helgrind/tests/filter_stderr])
AC_OUTPUT
cat<<EOF
bar_bad.stderr.exp \
bar_bad.stderr.exp-nohang \
bar_bad.stderr.exp-solaris \
+ bar_bad.stderr.exp-freebsd \
bar_bad.vgtest \
bar_bad_xml.stderr.exp \
bar_bad_xml.stderr.exp-nohang \
bar_bad_xml.stderr.exp-solaris \
+ bar_bad_xml.stderr.exp-freebsd \
bar_bad_xml.vgtest \
bar_trivial.stderr.exp \
bar_trivial.stdout.exp \
pth_detached2.vgtest \
pth_detached3.stderr.exp1 \
pth_detached3.stderr.exp2 \
+ pth_detached3.stderr.exp-freebsd \
pth_detached3.vgtest \
pth_detached_sem.stderr.exp \
pth_detached_sem.stdout.exp \
recursive_mutex.stderr.exp-linux \
recursive_mutex.stderr.exp-darwin \
recursive_mutex.stderr.exp-solaris \
+ recursive_mutex.stderr.exp-freebsd \
recursive_mutex.vgtest \
rwlock_race.stderr.exp \
rwlock_race.stderr.exp2 \
tc09_bad_unlock.stderr.exp-glibc2.8 \
tc09_bad_unlock.stderr.exp-s390 \
tc09_bad_unlock.stderr.exp-solaris \
+ tc09_bad_unlock.stderr.exp-freebsd \
+ tc09_bad_unlock.stderr.exp-freebsd-clang \
tc09_bad_unlock.vgtest \
tc10_rec_lock.stderr.exp \
tc10_rec_lock.vgtest \
tc23_bogus_condwait.stderr.exp-linux-ppc \
tc23_bogus_condwait.stderr.exp-darwin-x86 \
tc23_bogus_condwait.stderr.exp-darwin-amd64 \
+ tc23_bogus_condwait.stderr.exp-freebsd \
tc23_bogus_condwait.vgtest \
tc24_nonzero_sem.stderr.exp \
tc24_nonzero_sem.vgtest \
thread_name.vgtest \
thread_name_xml.stderr.exp \
thread_name_xml.vgtest \
+ thread_name_freebsd.stderr.exp \
+ thread_name_freebsd.vgtest \
threaded-fork.stderr.exp \
threaded-fork.vgtest \
threaded-fork-vcs.stderr.exp \
threaded-fork \
trylock \
unit_bitmap \
- unit_vc
+ unit_vc \
+ std_atomic \
+ std_list \
+ std_mutex \
+ std_string
if HAVE_BOOST_1_35
check_PROGRAMS += boost_thread
if CXX_CAN_INCLUDE_THREAD_HEADER
if HAVE_SHARED_POINTER_ANNOTATION
check_PROGRAMS += \
- std_atomic \
- std_list \
- std_mutex \
- std_string \
std_thread \
std_thread2
endif
check_PROGRAMS += sem_wait
endif
+if VGCONF_OS_IS_FREEBSD
+check_PROGRAMS += thread_name_freebsd
+endif
+
AM_CFLAGS += $(AM_FLAG_M3264_PRI) @FLAG_W_EXTRA@ -Wno-inline -Wno-unused-parameter
AM_CXXFLAGS += $(AM_FLAG_M3264_PRI) @FLAG_W_EXTRA@ @FLAG_FALIGNED_NEW@ \
#include <pthread.h> // pthread_mutex_t
#endif
#include "unified_annotations.h"
+#include "config.h"
static bool s_enable_annotations;
{
pthread_attr_t attr;
pthread_attr_init(&attr);
+#if !defined(VGO_freebsd)
pthread_attr_setstacksize(&attr, PTHREAD_STACK_MIN + 4096);
+#endif
pthread_create(&m_tid, &attr, pf, arg);
pthread_attr_destroy(&attr);
}
--- /dev/null
+
+
+initialise a barrier with zero count
+pthread_barrier_init: 'count' argument is zero: barrier 0x........
+ at 0x........: pthread_barrier_init (drd_pthread_intercepts.c:?)
+ by 0x........: main (bar_bad.c:?)
+
+
+initialise a barrier twice
+Barrier reinitialization: barrier 0x........
+ at 0x........: pthread_barrier_init (drd_pthread_intercepts.c:?)
+ by 0x........: main (bar_bad.c:?)
+barrier 0x........ was first observed at:
+ at 0x........: pthread_barrier_init (drd_pthread_intercepts.c:?)
+ by 0x........: main (bar_bad.c:?)
+
+
+initialise a barrier which has threads waiting on it
+Barrier reinitialization: barrier 0x........
+ at 0x........: pthread_barrier_init (drd_pthread_intercepts.c:?)
+ by 0x........: main (bar_bad.c:?)
+barrier 0x........ was first observed at:
+ at 0x........: pthread_barrier_init (drd_pthread_intercepts.c:?)
+ by 0x........: main (bar_bad.c:?)
+
+
+destroy a barrier that has waiting threads
+Destruction of a barrier with active waiters: barrier 0x........
+ at 0x........: pthread_barrier_destroy (drd_pthread_intercepts.c:?)
+ by 0x........: main (bar_bad.c:?)
+barrier 0x........ was first observed at:
+ at 0x........: pthread_barrier_init (drd_pthread_intercepts.c:?)
+ by 0x........: main (bar_bad.c:?)
+
+
+destroy a barrier that was never initialised
+Destruction of barrier that is being waited upon: barrier 0x........
+ at 0x........: free (vg_replace_malloc.c:...)
+ by 0x........: main (bar_bad.c:?)
+barrier 0x........ was first observed at:
+ at 0x........: pthread_barrier_init (drd_pthread_intercepts.c:?)
+ by 0x........: main (bar_bad.c:?)
+
+
+ERROR SUMMARY: 6 errors from 5 contexts (suppressed: 0 from 0)
--- /dev/null
+<?xml version="1.0"?>
+
+<valgrindoutput>
+
+<protocolversion>4</protocolversion>
+<protocoltool>drd</protocoltool>
+
+<preamble>
+ <line>...</line>
+ <line>...</line>
+ <line>...</line>
+ <line>...</line>
+</preamble>
+
+<pid>...</pid>
+<ppid>...</ppid>
+<tool>drd</tool>
+
+<args>
+ <vargv>...</vargv>
+ <argv>
+ <exe>./../../helgrind/tests/bar_bad</exe>
+ </argv>
+</args>
+
+<status>
+ <state>RUNNING</state>
+ <time>...</time>
+</status>
+
+
+initialise a barrier with zero count
+<error>
+ <unique>0x........</unique>
+ <tid>...</tid>
+ <kind>BarrierErr</kind>
+ <what>pthread_barrier_init: 'count' argument is zero: barrier 0x........</what>
+ <stack>
+ <frame>
+ <ip>0x........</ip>
+ <obj>...</obj>
+ <fn>pthread_barrier_init</fn>
+ <dir>...</dir>
+ <file>drd_pthread_intercepts.c</file>
+ <line>...</line>
+ </frame>
+ <frame>
+ <ip>0x........</ip>
+ <obj>...</obj>
+ <fn>main</fn>
+ <dir>...</dir>
+ <file>bar_bad.c</file>
+ <line>...</line>
+ </frame>
+ </stack>
+</error>
+
+
+initialise a barrier twice
+<error>
+ <unique>0x........</unique>
+ <tid>...</tid>
+ <kind>BarrierErr</kind>
+ <what>Barrier reinitialization: barrier 0x........</what>
+ <stack>
+ <frame>
+ <ip>0x........</ip>
+ <obj>...</obj>
+ <fn>pthread_barrier_init</fn>
+ <dir>...</dir>
+ <file>drd_pthread_intercepts.c</file>
+ <line>...</line>
+ </frame>
+ <frame>
+ <ip>0x........</ip>
+ <obj>...</obj>
+ <fn>main</fn>
+ <dir>...</dir>
+ <file>bar_bad.c</file>
+ <line>...</line>
+ </frame>
+ </stack>
+ <first_observed_at>
+ <what>barrier</what>
+ <address>0x........</address>
+ <stack>
+ <frame>
+ <ip>0x........</ip>
+ <obj>...</obj>
+ <fn>pthread_barrier_init</fn>
+ <dir>...</dir>
+ <file>drd_pthread_intercepts.c</file>
+ <line>...</line>
+ </frame>
+ <frame>
+ <ip>0x........</ip>
+ <obj>...</obj>
+ <fn>main</fn>
+ <dir>...</dir>
+ <file>bar_bad.c</file>
+ <line>...</line>
+ </frame>
+ </stack>
+ </first_observed_at>
+</error>
+
+
+initialise a barrier which has threads waiting on it
+<error>
+ <unique>0x........</unique>
+ <tid>...</tid>
+ <kind>BarrierErr</kind>
+ <what>Barrier reinitialization: barrier 0x........</what>
+ <stack>
+ <frame>
+ <ip>0x........</ip>
+ <obj>...</obj>
+ <fn>pthread_barrier_init</fn>
+ <dir>...</dir>
+ <file>drd_pthread_intercepts.c</file>
+ <line>...</line>
+ </frame>
+ <frame>
+ <ip>0x........</ip>
+ <obj>...</obj>
+ <fn>main</fn>
+ <dir>...</dir>
+ <file>bar_bad.c</file>
+ <line>...</line>
+ </frame>
+ </stack>
+ <first_observed_at>
+ <what>barrier</what>
+ <address>0x........</address>
+ <stack>
+ <frame>
+ <ip>0x........</ip>
+ <obj>...</obj>
+ <fn>pthread_barrier_init</fn>
+ <dir>...</dir>
+ <file>drd_pthread_intercepts.c</file>
+ <line>...</line>
+ </frame>
+ <frame>
+ <ip>0x........</ip>
+ <obj>...</obj>
+ <fn>main</fn>
+ <dir>...</dir>
+ <file>bar_bad.c</file>
+ <line>...</line>
+ </frame>
+ </stack>
+ </first_observed_at>
+</error>
+
+
+destroy a barrier that has waiting threads
+<error>
+ <unique>0x........</unique>
+ <tid>...</tid>
+ <kind>BarrierErr</kind>
+ <what>Destruction of a barrier with active waiters: barrier 0x........</what>
+ <stack>
+ <frame>
+ <ip>0x........</ip>
+ <obj>...</obj>
+ <fn>pthread_barrier_destroy</fn>
+ <dir>...</dir>
+ <file>drd_pthread_intercepts.c</file>
+ <line>...</line>
+ </frame>
+ <frame>
+ <ip>0x........</ip>
+ <obj>...</obj>
+ <fn>main</fn>
+ <dir>...</dir>
+ <file>bar_bad.c</file>
+ <line>...</line>
+ </frame>
+ </stack>
+ <first_observed_at>
+ <what>barrier</what>
+ <address>0x........</address>
+ <stack>
+ <frame>
+ <ip>0x........</ip>
+ <obj>...</obj>
+ <fn>pthread_barrier_init</fn>
+ <dir>...</dir>
+ <file>drd_pthread_intercepts.c</file>
+ <line>...</line>
+ </frame>
+ <frame>
+ <ip>0x........</ip>
+ <obj>...</obj>
+ <fn>main</fn>
+ <dir>...</dir>
+ <file>bar_bad.c</file>
+ <line>...</line>
+ </frame>
+ </stack>
+ </first_observed_at>
+</error>
+
+
+destroy a barrier that was never initialised
+<error>
+ <unique>0x........</unique>
+ <tid>...</tid>
+ <kind>BarrierErr</kind>
+ <what>Destruction of barrier that is being waited upon: barrier 0x........</what>
+ <stack>
+ <frame>
+ <ip>0x........</ip>
+ <obj>...</obj>
+ <fn>free</fn>
+ <dir>...</dir>
+ <file>vg_replace_malloc.c</file>
+ <line>...</line>
+ </frame>
+ <frame>
+ <ip>0x........</ip>
+ <obj>...</obj>
+ <fn>main</fn>
+ <dir>...</dir>
+ <file>bar_bad.c</file>
+ <line>...</line>
+ </frame>
+ </stack>
+ <first_observed_at>
+ <what>barrier</what>
+ <address>0x........</address>
+ <stack>
+ <frame>
+ <ip>0x........</ip>
+ <obj>...</obj>
+ <fn>pthread_barrier_init</fn>
+ <dir>...</dir>
+ <file>drd_pthread_intercepts.c</file>
+ <line>...</line>
+ </frame>
+ <frame>
+ <ip>0x........</ip>
+ <obj>...</obj>
+ <fn>main</fn>
+ <dir>...</dir>
+ <file>bar_bad.c</file>
+ <line>...</line>
+ </frame>
+ </stack>
+ </first_observed_at>
+</error>
+
+
+<status>
+ <state>FINISHED</state>
+ <time>...</time>
+</status>
+
+<errorcounts>
+ <pair>
+ <count>...</count>
+ <unique>0x........</unique>
+ </pair>
+ <pair>
+ <count>...</count>
+ <unique>0x........</unique>
+ </pair>
+ <pair>
+ <count>...</count>
+ <unique>0x........</unique>
+ </pair>
+ <pair>
+ <count>...</count>
+ <unique>0x........</unique>
+ </pair>
+ <pair>
+ <count>...</count>
+ <unique>0x........</unique>
+ </pair>
+</errorcounts>
+
+<suppcounts>...</suppcounts>
+
+</valgrindoutput>
+
data_t buffer[BUFFER_MAX];
} buffer_t;
+typedef struct id_and_wait_s
+{
+ int id;
+ int wait_time;
+} id_and_wait_t;
+
static int quiet = 0;
static int use_locking = 1;
static void *producer(void* arg)
{
- int* id = arg;
+ id_and_wait_t* ctx = arg;
+ int* id = &ctx->id;
buffer_send(&b, id);
return NULL;
static void *consumer(void* arg)
{
- int* id = arg;
+ id_and_wait_t* ctx = arg;
+ int id = ctx->id;
+ int wait_time = ctx->wait_time;
int d;
- usleep(rand() % MAXSLEEP);
+ usleep(wait_time);
buffer_recv(&b, &d);
if (! quiet)
{
- printf("%i: %i\n", *id, d);
+ printf("%i: %i\n", id, d);
fflush(stdout);
}
return NULL;
{
pthread_t producers[THREADS];
pthread_t consumers[THREADS];
- int thread_arg[THREADS];
+ id_and_wait_t thread_arg[THREADS];
int i;
int optchar;
for (i = 0; i < THREADS; ++i)
{
- thread_arg[i] = i;
+ thread_arg[i].id = i;
+ thread_arg[i].wait_time = rand() % MAXSLEEP;
pthread_create(producers + i, NULL, producer, &thread_arg[i]);
}
#include <fcntl.h> /* O_RDONLY */
#include <pthread.h>
#include <unistd.h> /* close() */
+#include "config.h"
/* Happens with two threads also */
#define THREAD_COUNT 256
pthread_t threads[THREAD_COUNT];
pthread_attr_init(&attr);
+#if !defined(VGO_freebsd)
pthread_attr_setstacksize(&attr, PTHREAD_STACK_MIN);
+#endif
for (i = 0; i < THREAD_COUNT; ++i) {
r = pthread_create(&threads[i], &attr, thread, 0);
if (r != 0) {
prereq: ./supported_libpthread
-vgopts: --read-var-info=yes --check-stack-var=yes --show-confl-seg=no --num-callers=3
+vgopts: --read-var-info=yes --check-stack-var=yes --show-confl-seg=no --num-callers=6
prog: concurrent_close
stderr_filter: filter_stderr
#!/bin/sh
+SED=@SED@
+
# Filter the error output of Valgrind such that only the line with the error
# summary is kept. Bart Van Assche, February 26, 2008.
-sed -n \
+$SED -n \
-e 's/^.*\(ERROR SUMMARY.*\) ([^()]*)$/\1/' \
-e 's/^\(ERROR SUMMARY: [0-9]* errors\).*$/\1/' \
-e '/ERROR SUMMARY/p'
#!/bin/sh
+SED=@SED@
+
# Filter the error output of Valgrind such that only the line with the error
# summary is kept. Bart Van Assche, February 26, 2008.
-sed -n -e 's/^.*\(ERROR SUMMARY.*\) ([^()]*)$/\1/' -e '/ERROR SUMMARY/p'
+$SED -n -e 's/^.*\(ERROR SUMMARY.*\) ([^()]*)$/\1/' -e '/ERROR SUMMARY/p'
dir=`dirname $0`
-sed -e "s:_pthread_start (in /usr/lib/libSystem.B.dylib):(within libpthread-?.?.so):" |
+SED=@SED@
+
+$SED -e "s:_pthread_start (in /usr/lib/libSystem.B.dylib):(within libpthread-?.?.so):" |
$dir/../../tests/filter_stderr_basic |
# Remove line numbers referring to drd's source code.
# Remove libpthread's version number.
# Remove line numbers from stack traces.
-sed \
+$SED \
-e "/^drd, a thread error detector$/d" \
-e "s/^Allocation context: stack of thread \([0-9]*\), offset -[0-9]*$/Allocation context: stack of thread \1, offset .../" \
-e "/^warning: evaluate_Dwarf3_Expr: unhandled DW_OP_.*/d" \
-e "/^Copyright (C) 2006-20.., and GNU GPL'd, by Bart Van Assche.$/d" \
-e "s/\([A-Za-z_]*\) (clone.S:[0-9]*)/\1 (in \/...libc...)/" \
-e "s/\([A-Za-z_]*\) (swapcontext.S:[0-9]*)/\1 (in \/...libc...)/" \
+-e "s/_swapcontext/swapcontext/" \
-e "s/[A-Za-z_]* (pthread_create.c:[0-9]*)/(within libpthread-?.?.so)/" \
-e "s/[A-Za-z_]* (in [^ ]*libpthread-[0-9.]*\.so)/(within libpthread-?.?.so)/" \
+-e "s/... (in \/lib\/libthr.so.3)/(within libpthread-?.?.so)/" \
-e "s:(within /lib[0-9]*/ld-[0-9.]*\.so):(within ld-?.?.so):" \
-e "s/was held during [0-9][0-9]*/was held during .../" \
-e "s: BSS section of [^<]*/: BSS section of :g" \
+++ /dev/null
-#!/bin/sh
-
-./filter_stderr_and_thread_no \
-| sed "s/ is at offset [0-9]* from / is at offset ... from /"
--- /dev/null
+#!/bin/sh
+
+SED=@SED@
+
+./filter_stderr_and_thread_no \
+| $SED "s/ is at offset [0-9]* from / is at offset ... from /"
#! /bin/sh
+SED=@SED@
+
# Get rid of the numbers as these make some tests more scheduling sensitive
# -- those where there are multiple threads which play interchangeable roles.
grep -v "^Thread [0-9][0-9]*:$" |
-sed -e "s:hread [0-9][0-9]*:hread x:g" \
+$SED -e "s:hread [0-9][0-9]*:hread x:g" \
-e "s:of thread [0-9][0-9]*$:of thread x:g"
#! /bin/sh
+SED=@SED@
+
../../memcheck/tests/filter_xml |
./filter_thread_no |
-sed 's/ vc: \[[0-9:, ]*\]/ vc: [ ... ]/g'
+$SED 's/ vc: \[[0-9:, ]*\]/ vc: [ ... ]/g'
#include <stdlib.h>
#include <stdio.h>
#include <pthread.h>
+#include "config.h"
static pthread_t s_thread[1000];
// std::cout << "create " << thread_count << std::endl;
s_arg[thread_count] = thread_count;
pthread_attr_init(&attr);
+#if !defined(VGO_freebsd)
pthread_attr_setstacksize(&attr, PTHREAD_STACK_MIN);
+#endif
pthread_create(&s_thread[thread_count], &attr, thread_func,
&s_arg[thread_count]);
pthread_attr_destroy(&attr);
thread_count--;
// std::cout << "create " << thread_count << std::endl;
pthread_attr_init(&attr);
+#if !defined(VGO_freebsd)
pthread_attr_setstacksize(&attr, PTHREAD_STACK_MIN);
+#endif
pthread_create(&s_thread[thread_count], &attr, thread_func,
&thread_count);
pthread_attr_destroy(&attr);
#include <stdio.h>
#include <stdint.h>
+#if defined(VGO_freebsd)
+#include <sys/types.h>
+#endif
+
static void* thread_func(void* arg)
{
return 0;
pthread_detach(thread);
/* Invoke pthread_detach() with an invalid thread ID. */
+#ifdef VGO_freebsd
+ pthread_detach((pthread_t)12345);
+#else
pthread_detach((pthread_t)((uintptr_t)thread + 8));
+#endif
fprintf(stderr, "Finished.\n");
--- /dev/null
+
+pthread_detach(): invalid thread ID 0x........
+ at 0x........: vgDrd_set_joinable (drd_pthread_intercepts.c:?)
+ by 0x........: pthread_detach (drd_pthread_intercepts.c:?)
+ by 0x........: main (pth_detached3.c:26)
+
+pthread_detach(): invalid thread ID 0x........
+ at 0x........: vgDrd_set_joinable (drd_pthread_intercepts.c:?)
+ by 0x........: pthread_detach (drd_pthread_intercepts.c:?)
+ by 0x........: main (pth_detached3.c:30)
+
+Finished.
+
+ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0)
pthread_detach(): invalid thread ID 0x........
at 0x........: vgDrd_set_joinable (drd_pthread_intercepts.c:?)
by 0x........: pthread_detach (drd_pthread_intercepts.c:?)
- by 0x........: main (pth_detached3.c:22)
+ by 0x........: main (pth_detached3.c:26)
pthread_detach(): invalid thread ID 0x........
at 0x........: vgDrd_set_joinable (drd_pthread_intercepts.c:?)
by 0x........: pthread_detach (drd_pthread_intercepts.c:?)
- by 0x........: main (pth_detached3.c:25)
+ by 0x........: main (pth_detached3.c:32)
Finished.
prereq: test -e pth_uninitialized_cond && ./supported_libpthread
vgopts: --read-var-info=yes --check-stack-var=yes
prog: pth_uninitialized_cond
+cleanup: rm -f vgcore.*
--- /dev/null
+
+
+Non-recursive mutex.
+second lock call failed !
+Mutex not locked by calling thread: mutex 0x........, recursion count 0, owner 1.
+ at 0x........: pthread_mutex_unlock (drd_pthread_intercepts.c:?)
+ by 0x........: lock_twice (recursive_mutex.c:?)
+ by 0x........: main (recursive_mutex.c:?)
+mutex 0x........ was first observed at:
+ at 0x........: pthread_mutex_trylock (drd_pthread_intercepts.c:?)
+ by 0x........: lock_twice (recursive_mutex.c:?)
+ by 0x........: main (recursive_mutex.c:?)
+
+second unlock call failed !
+
+Done.
+
+ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
#include <string>
#include <sstream>
#include <list>
+#if defined(__FreeBSD__)
+#include <mutex>
+#endif
using namespace std;
+#if defined(__FreeBSD__)
+std::mutex g_mutex;
+
+// according to this
+// https://stackoverflow.com/questions/4057319/is-setlocale-thread-safe-function
+// setlocale is not thread safe, and indeed on FreeBSD
+// a load of errors are generated if this is not guarded
+void setlocale_wrapper()
+{
+ const std::lock_guard<std::mutex> lock(g_mutex);
+ setlocale(LC_ALL, "English");
+}
+
+#else
+
+void setlocale_wrapper()
+{
+ setlocale(LC_ALL, "English");
+}
+
+#endif
+
class SubTest {
public:
SubTest() {
public:
void setUp() {
subTest = new SubTest();
- setlocale(LC_ALL, "English");
+ setlocale_wrapper();
}
void tearDown() {
delete subTest; }
#include <string>
#include <cstring>
#include <pthread.h>
+#if defined(__FreeBSD__)
+#include <stdio.h>
+#endif
#include <stdlib.h>
#include <unistd.h>
fun:allocate_stack
fun:pthread_create@@GLIBC_2.2*
}
+{
+ drd-gcc-runtims
+ drd:ConflictingAccess
+ obj:/lib/libgcc_s.so.1
+}
+{
+ drd-iterate-phdr
+ drd:ConflictingAccess
+ fun:dl_iterate_phdr
+}
+{
+ drd-unwind-cfa
+ drd:ConflictingAccess
+ fun:_Unwind_GetCFA
+}
+{
+ drd-thr
+ drd:ConflictingAccess
+ obj:/lib/libthr.so.3
+}
+{
+ drd-rtld
+ drd:ConflictingAccess
+ obj:/libexec/ld-elf*.so.1
+}
+
--- /dev/null
+
+Mutex not locked by calling thread: mutex 0x........, recursion count 0, owner 1.
+ at 0x........: pthread_mutex_unlock (drd_pthread_intercepts.c:?)
+ by 0x........: nearly_main (tc09_bad_unlock.c:28)
+ by 0x........: main (tc09_bad_unlock.c:52)
+mutex 0x........ was first observed at:
+ at 0x........: pthread_mutex_init (drd_pthread_intercepts.c:?)
+ by 0x........: nearly_main (tc09_bad_unlock.c:24)
+ by 0x........: main (tc09_bad_unlock.c:52)
+
+Thread 2:
+Mutex not locked by calling thread: mutex 0x........, recursion count 1, owner 1.
+ at 0x........: pthread_mutex_unlock (drd_pthread_intercepts.c:?)
+ by 0x........: child_fn (tc09_bad_unlock.c:12)
+ by 0x........: vgDrd_thread_wrapper (drd_pthread_intercepts.c:?)
+mutex 0x........ was first observed at:
+ at 0x........: pthread_mutex_init (drd_pthread_intercepts.c:?)
+ by 0x........: nearly_main (tc09_bad_unlock.c:32)
+ by 0x........: main (tc09_bad_unlock.c:52)
+
+Thread 1:
+Destroying locked mutex: mutex 0x........, recursion count 1, owner 1.
+ at 0x........: nearly_main (tc09_bad_unlock.c:48)
+ by 0x........: main (tc09_bad_unlock.c:52)
+mutex 0x........ was first observed at:
+ at 0x........: pthread_mutex_init (drd_pthread_intercepts.c:?)
+ by 0x........: nearly_main (tc09_bad_unlock.c:32)
+ by 0x........: main (tc09_bad_unlock.c:52)
+
+---------------------
+Mutex not locked by calling thread: mutex 0x........, recursion count 0, owner 1.
+ at 0x........: pthread_mutex_unlock (drd_pthread_intercepts.c:?)
+ by 0x........: nearly_main (tc09_bad_unlock.c:28)
+ by 0x........: main (tc09_bad_unlock.c:53)
+mutex 0x........ was first observed at:
+ at 0x........: pthread_mutex_init (drd_pthread_intercepts.c:?)
+ by 0x........: nearly_main (tc09_bad_unlock.c:24)
+ by 0x........: main (tc09_bad_unlock.c:53)
+
+Destroying locked mutex: mutex 0x........, recursion count 1, owner 1.
+ at 0x........: nearly_main (tc09_bad_unlock.c:48)
+ by 0x........: main (tc09_bad_unlock.c:53)
+mutex 0x........ was first observed at:
+ at 0x........: pthread_mutex_init (drd_pthread_intercepts.c:?)
+ by 0x........: nearly_main (tc09_bad_unlock.c:32)
+ by 0x........: main (tc09_bad_unlock.c:53)
+
+
+ERROR SUMMARY: 6 errors from 5 contexts (suppressed: 0 from 0)
--- /dev/null
+
+Mutex not locked by calling thread: mutex 0x........, recursion count 0, owner 1.
+ at 0x........: pthread_mutex_unlock (drd_pthread_intercepts.c:?)
+ by 0x........: nearly_main (tc09_bad_unlock.c:28)
+ by 0x........: main (tc09_bad_unlock.c:52)
+mutex 0x........ was first observed at:
+ at 0x........: pthread_mutex_init (drd_pthread_intercepts.c:?)
+ by 0x........: nearly_main (tc09_bad_unlock.c:24)
+ by 0x........: main (tc09_bad_unlock.c:52)
+
+Thread 2:
+Mutex not locked by calling thread: mutex 0x........, recursion count 1, owner 1.
+ at 0x........: pthread_mutex_unlock (drd_pthread_intercepts.c:?)
+ by 0x........: child_fn (tc09_bad_unlock.c:12)
+ by 0x........: vgDrd_thread_wrapper (drd_pthread_intercepts.c:?)
+mutex 0x........ was first observed at:
+ at 0x........: pthread_mutex_init (drd_pthread_intercepts.c:?)
+ by 0x........: nearly_main (tc09_bad_unlock.c:32)
+ by 0x........: main (tc09_bad_unlock.c:52)
+
+Thread 1:
+Destroying locked mutex: mutex 0x........, recursion count 1, owner 1.
+ at 0x........: nearly_main (tc09_bad_unlock.c:39)
+ by 0x........: main (tc09_bad_unlock.c:52)
+mutex 0x........ was first observed at:
+ at 0x........: pthread_mutex_init (drd_pthread_intercepts.c:?)
+ by 0x........: nearly_main (tc09_bad_unlock.c:32)
+ by 0x........: main (tc09_bad_unlock.c:52)
+
+---------------------
+Mutex not locked by calling thread: mutex 0x........, recursion count 0, owner 1.
+ at 0x........: pthread_mutex_unlock (drd_pthread_intercepts.c:?)
+ by 0x........: nearly_main (tc09_bad_unlock.c:28)
+ by 0x........: main (tc09_bad_unlock.c:53)
+mutex 0x........ was first observed at:
+ at 0x........: pthread_mutex_init (drd_pthread_intercepts.c:?)
+ by 0x........: nearly_main (tc09_bad_unlock.c:24)
+ by 0x........: main (tc09_bad_unlock.c:53)
+
+Destroying locked mutex: mutex 0x........, recursion count 1, owner 1.
+ at 0x........: nearly_main (tc09_bad_unlock.c:39)
+ by 0x........: main (tc09_bad_unlock.c:53)
+mutex 0x........ was first observed at:
+ at 0x........: pthread_mutex_init (drd_pthread_intercepts.c:?)
+ by 0x........: nearly_main (tc09_bad_unlock.c:32)
+ by 0x........: main (tc09_bad_unlock.c:53)
+
+
+ERROR SUMMARY: 6 errors from 5 contexts (suppressed: 0 from 0)
Mutex not locked by calling thread: mutex 0x........, recursion count 0, owner 1.
at 0x........: pthread_mutex_unlock (drd_pthread_intercepts.c:?)
- by 0x........: nearly_main (tc09_bad_unlock.c:27)
- by 0x........: main (tc09_bad_unlock.c:49)
+ by 0x........: nearly_main (tc09_bad_unlock.c:28)
+ by 0x........: main (tc09_bad_unlock.c:52)
mutex 0x........ was first observed at:
at 0x........: pthread_mutex_init (drd_pthread_intercepts.c:?)
- by 0x........: nearly_main (tc09_bad_unlock.c:23)
- by 0x........: main (tc09_bad_unlock.c:49)
+ by 0x........: nearly_main (tc09_bad_unlock.c:24)
+ by 0x........: main (tc09_bad_unlock.c:52)
Thread 2:
Mutex not locked by calling thread: mutex 0x........, recursion count 1, owner 1.
at 0x........: pthread_mutex_unlock (drd_pthread_intercepts.c:?)
- by 0x........: child_fn (tc09_bad_unlock.c:11)
+ by 0x........: child_fn (tc09_bad_unlock.c:12)
by 0x........: vgDrd_thread_wrapper (drd_pthread_intercepts.c:?)
mutex 0x........ was first observed at:
at 0x........: pthread_mutex_init (drd_pthread_intercepts.c:?)
- by 0x........: nearly_main (tc09_bad_unlock.c:31)
- by 0x........: main (tc09_bad_unlock.c:49)
+ by 0x........: nearly_main (tc09_bad_unlock.c:32)
+ by 0x........: main (tc09_bad_unlock.c:52)
Thread 1:
The object at address 0x........ is not a mutex.
at 0x........: pthread_mutex_unlock (drd_pthread_intercepts.c:?)
- by 0x........: nearly_main (tc09_bad_unlock.c:41)
- by 0x........: main (tc09_bad_unlock.c:49)
+ by 0x........: nearly_main (tc09_bad_unlock.c:43)
+ by 0x........: main (tc09_bad_unlock.c:52)
Destroying locked mutex: mutex 0x........, recursion count 1, owner 1.
- at 0x........: nearly_main (tc09_bad_unlock.c:45)
- by 0x........: (below main)
+ at 0x........: nearly_main (tc09_bad_unlock.c:48)
+ by 0x........: main (tc09_bad_unlock.c:52)
mutex 0x........ was first observed at:
at 0x........: pthread_mutex_init (drd_pthread_intercepts.c:?)
- by 0x........: nearly_main (tc09_bad_unlock.c:31)
- by 0x........: main (tc09_bad_unlock.c:49)
+ by 0x........: nearly_main (tc09_bad_unlock.c:32)
+ by 0x........: main (tc09_bad_unlock.c:52)
---------------------
Mutex not locked by calling thread: mutex 0x........, recursion count 0, owner 1.
at 0x........: pthread_mutex_unlock (drd_pthread_intercepts.c:?)
- by 0x........: nearly_main (tc09_bad_unlock.c:27)
- by 0x........: main (tc09_bad_unlock.c:50)
+ by 0x........: nearly_main (tc09_bad_unlock.c:28)
+ by 0x........: main (tc09_bad_unlock.c:53)
mutex 0x........ was first observed at:
at 0x........: pthread_mutex_init (drd_pthread_intercepts.c:?)
- by 0x........: nearly_main (tc09_bad_unlock.c:23)
- by 0x........: main (tc09_bad_unlock.c:50)
+ by 0x........: nearly_main (tc09_bad_unlock.c:24)
+ by 0x........: main (tc09_bad_unlock.c:53)
The object at address 0x........ is not a mutex.
at 0x........: pthread_mutex_unlock (drd_pthread_intercepts.c:?)
- by 0x........: nearly_main (tc09_bad_unlock.c:41)
- by 0x........: main (tc09_bad_unlock.c:50)
+ by 0x........: nearly_main (tc09_bad_unlock.c:43)
+ by 0x........: main (tc09_bad_unlock.c:53)
Destroying locked mutex: mutex 0x........, recursion count 1, owner 1.
- at 0x........: nearly_main (tc09_bad_unlock.c:45)
- by 0x........: (below main)
+ at 0x........: nearly_main (tc09_bad_unlock.c:48)
+ by 0x........: main (tc09_bad_unlock.c:53)
mutex 0x........ was first observed at:
at 0x........: pthread_mutex_init (drd_pthread_intercepts.c:?)
- by 0x........: nearly_main (tc09_bad_unlock.c:31)
- by 0x........: main (tc09_bad_unlock.c:50)
+ by 0x........: nearly_main (tc09_bad_unlock.c:32)
+ by 0x........: main (tc09_bad_unlock.c:53)
ERROR SUMMARY: 8 errors from 7 contexts (suppressed: 0 from 0)
prereq: ./supported_libpthread && [ -e ../../helgrind/tests/tc22_exit_w_lock ]
vgopts: --num-callers=3 -q
prog: ../../helgrind/tests/tc22_exit_w_lock
+cleanup: rm -f vgcore.*
--- /dev/null
+
+Mutex not locked: mutex 0x........, recursion count 0, owner 0.
+ at 0x........: pthread_cond_wait (drd_pthread_intercepts.c:?)
+ by 0x........: main (tc23_bogus_condwait.c:79)
+mutex 0x........ was first observed at:
+ at 0x........: pthread_mutex_init (drd_pthread_intercepts.c:?)
+ by 0x........: main (tc23_bogus_condwait.c:59)
+
+The object at address 0x........ is not a mutex.
+ at 0x........: pthread_cond_wait (drd_pthread_intercepts.c:?)
+ by 0x........: main (tc23_bogus_condwait.c:82)
+rwlock 0x........ was first observed at:
+ at 0x........: pthread_rwlock_init (drd_pthread_intercepts.c:?)
+ by 0x........: main (tc23_bogus_condwait.c:62)
+
+Mutex not locked by calling thread: mutex 0x........, recursion count 1, owner 2.
+ at 0x........: pthread_cond_wait (drd_pthread_intercepts.c:?)
+ by 0x........: main (tc23_bogus_condwait.c:85)
+mutex 0x........ was first observed at:
+ at 0x........: pthread_mutex_init (drd_pthread_intercepts.c:?)
+ by 0x........: main (tc23_bogus_condwait.c:58)
+
+The impossible happened: mutex is locked simultaneously by two threads: mutex 0x........, recursion count 1, owner 2.
+ at 0x........: pthread_cond_wait (drd_pthread_intercepts.c:?)
+ by 0x........: main (tc23_bogus_condwait.c:85)
+mutex 0x........ was first observed at:
+ at 0x........: pthread_mutex_init (drd_pthread_intercepts.c:?)
+ by 0x........: main (tc23_bogus_condwait.c:58)
+
+Thread 2:
+Mutex not locked by calling thread: mutex 0x........, recursion count 2, owner 1.
+ at 0x........: pthread_mutex_unlock (drd_pthread_intercepts.c:?)
+ by 0x........: grab_the_lock (tc23_bogus_condwait.c:47)
+ by 0x........: vgDrd_thread_wrapper (drd_pthread_intercepts.c:?)
+mutex 0x........ was first observed at:
+ at 0x........: pthread_mutex_init (drd_pthread_intercepts.c:?)
+ by 0x........: main (tc23_bogus_condwait.c:58)
+
+
+ERROR SUMMARY: 6 errors from 5 contexts (suppressed: 0 from 0)
The object at address 0x........ is not a mutex.
at 0x........: pthread_cond_wait (drd_pthread_intercepts.c:?)
- by 0x........: main (tc23_bogus_condwait.c:69)
+ by 0x........: main (tc23_bogus_condwait.c:75)
Thread 3:
Probably a race condition: condition variable 0x........ has been signaled but the associated mutex 0x........ is not locked by the signalling thread.
at 0x........: pthread_cond_signal (drd_pthread_intercepts.c:?)
- by 0x........: rescue_me (tc23_bogus_condwait.c:20)
+ by 0x........: rescue_me (tc23_bogus_condwait.c:24)
by 0x........: vgDrd_thread_wrapper (drd_pthread_intercepts.c:?)
cond 0x........ was first observed at:
at 0x........: pthread_cond_init (drd_pthread_intercepts.c:?)
- by 0x........: main (tc23_bogus_condwait.c:56)
+ by 0x........: main (tc23_bogus_condwait.c:61)
Thread 1:
Mutex not locked: mutex 0x........, recursion count 0, owner 0.
at 0x........: pthread_cond_wait (drd_pthread_intercepts.c:?)
- by 0x........: main (tc23_bogus_condwait.c:72)
+ by 0x........: main (tc23_bogus_condwait.c:79)
mutex 0x........ was first observed at:
at 0x........: pthread_mutex_init (drd_pthread_intercepts.c:?)
- by 0x........: main (tc23_bogus_condwait.c:54)
+ by 0x........: main (tc23_bogus_condwait.c:59)
Thread 3:
Probably a race condition: condition variable 0x........ has been signaled but the associated mutex 0x........ is not locked by the signalling thread.
at 0x........: pthread_cond_signal (drd_pthread_intercepts.c:?)
- by 0x........: rescue_me (tc23_bogus_condwait.c:24)
+ by 0x........: rescue_me (tc23_bogus_condwait.c:29)
by 0x........: vgDrd_thread_wrapper (drd_pthread_intercepts.c:?)
cond 0x........ was first observed at:
at 0x........: pthread_cond_init (drd_pthread_intercepts.c:?)
- by 0x........: main (tc23_bogus_condwait.c:56)
+ by 0x........: main (tc23_bogus_condwait.c:61)
mutex 0x........ was first observed at:
at 0x........: pthread_mutex_init (drd_pthread_intercepts.c:?)
- by 0x........: main (tc23_bogus_condwait.c:54)
+ by 0x........: main (tc23_bogus_condwait.c:59)
Thread 1:
The object at address 0x........ is not a mutex.
at 0x........: pthread_cond_wait (drd_pthread_intercepts.c:?)
- by 0x........: main (tc23_bogus_condwait.c:75)
+ by 0x........: main (tc23_bogus_condwait.c:82)
rwlock 0x........ was first observed at:
at 0x........: pthread_rwlock_init (drd_pthread_intercepts.c:?)
- by 0x........: main (tc23_bogus_condwait.c:57)
+ by 0x........: main (tc23_bogus_condwait.c:62)
Thread 3:
Probably a race condition: condition variable 0x........ has been signaled but the associated mutex 0x........ is not locked by the signalling thread.
at 0x........: pthread_cond_signal (drd_pthread_intercepts.c:?)
- by 0x........: rescue_me (tc23_bogus_condwait.c:28)
+ by 0x........: rescue_me (tc23_bogus_condwait.c:33)
by 0x........: vgDrd_thread_wrapper (drd_pthread_intercepts.c:?)
cond 0x........ was first observed at:
at 0x........: pthread_cond_init (drd_pthread_intercepts.c:?)
- by 0x........: main (tc23_bogus_condwait.c:56)
+ by 0x........: main (tc23_bogus_condwait.c:61)
rwlock 0x........ was first observed at:
at 0x........: pthread_rwlock_init (drd_pthread_intercepts.c:?)
- by 0x........: main (tc23_bogus_condwait.c:57)
+ by 0x........: main (tc23_bogus_condwait.c:62)
Thread 1:
Mutex not locked by calling thread: mutex 0x........, recursion count 1, owner 2.
at 0x........: pthread_cond_wait (drd_pthread_intercepts.c:?)
- by 0x........: main (tc23_bogus_condwait.c:78)
+ by 0x........: main (tc23_bogus_condwait.c:85)
mutex 0x........ was first observed at:
at 0x........: pthread_mutex_init (drd_pthread_intercepts.c:?)
- by 0x........: main (tc23_bogus_condwait.c:53)
+ by 0x........: main (tc23_bogus_condwait.c:58)
Thread 3:
Probably a race condition: condition variable 0x........ has been signaled but the associated mutex 0x........ is not locked by the signalling thread.
at 0x........: pthread_cond_signal (drd_pthread_intercepts.c:?)
- by 0x........: rescue_me (tc23_bogus_condwait.c:32)
+ by 0x........: rescue_me (tc23_bogus_condwait.c:37)
by 0x........: vgDrd_thread_wrapper (drd_pthread_intercepts.c:?)
cond 0x........ was first observed at:
at 0x........: pthread_cond_init (drd_pthread_intercepts.c:?)
- by 0x........: main (tc23_bogus_condwait.c:56)
+ by 0x........: main (tc23_bogus_condwait.c:61)
mutex 0x........ was first observed at:
at 0x........: pthread_mutex_init (drd_pthread_intercepts.c:?)
- by 0x........: main (tc23_bogus_condwait.c:53)
+ by 0x........: main (tc23_bogus_condwait.c:58)
Thread 1:
The impossible happened: mutex is locked simultaneously by two threads: mutex 0x........, recursion count 1, owner 2.
at 0x........: pthread_cond_wait (drd_pthread_intercepts.c:?)
- by 0x........: main (tc23_bogus_condwait.c:78)
+ by 0x........: main (tc23_bogus_condwait.c:85)
mutex 0x........ was first observed at:
at 0x........: pthread_mutex_init (drd_pthread_intercepts.c:?)
- by 0x........: main (tc23_bogus_condwait.c:53)
+ by 0x........: main (tc23_bogus_condwait.c:58)
Thread 2:
Mutex not locked by calling thread: mutex 0x........, recursion count 2, owner 1.
at 0x........: pthread_mutex_unlock (drd_pthread_intercepts.c:?)
- by 0x........: grab_the_lock (tc23_bogus_condwait.c:42)
+ by 0x........: grab_the_lock (tc23_bogus_condwait.c:47)
by 0x........: vgDrd_thread_wrapper (drd_pthread_intercepts.c:?)
mutex 0x........ was first observed at:
at 0x........: pthread_mutex_init (drd_pthread_intercepts.c:?)
- by 0x........: main (tc23_bogus_condwait.c:53)
+ by 0x........: main (tc23_bogus_condwait.c:58)
ERROR SUMMARY: 12 errors from 10 contexts (suppressed: 0 from 0)
-prereq: test -e thread_name && ./supported_libpthread
+prereq: test -e thread_name && ./supported_libpthread && ! ../../tests/os_test freebsd
vgopts: --read-var-info=yes --check-stack-var=yes --num-callers=3
prog: thread_name
--- /dev/null
+/* Test whether assigning names to threads works properly. */
+
+#define _GNU_SOURCE
+#include <pthread.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <string.h>
+#include "../../drd/drd.h"
+
+
+#define NUM_THREADS 10
+
+
+static pthread_barrier_t s_barrier;
+static pthread_mutex_t s_mutex;
+static pthread_cond_t s_cond;
+static int s_counter;
+
+static void* thread_func(void* argp)
+{
+ const int thread_num = (ptrdiff_t)(argp);
+ pthread_mutex_t invalid_mutex;
+ char thread_name[32];
+
+ snprintf(thread_name, sizeof(thread_name),
+ "thread_func instance %d", thread_num + 1);
+ ANNOTATE_THREAD_NAME(thread_name);
+
+ pthread_barrier_wait(&s_barrier);
+
+ pthread_mutex_lock(&s_mutex);
+ while (s_counter != thread_num)
+ pthread_cond_wait(&s_cond, &s_mutex);
+ fprintf(stderr, "\n%s\n\n", thread_name);
+ pthread_mutex_unlock(&invalid_mutex);
+ s_counter++;
+ pthread_cond_broadcast(&s_cond);
+ pthread_mutex_unlock(&s_mutex);
+
+ return 0;
+}
+
+
+int main(int arg, char** argv)
+{
+ int i;
+ pthread_t tid[NUM_THREADS];
+
+ pthread_barrier_init(&s_barrier, NULL, NUM_THREADS);
+ pthread_mutex_init(&s_mutex, 0);
+ pthread_cond_init(&s_cond, 0);
+
+ for (i = 0; i < NUM_THREADS; i++)
+ pthread_create(&tid[i], 0, thread_func, (void*)(ptrdiff_t)i);
+
+ for (i = 0; i < NUM_THREADS; i++)
+ pthread_join(tid[i], 0);
+
+ pthread_cond_destroy(&s_cond);
+ pthread_mutex_destroy(&s_mutex);
+
+ return 0;
+}
--- /dev/null
+
+
+thread_func instance 1
+
+Thread 2 (thread_func instance 1):
+The object at address 0x........ is not a mutex.
+ at 0x........: pthread_mutex_unlock (drd_pthread_intercepts.c:?)
+ by 0x........: thread_func (thread_name_freebsd.c:?)
+ by 0x........: vgDrd_thread_wrapper (drd_pthread_intercepts.c:?)
+
+
+thread_func instance 2
+
+Thread 3 (thread_func instance 2):
+The object at address 0x........ is not a mutex.
+ at 0x........: pthread_mutex_unlock (drd_pthread_intercepts.c:?)
+ by 0x........: thread_func (thread_name_freebsd.c:?)
+ by 0x........: vgDrd_thread_wrapper (drd_pthread_intercepts.c:?)
+
+
+thread_func instance 3
+
+Thread 4 (thread_func instance 3):
+The object at address 0x........ is not a mutex.
+ at 0x........: pthread_mutex_unlock (drd_pthread_intercepts.c:?)
+ by 0x........: thread_func (thread_name_freebsd.c:?)
+ by 0x........: vgDrd_thread_wrapper (drd_pthread_intercepts.c:?)
+
+
+thread_func instance 4
+
+Thread 5 (thread_func instance 4):
+The object at address 0x........ is not a mutex.
+ at 0x........: pthread_mutex_unlock (drd_pthread_intercepts.c:?)
+ by 0x........: thread_func (thread_name_freebsd.c:?)
+ by 0x........: vgDrd_thread_wrapper (drd_pthread_intercepts.c:?)
+
+
+thread_func instance 5
+
+Thread 6 (thread_func instance 5):
+The object at address 0x........ is not a mutex.
+ at 0x........: pthread_mutex_unlock (drd_pthread_intercepts.c:?)
+ by 0x........: thread_func (thread_name_freebsd.c:?)
+ by 0x........: vgDrd_thread_wrapper (drd_pthread_intercepts.c:?)
+
+
+thread_func instance 6
+
+Thread 7 (thread_func instance 6):
+The object at address 0x........ is not a mutex.
+ at 0x........: pthread_mutex_unlock (drd_pthread_intercepts.c:?)
+ by 0x........: thread_func (thread_name_freebsd.c:?)
+ by 0x........: vgDrd_thread_wrapper (drd_pthread_intercepts.c:?)
+
+
+thread_func instance 7
+
+Thread 8 (thread_func instance 7):
+The object at address 0x........ is not a mutex.
+ at 0x........: pthread_mutex_unlock (drd_pthread_intercepts.c:?)
+ by 0x........: thread_func (thread_name_freebsd.c:?)
+ by 0x........: vgDrd_thread_wrapper (drd_pthread_intercepts.c:?)
+
+
+thread_func instance 8
+
+Thread 9 (thread_func instance 8):
+The object at address 0x........ is not a mutex.
+ at 0x........: pthread_mutex_unlock (drd_pthread_intercepts.c:?)
+ by 0x........: thread_func (thread_name_freebsd.c:?)
+ by 0x........: vgDrd_thread_wrapper (drd_pthread_intercepts.c:?)
+
+
+thread_func instance 9
+
+Thread 10 (thread_func instance 9):
+The object at address 0x........ is not a mutex.
+ at 0x........: pthread_mutex_unlock (drd_pthread_intercepts.c:?)
+ by 0x........: thread_func (thread_name_freebsd.c:?)
+ by 0x........: vgDrd_thread_wrapper (drd_pthread_intercepts.c:?)
+
+
+thread_func instance 10
+
+Thread 11 (thread_func instance 10):
+The object at address 0x........ is not a mutex.
+ at 0x........: pthread_mutex_unlock (drd_pthread_intercepts.c:?)
+ by 0x........: thread_func (thread_name_freebsd.c:?)
+ by 0x........: vgDrd_thread_wrapper (drd_pthread_intercepts.c:?)
+
+
+ERROR SUMMARY: 10 errors from 10 contexts (suppressed: 0 from 0)
--- /dev/null
+prereq: ../../tests/os_test freebsd
+vgopts: --read-var-info=yes --check-stack-var=yes --num-callers=3
+prog: thread_name_freebsd
-prereq: test -e thread_name && ./supported_libpthread
+prereq: test -e thread_name && ./supported_libpthread && ! ../../tests/os_test freebsd
vgopts: --read-var-info=yes --check-stack-var=yes --num-callers=3 --xml=yes --xml-fd=2
prog: thread_name
stderr_filter: filter_thread_name_xml
dist_noinst_SCRIPTS = filter_stderr \
filter_stderr_solaris \
filter_helgrind \
- filter_xml
+ filter_xml \
+ filter_freebsd.awk \
+ filter_stderr_freebsd
EXTRA_DIST = \
annotate_hbefore.vgtest annotate_hbefore.stdout.exp \
cond_timedwait_test.stderr.exp \
bar_bad.vgtest bar_bad.stdout.exp bar_bad.stderr.exp \
bar_bad.stderr.exp-destroy-hang \
+ bar_bad.stderr.exp-freebsd \
bar_trivial.vgtest bar_trivial.stdout.exp bar_trivial.stderr.exp \
free_is_write.vgtest free_is_write.stdout.exp \
free_is_write.stderr.exp \
locked_vs_unlocked2.vgtest \
locked_vs_unlocked2.stderr.exp \
locked_vs_unlocked2.stdout.exp \
+ locked_vs_unlocked2.stderr.exp-freebsd \
locked_vs_unlocked3.vgtest \
locked_vs_unlocked3.stderr.exp \
locked_vs_unlocked3.stdout.exp \
+ locked_vs_unlocked3.stderr.exp-freebsd \
pth_barrier1.vgtest pth_barrier1.stdout.exp pth_barrier1.stderr.exp \
pth_barrier2.vgtest pth_barrier2.stdout.exp pth_barrier2.stderr.exp \
pth_barrier3.vgtest pth_barrier3.stdout.exp pth_barrier3.stderr.exp \
pth_cond_destroy_busy.vgtest pth_cond_destroy_busy.stderr.exp \
pth_cond_destroy_busy.stderr.exp-ppc64 \
pth_cond_destroy_busy.stderr.exp-solaris \
+ pth_cond_destroy_busy.stderr.exp-freebsd \
pth_spinlock.vgtest pth_spinlock.stdout.exp pth_spinlock.stderr.exp \
rwlock_race.vgtest rwlock_race.stdout.exp rwlock_race.stderr.exp \
rwlock_test.vgtest rwlock_test.stdout.exp rwlock_test.stderr.exp \
tc06_two_races.stderr.exp \
tc06_two_races_xml.vgtest tc06_two_races_xml.stdout.exp \
tc06_two_races_xml.stderr.exp \
+ tc06_two_races_xml.stderr.exp-freebsd \
tc07_hbl1.vgtest tc07_hbl1.stdout.exp tc07_hbl1.stderr.exp \
tc08_hbl2.vgtest tc08_hbl2.stdout.exp tc08_hbl2.stderr.exp \
tc09_bad_unlock.vgtest tc09_bad_unlock.stdout.exp \
tc09_bad_unlock.stderr.exp tc09_bad_unlock.stderr.exp-solaris \
+ tc09_bad_unlock.stderr.exp-freebsd \
tc10_rec_lock.vgtest tc10_rec_lock.stdout.exp tc10_rec_lock.stderr.exp \
tc11_XCHG.vgtest tc11_XCHG.stdout.exp tc11_XCHG.stderr.exp \
tc12_rwl_trivial.vgtest tc12_rwl_trivial.stdout.exp \
tc12_rwl_trivial.stderr.exp \
tc12_rwl_trivial.stderr.exp-darwin970 \
tc12_rwl_trivial.stderr.exp-solaris \
+ tc12_rwl_trivial.stderr.exp-freebsd \
tc13_laog1.vgtest tc13_laog1.stdout.exp tc13_laog1.stderr.exp \
tc14_laog_dinphils.vgtest tc14_laog_dinphils.stdout.exp \
tc14_laog_dinphils.stderr.exp \
tc18_semabuse.stderr.exp-linux-mips32 \
tc18_semabuse.stderr.exp-linux-mips32-b \
tc18_semabuse.stderr.exp-solaris \
+ tc18_semabuse.stderr.exp-freebsd \
tc19_shadowmem.vgtest tc19_shadowmem.stdout.exp \
tc19_shadowmem.stderr.exp tc19_shadowmem.stderr.exp-mips32 \
tc19_shadowmem.stderr.exp-mips32-BE \
tc23_bogus_condwait.vgtest tc23_bogus_condwait.stdout.exp \
tc23_bogus_condwait.stderr.exp \
tc23_bogus_condwait.stderr.exp-mips32 \
+ tc23_bogus_condwait.stderr.exp-freebsd \
tc24_nonzero_sem.vgtest tc24_nonzero_sem.stdout.exp \
tc24_nonzero_sem.stderr.exp \
tls_threads.vgtest tls_threads.stdout.exp \
#include <assert.h>
#include <unistd.h>
#include <string.h>
+#include "config.h"
void* child1 ( void* arg )
{
bar5 = malloc(sizeof(pthread_barrier_t));
assert(bar5);
memset(bar5, 1, sizeof(*bar5));
+#if !defined(VGO_freebsd)
pthread_barrier_destroy(bar5);
+#endif
/* now we need to clean up the mess .. But skip canceling threads. */
/* r= pthread_cancel(thr1); assert(!r); // drd doesn't like it. Just exit.
Thread #x: pthread_barrier_init: 'count' argument is zero
at 0x........: pthread_barrier_init (hg_intercepts.c:...)
- by 0x........: main (bar_bad.c:43)
+ by 0x........: main (bar_bad.c:44)
----------------------------------------------------------------
Thread #x's call to pthread_barrier_init failed
with error code 22 (EINVAL: Invalid argument)
at 0x........: pthread_barrier_init (hg_intercepts.c:...)
- by 0x........: main (bar_bad.c:43)
+ by 0x........: main (bar_bad.c:44)
initialise a barrier twice
Thread #x: pthread_barrier_init: barrier is already initialised
at 0x........: pthread_barrier_init (hg_intercepts.c:...)
- by 0x........: main (bar_bad.c:49)
+ by 0x........: main (bar_bad.c:50)
initialise a barrier which has threads waiting on it
Thread #x: pthread_barrier_init: barrier is already initialised
at 0x........: pthread_barrier_init (hg_intercepts.c:...)
- by 0x........: main (bar_bad.c:64)
+ by 0x........: main (bar_bad.c:65)
----------------------------------------------------------------
Thread #x: pthread_barrier_init: threads are waiting at barrier
at 0x........: pthread_barrier_init (hg_intercepts.c:...)
- by 0x........: main (bar_bad.c:64)
+ by 0x........: main (bar_bad.c:65)
destroy a barrier that has waiting threads
Thread #x: pthread_barrier_destroy: threads are waiting at barrier
at 0x........: pthread_barrier_destroy (hg_intercepts.c:...)
- by 0x........: main (bar_bad.c:82)
+ by 0x........: main (bar_bad.c:83)
---Thread-Announcement------------------------------------------
Thread #x was created
...
by 0x........: pthread_create@* (hg_intercepts.c:...)
- by 0x........: main (bar_bad.c:76)
+ by 0x........: main (bar_bad.c:77)
----------------------------------------------------------------
Thread #x: pthread_barrier_wait: barrier is uninitialised
at 0x........: pthread_barrier_wait (hg_intercepts.c:...)
- by 0x........: sleep1 (bar_bad.c:22)
+ by 0x........: sleep1 (bar_bad.c:23)
by 0x........: mythread_wrapper (hg_intercepts.c:...)
...
Thread #x: pthread_barrier_destroy: barrier was never initialised
at 0x........: pthread_barrier_destroy (hg_intercepts.c:...)
- by 0x........: main (bar_bad.c:98)
+ by 0x........: main (bar_bad.c:100)
--- /dev/null
+
+initialise a barrier with zero count
+---Thread-Announcement------------------------------------------
+
+Thread #x is the program's root thread
+
+----------------------------------------------------------------
+
+Thread #x: pthread_barrier_init: 'count' argument is zero
+ at 0x........: pthread_barrier_init (hg_intercepts.c:...)
+ by 0x........: main (bar_bad.c:44)
+
+----------------------------------------------------------------
+
+Thread #x's call to pthread_barrier_init failed
+ with error code 22 (EINVAL: Invalid argument)
+ at 0x........: pthread_barrier_init (hg_intercepts.c:...)
+ by 0x........: main (bar_bad.c:44)
+
+
+initialise a barrier twice
+----------------------------------------------------------------
+
+Thread #x: pthread_barrier_init: barrier is already initialised
+ at 0x........: pthread_barrier_init (hg_intercepts.c:...)
+ by 0x........: main (bar_bad.c:50)
+
+
+initialise a barrier which has threads waiting on it
+----------------------------------------------------------------
+
+Thread #x: pthread_barrier_init: barrier is already initialised
+ at 0x........: pthread_barrier_init (hg_intercepts.c:...)
+ by 0x........: main (bar_bad.c:65)
+
+----------------------------------------------------------------
+
+Thread #x: pthread_barrier_init: threads are waiting at barrier
+ at 0x........: pthread_barrier_init (hg_intercepts.c:...)
+ by 0x........: main (bar_bad.c:65)
+
+
+destroy a barrier that has waiting threads
+----------------------------------------------------------------
+
+Thread #x: pthread_barrier_destroy: threads are waiting at barrier
+ at 0x........: pthread_barrier_destroy (hg_intercepts.c:...)
+ by 0x........: main (bar_bad.c:83)
+
+----------------------------------------------------------------
+
+Thread #x's call to pthread_barrier_destroy failed
+ with error code 16 (EBUSY: Device or resource busy)
+ at 0x........: pthread_barrier_destroy (hg_intercepts.c:...)
+ by 0x........: main (bar_bad.c:83)
+
+
+destroy a barrier that was never initialised
--- /dev/null
+/pthread_create_WRK \(hg_intercepts.c/ {
+ print;
+ getline;
+ if (!match($0, /pthread_create \(hg_intercepts.c/)) {
+ print " by 0x........: pthread_create@* (hg_intercepts.c:...)";
+ print;
+ } else {
+ sub(/pthread_create/, "pthread_create@*");
+ print;
+ }
+ next;
+}
+/pthread_cond_timedwait_WRK \(hg_intercepts.c/ {
+ print;
+ getline;
+ if (!match($0, /pthread_cond_timedwait \(hg_intercepts.c/)) {
+ print " by 0x........: pthread_cond_timedwait@* (hg_intercepts.c:...)";
+ print;
+ } else {
+ sub(/pthread_cond_timedwait/, "pthread_cond_timedwait@*");
+ print;
+ }
+ next;
+}
+/pthread_cond_wait_WRK \(hg_intercepts.c/ {
+ print;
+ getline;
+ if (!match($0, /pthread_cond_wait \(hg_intercepts.c/)) {
+ print " by 0x........: pthread_cond_wait@* (hg_intercepts.c:...)";
+ print;
+ } else {
+ sub(/pthread_cond_wait/, "pthread_cond_wait@*");
+ print;
+ }
+ next;
+}
+/pthread_cond_destroy_WRK \(hg_intercepts.c/ {
+ print;
+ getline;
+ if (!match($0, /pthread_cond_destroy \(hg_intercepts.c/)) {
+ print " by 0x........: pthread_cond_destroy@* (hg_intercepts.c:...)";
+ print;
+ } else {
+ sub(/pthread_cond_destroy/, "pthread_cond_destroy@*");
+ print;
+ }
+ next;
+}
+/pthread_cond_signal_WRK \(hg_intercepts.c/ {
+ print;
+ getline;
+ if (!match($0, /pthread_cond_signal \(hg_intercepts.c/)) {
+ print " by 0x........: pthread_cond_signal (hg_intercepts.c:...)";
+ print;
+ } else {
+ print;
+ }
+ next;
+}
+/mutex_lock_WRK \(hg_intercepts.c/ {
+ print;
+ getline;
+ if (!match($0, /pthread_mutex_lock \(hg_intercepts.c/)) {
+ print " by 0x........: pthread_mutex_lock (hg_intercepts.c:...)";
+ print;
+ } else {
+ print;
+ }
+ next;
+}
+/mutex_unlock_WRK \(hg_intercepts.c/ {
+ print;
+ getline;
+ if (!match($0, /pthread_mutex_unlock \(hg_intercepts.c/)) {
+ print " by 0x........: pthread_mutex_unlock (hg_intercepts.c:...)";
+ print;
+ } else {
+ print;
+ }
+ next;
+}
+/pthread_rwlock_unlock_WRK \(hg_intercepts.c/ {
+ print;
+ getline;
+ if (!match($0, /pthread_rwlock_unlock \(hg_intercepts.c/)) {
+ print " by 0x........: pthread_rwlock_unlock (hg_intercepts.c:...)";
+ print;
+ } else {
+ print;
+ }
+ next;
+}
+/pthread_rwlock_init_WRK \(hg_intercepts.c/ {
+ print;
+ getline;
+ if (!match($0, /pthread_rwlock_init \(hg_intercepts.c/)) {
+ print " by 0x........: pthread_rwlock_init (hg_intercepts.c:...)";
+ print;
+ } else {
+ print;
+ }
+ next;
+}
+/sem_init_WRK \(hg_intercepts.c/ {
+ print;
+ getline;
+ if (!match($0, /sem_init \(hg_intercepts.c/)) {
+ print " by 0x........: sem_init (hg_intercepts.c:...)";
+ print;
+ } else {
+ print;
+ }
+ next;
+}
+/sem_wait_WRK \(hg_intercepts.c/ {
+ print;
+ getline;
+ if (!match($0, /sem_wait \(hg_intercepts.c/)) {
+ print " by 0x........: sem_wait (hg_intercepts.c:...)";
+ print;
+ } else {
+ print;
+ }
+ next;
+}
+/sem_post_WRK \(hg_intercepts.c/ {
+ print;
+ getline;
+ if (!match($0, /sem_post \(hg_intercepts.c/)) {
+ print " by 0x........: sem_post (hg_intercepts.c:...)";
+ print;
+ } else {
+ print;
+ }
+ next;
+}
+/sem_destroy_WRK \(hg_intercepts.c/ {
+ print;
+ getline;
+ if (!match($0, /sem_destroy \(hg_intercepts.c/)) {
+ print " by 0x........: sem_destroy (hg_intercepts.c:...)";
+ print;
+ } else {
+ print;
+ }
+ next;
+}
+{print;}
dir=`dirname $0`
+SED=@SED@
+
$dir/../../tests/filter_stderr_basic |
# Anonymise addresses
cat
fi |
+# And FreeBSD
+if $dir/../../tests/os_test freebsd; then
+ #perl -p $dir/filter_stderr_freebsd
+ awk -f $dir/filter_freebsd.awk
+else
+ cat
+fi |
+
# get rid of the numbers in bits of text "Thread #n", "thread #n",
# "Thread n" and "thread n", "tid n"
# as these make some tests more scheduling sensitive -- those where
# there are multiple threads which play interchangeable roles.
-sed \
+$SED \
-e "s/tid [0-9][0-9]*/tid #x/g" \
-e "s/hread #[0-9][0-9]*/hread #x/g" \
-e "s/hread [0-9][0-9]*/hread x/g" |
# Likewise for frame numbers, which depend on compilation.
-sed -e "s/frame #[0-9][0-9]*/frame #x/g" | \
+$SED -e "s/frame #[0-9][0-9]*/frame #x/g" | \
# Remove the message that more than hundred errors have been detected
# (consists of two lines) and also the empty line above it.
# Merge sem_wait and sem_wait@*, as either could be used. Likewise for
# sem_post.
-sed \
+$SED \
-e "s/sem_wait@\*/sem_wait/" \
-e "s/sem_post@\*/sem_post/" |
# also the standard postamble (does such a word exist?)
# And also remove pthread_create_WRK lines, as ppc64 stacktraces
# do not contain them (at least on gcc110/fedora18).
-sed \
+$SED \
-e "/^Helgrind, a thread error detector/ , /./ d" \
-e "/^For lists of detected and suppressed errors, rerun with: -s$/d" \
-e "/^Use --history-level=approx or =none to gain increased speed, at$/d" \
-e "/pthread_create_WRK (hg_intercepts.c:/d" |
# Some arches return ENOSYS instead of EINVAL for undefined futex operations.
-sed -e "s/with error code 38 (ENOSYS: Function not implemented)/with error code 22 (EINVAL: Invalid argument)/" |
+$SED -e "s/with error code 38 (ENOSYS: Function not implemented)/with error code 22 (EINVAL: Invalid argument)/" |
$dir/../../helgrind/tests/filter_helgrind "$@"
--- /dev/null
+#!/usr/bin/env perl
+
+use warnings;
+use strict;
+use feature 'say';
+
+# Replace pthread_create with pthread_create@* which is expected on Linux
+s/pthread_create \(hg_intercepts.c:/pthread_create@* \(hg_intercepts.c:/g;
+
+# ditto pthread_cond_destroy
+s/pthread_cond_destroy \(hg_intercepts.c:/pthread_cond_destroy@* \(hg_intercepts.c:/g;
+
+# ditto pthread_cond_timedwait
+s/pthread_cond_timedwait \(hg_intercepts.c:/pthread_cond_timedwait@* \(hg_intercepts.c:/g;
+
+my @regex = (
+ [" by 0x\.{8}: pthread_create_WRK \(hg_intercepts.c:[0-9]{3,4}\)",
+ " by 0x.{8}: pthread_create\@\* \(hg_intercepts.c:[0-9]{3,4}\)",
+ " by 0x........: pthread_create@* \(hg_intercepts.c:...\)"
+ ]
+ );
+
+foreach my $item (@regex) {
+ my $just_saw_first_line;
+
+ while (<>) {
+
+ if ($just_saw_first_line and not /^$item->[1]/) {
+ say $item->[2];
+ }
+
+ $just_saw_first_line = /^$item->[0]/;
+ print
+ }
+}
+
+# because of optimization, there's one less line in the callstack when VG is built with clang
+# not this is a host difference, not a client one
+#s/(0x........: pthread_create_WRK \(hg_intercepts.c:433\)\n)(?! by 0x........: pthread_create@\* \(hg_intercepts.c:472\))/$1 by 0x........: pthread_create@* (hg_intercepts.c:...)\n/;
+#s/$ by 0x\.{8}: pthread_create_WRK \(hg_intercepts.c:[0-9]{3,4}\).(?! by 0x\.{8}: pthread_create@\* \(hg_intercepts.c:[0-9]{3,4}\))^/ by 0x........: pthread_create_WRK \(hg_intercepts.c:...\)\n by 0x........: pthread_create@* \(hg_intercepts.c:...\)\n/s;
+
+#s/0x\.{8}: pthread_destroy_WRK \(hg_intercepts.c:[0-9]+\).(?! by 0x[0-9A-F]+: pthread_destroy@\* \(hg_intercepts.c:[0-9]+\))/0x........: pthread_destroy_WRK \(hg_intercepts.c:...\)\n by 0x........: pthread_destroy@* \(hg_intercepts.c:...\)\n/gms;
+
+#s/0x\.{8}: pthread_cond_timedwait_WRK \(hg_intercepts.c:\.{3,4}\).(?! by 0x[0-9A-F]+: pthread_cond_timedwait@\* \(hg_intercepts.c:\.{3,4}\))/0x........: pthread_cond_timedwait_WRK \(hg_intercepts.c:...\)\n by 0x........: pthread_cond_timedwait@* \(hg_intercepts.c:...\)\n/gms;
+
+#s/0x\.{8}: mutex_lock_WRK \(hg_intercepts.c:[0-9]+\).(?! by 0x\.{8}: pthread_mutex_lock \(hg_intercepts.c:[0-9]+\))/0x........: mutex_lock_WRK \(hg_intercepts.c:...\)\n by 0x........: pthread_mutex_lock \(hg_intercepts.c:...\)\n/gms;
+
+#s/0x\.{8}: mutex_unlock_WRK \(hg_intercepts.c:.[0-9]+\).(?! by 0x\.{8}: pthread_mutex_unlock \(hg_intercepts.c:.[0-9]+\))/0x........: mutex_unlock_WRK \(hg_intercepts.c:...\)\n by 0x........: pthread_mutex_unlock \(hg_intercepts.c:...\)\n/gms;
+
+#s/0x\.{8}: pthread_cond_wait_WRK \(hg_intercepts.c:.[0-9]+\).(?! by 0x\.{8}: pthread_cond_wait \(hg_intercepts.c:.[0-9]+\))/0x........: pthread_cond_wait_WRK (hg_intercepts.c:...)\n by 0x........: pthread_cond_wait (hg_intercepts.c:...)\n/gms;
+
+#s/0x\.{8}: pthread_cond_signal_WRK \(hg_intercepts.c:[0-9]+\).(?! by 0x\.{8}: pthread_cond_signal \(hg_intercepts.c:....\))/0x........: pthread_cond_signal_WRK (hg_intercepts.c:...)\n by 0x........: pthread_cond_signal (hg_intercepts.c:...)\n/gms;
+
+#s/0x\.{8}: sem_init_WRK \(hg_intercepts.c:.[0-9]+\).(?! by 0x\.{8}: sem_init \(hg_intercepts.c:.[0-9]+\))/0x........: sem_init_WRK (hg_intercepts.c:...)\n by 0x........: sem_init (hg_intercepts.c:...)\n/gms;
+
+#s/0x\.{8}: sem_wait_WRK \(hg_intercepts.c:[0-9]+\).(?! by 0x\.{8}: sem_wait \(hg_intercepts.c:....\))/0x........: sem_wait_WRK (hg_intercepts.c:...)\n by 0x........: sem_wait (hg_intercepts.c:...)\n/gms;
+
+#s/0x\.{8}: sem_post_WRK \(hg_intercepts.c:[0-9]+\).(?! by 0x\.{8}: sem_post \(hg_intercepts.c:.[0-9]+\))/0x........: sem_post_WRK (hg_intercepts.c:...)\n by 0x........: sem_post (hg_intercepts.c:...)\n/gms;
+
+#s/0x\.{8}: sem_destroy_WRK \(hg_intercepts.c:[0-9]+\).(?! by 0x\.{8}: sem_destroy \(hg_intercepts.c:....\))/0x........: sem_destroy_WRK (hg_intercepts.c:...)\n by 0x........: sem_destroy (hg_intercepts.c:...)\n/gms;
--- /dev/null
+---Thread-Announcement------------------------------------------
+
+Thread #x was created
+ ...
+ by 0x........: pthread_create@* (hg_intercepts.c:...)
+ by 0x........: main (locked_vs_unlocked2.c:61)
+
+---Thread-Announcement------------------------------------------
+
+Thread #x was created
+ ...
+ by 0x........: pthread_create@* (hg_intercepts.c:...)
+ by 0x........: main (locked_vs_unlocked2.c:62)
+
+----------------------------------------------------------------
+
+ Lock at 0x........ was first observed
+ at 0x........: pthread_mutex_init (hg_intercepts.c:...)
+ by 0x........: main (locked_vs_unlocked2.c:58)
+ Address 0x........ is 0 bytes inside data symbol "mx2a"
+
+ Lock at 0x........ was first observed
+ at 0x........: pthread_mutex_init (hg_intercepts.c:...)
+ by 0x........: main (locked_vs_unlocked2.c:59)
+ Address 0x........ is 0 bytes inside data symbol "mx2b"
+
+ Lock at 0x........ was first observed
+ at 0x........: pthread_mutex_init (hg_intercepts.c:...)
+ by 0x........: main (locked_vs_unlocked2.c:57)
+ Address 0x........ is 0 bytes inside data symbol "mx1b"
+
+Possible data race during write of size 4 at 0x........ by thread #x
+Locks held: 2, at addresses 0x........ 0x........
+ at 0x........: child_fn2 (locked_vs_unlocked2.c:44)
+ by 0x........: mythread_wrapper (hg_intercepts.c:...)
+ ...
+
+This conflicts with a previous write of size 4 by thread #x
+Locks held: 2, at address 0x........ (and 1 that can't be shown)
+ at 0x........: child_fn1 (locked_vs_unlocked2.c:28)
+ by 0x........: mythread_wrapper (hg_intercepts.c:...)
+ ...
+ Address 0x........ is 0 bytes inside data symbol "x"
+
--- /dev/null
+---Thread-Announcement------------------------------------------
+
+Thread #x was created
+ ...
+ by 0x........: pthread_create@* (hg_intercepts.c:...)
+ by 0x........: main (locked_vs_unlocked3.c:53)
+
+---Thread-Announcement------------------------------------------
+
+Thread #x was created
+ ...
+ by 0x........: pthread_create@* (hg_intercepts.c:...)
+ by 0x........: main (locked_vs_unlocked3.c:54)
+
+----------------------------------------------------------------
+
+ Lock at 0x........ was first observed
+ at 0x........: pthread_mutex_init (hg_intercepts.c:...)
+ by 0x........: main (locked_vs_unlocked3.c:51)
+ Address 0x........ is 0 bytes inside data symbol "mx"
+
+Possible data race during write of size 4 at 0x........ by thread #x
+Locks held: none
+ at 0x........: child_fn2 (locked_vs_unlocked3.c:38)
+ by 0x........: mythread_wrapper (hg_intercepts.c:...)
+ ...
+
+This conflicts with a previous write of size 4 by thread #x
+Locks held: 1, at address 0x........
+ at 0x........: child_fn1 (locked_vs_unlocked3.c:27)
+ by 0x........: mythread_wrapper (hg_intercepts.c:...)
+ ...
+ Address 0x........ is 0 bytes inside data symbol "x"
+
--- /dev/null
+
+---Thread-Announcement------------------------------------------
+
+Thread #x is the program's root thread
+
+----------------------------------------------------------------
+
+Thread #x: pthread_cond_destroy: destruction of condition variable being waited upon
+ at 0x........: pthread_cond_destroy_WRK (hg_intercepts.c:...)
+ by 0x........: pthread_cond_destroy@* (hg_intercepts.c:...)
+ by 0x........: main (pth_cond_destroy_busy.c:52)
+
+----------------------------------------------------------------
+
+Thread #x's call to pthread_cond_destroy failed
+ with error code 16 (EBUSY: Device or resource busy)
+ at 0x........: pthread_cond_destroy_WRK (hg_intercepts.c:...)
+ by 0x........: pthread_cond_destroy@* (hg_intercepts.c:...)
+ by 0x........: main (pth_cond_destroy_busy.c:52)
+
+First pthread_cond_destroy() call returned EBUSY.
+Second pthread_cond_destroy() call returned success.
+
+ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0)
--- /dev/null
+<?xml version="1.0"?>
+
+<valgrindoutput>
+
+<protocolversion>4</protocolversion>
+<protocoltool>helgrind</protocoltool>
+
+<preamble>
+ <line>Helgrind, a thread error detector</line>
+ <line>Copyright (C) XXXX-YYYY, and GNU GPL'd, by OpenWorks LLP et al.</line>
+ <line>Using Valgrind-X.Y.X and LibVEX; rerun with -h for copyright info</line>
+ <line>Command: ./tc06_two_races</line>
+</preamble>
+
+<pid>...</pid>
+<ppid>...</ppid>
+<tool>helgrind</tool>
+
+<args>
+ <vargv>
+ <exe>...</exe>
+ <arg>--command-line-only=yes</arg>
+ <arg>--memcheck:leak-check=no</arg>
+ <arg>--tool=helgrind</arg>
+ <arg>--read-var-info=yes</arg>
+ <arg>--xml=yes</arg>
+ <arg>--xml-fd=2</arg>
+ <arg>--log-file=/dev/null</arg>
+ </vargv>
+ <argv>
+ <exe>...</exe>
+ </argv>
+</args>
+
+<status>
+ <state>RUNNING</state>
+ <time>...</time>
+</status>
+
+<announcethread>
+ <hthreadid>1</hthreadid>
+ <isrootthread></isrootthread>
+</announcethread>
+
+<announcethread>
+ <hthreadid>2</hthreadid>
+ <stack>
+ <frame>...</frame>
+ <frame>
+ <ip>0x........</ip>
+ <obj>...</obj>
+ <fn>main</fn>
+ <dir>...</dir>
+ <file>tc06_two_races.c</file>
+ <line>26</line>
+ </frame>
+ </stack>
+</announcethread>
+
+<error>
+ <unique>...</unique>
+ <tid>...</tid>
+ <kind>Race</kind>
+ <xwhat>
+ <text>Possible data race during read of size 4 at 0x........ by thread #x</text>
+ <hthreadid>1</hthreadid>
+ </xwhat>
+ <stack>
+ <frame>
+ <ip>0x........</ip>
+ <obj>...</obj>
+ <fn>main</fn>
+ <dir>...</dir>
+ <file>tc06_two_races.c</file>
+ <line>31</line>
+ </frame>
+ </stack>
+ <xauxwhat>
+ <text>This conflicts with a previous write of size 4 by thread #x</text>
+ <hthreadid>2</hthreadid>
+ </xauxwhat>
+ <stack>
+ <frame>
+ <ip>0x........</ip>
+ <obj>...</obj>
+ <fn>child_fn</fn>
+ <dir>...</dir>
+ <file>tc06_two_races.c</file>
+ <line>14</line>
+ </frame>
+ <frame>
+ <ip>0x........</ip>
+ <obj>...</obj>
+ <fn>mythread_wrapper</fn>
+ <dir>...</dir>
+ <file>hg_intercepts.c</file>
+ <line>...</line>
+ </frame>
+ <frame>...</frame>
+ </stack>
+ <auxwhat>Location 0x........ is 0 bytes inside global var "unprot1"</auxwhat>
+ <xauxwhat><text>declared at tc06_two_races.c:9</text> <file>tc06_two_races.c</file> <line>9</line> </xauxwhat>
+</error>
+
+<error>
+ <unique>...</unique>
+ <tid>...</tid>
+ <kind>Race</kind>
+ <xwhat>
+ <text>Possible data race during write of size 4 at 0x........ by thread #x</text>
+ <hthreadid>1</hthreadid>
+ </xwhat>
+ <stack>
+ <frame>
+ <ip>0x........</ip>
+ <obj>...</obj>
+ <fn>main</fn>
+ <dir>...</dir>
+ <file>tc06_two_races.c</file>
+ <line>31</line>
+ </frame>
+ </stack>
+ <xauxwhat>
+ <text>This conflicts with a previous write of size 4 by thread #x</text>
+ <hthreadid>2</hthreadid>
+ </xauxwhat>
+ <stack>
+ <frame>
+ <ip>0x........</ip>
+ <obj>...</obj>
+ <fn>child_fn</fn>
+ <dir>...</dir>
+ <file>tc06_two_races.c</file>
+ <line>14</line>
+ </frame>
+ <frame>
+ <ip>0x........</ip>
+ <obj>...</obj>
+ <fn>mythread_wrapper</fn>
+ <dir>...</dir>
+ <file>hg_intercepts.c</file>
+ <line>...</line>
+ </frame>
+ <frame>...</frame>
+ </stack>
+ <auxwhat>Location 0x........ is 0 bytes inside global var "unprot1"</auxwhat>
+ <xauxwhat><text>declared at tc06_two_races.c:9</text> <file>tc06_two_races.c</file> <line>9</line> </xauxwhat>
+</error>
+
+<error>
+ <unique>...</unique>
+ <tid>...</tid>
+ <kind>Race</kind>
+ <xwhat>
+ <text>Possible data race during read of size 4 at 0x........ by thread #x</text>
+ <hthreadid>1</hthreadid>
+ </xwhat>
+ <stack>
+ <frame>
+ <ip>0x........</ip>
+ <obj>...</obj>
+ <fn>main</fn>
+ <dir>...</dir>
+ <file>tc06_two_races.c</file>
+ <line>35</line>
+ </frame>
+ </stack>
+ <xauxwhat>
+ <text>This conflicts with a previous write of size 4 by thread #x</text>
+ <hthreadid>2</hthreadid>
+ </xauxwhat>
+ <stack>
+ <frame>
+ <ip>0x........</ip>
+ <obj>...</obj>
+ <fn>child_fn</fn>
+ <dir>...</dir>
+ <file>tc06_two_races.c</file>
+ <line>18</line>
+ </frame>
+ <frame>
+ <ip>0x........</ip>
+ <obj>...</obj>
+ <fn>mythread_wrapper</fn>
+ <dir>...</dir>
+ <file>hg_intercepts.c</file>
+ <line>...</line>
+ </frame>
+ <frame>...</frame>
+ </stack>
+ <auxwhat>Location 0x........ is 0 bytes inside global var "unprot2"</auxwhat>
+ <xauxwhat><text>declared at tc06_two_races.c:9</text> <file>tc06_two_races.c</file> <line>9</line> </xauxwhat>
+</error>
+
+<error>
+ <unique>...</unique>
+ <tid>...</tid>
+ <kind>Race</kind>
+ <xwhat>
+ <text>Possible data race during write of size 4 at 0x........ by thread #x</text>
+ <hthreadid>1</hthreadid>
+ </xwhat>
+ <stack>
+ <frame>
+ <ip>0x........</ip>
+ <obj>...</obj>
+ <fn>main</fn>
+ <dir>...</dir>
+ <file>tc06_two_races.c</file>
+ <line>35</line>
+ </frame>
+ </stack>
+ <xauxwhat>
+ <text>This conflicts with a previous write of size 4 by thread #x</text>
+ <hthreadid>2</hthreadid>
+ </xauxwhat>
+ <stack>
+ <frame>
+ <ip>0x........</ip>
+ <obj>...</obj>
+ <fn>child_fn</fn>
+ <dir>...</dir>
+ <file>tc06_two_races.c</file>
+ <line>18</line>
+ </frame>
+ <frame>
+ <ip>0x........</ip>
+ <obj>...</obj>
+ <fn>mythread_wrapper</fn>
+ <dir>...</dir>
+ <file>hg_intercepts.c</file>
+ <line>...</line>
+ </frame>
+ <frame>...</frame>
+ </stack>
+ <auxwhat>Location 0x........ is 0 bytes inside global var "unprot2"</auxwhat>
+ <xauxwhat><text>declared at tc06_two_races.c:9</text> <file>tc06_two_races.c</file> <line>9</line> </xauxwhat>
+</error>
+
+
+<status>
+ <state>FINISHED</state>
+ <time>...</time>
+</status>
+
+<errorcounts>...</errorcounts>
+
+<suppcounts>...</suppcounts>
+
+</valgrindoutput>
+
#undef PLAT_x86_darwin
#undef PLAT_amd64_darwin
+#undef PLAT_x86_freebsd
+#undef PLAT_amd64_freebsd
#undef PLAT_x86_linux
#undef PLAT_amd64_linux
#undef PLAT_ppc32_linux
# define PLAT_x86_darwin 1
#elif defined(__APPLE__) && defined(__x86_64__)
# define PLAT_amd64_darwin 1
+#elif defined(__FreeBSD__) && defined(__i386__)
+# define PLAT_x86_freebsd 1
+#elif defined(__FreeBSD__) && defined(__amd64__)
+# define PLAT_amd64_freebsd 1
#elif defined(__linux__) && defined(__i386__)
# define PLAT_x86_linux 1
#elif defined(__linux__) && defined(__x86_64__)
#if defined(PLAT_amd64_linux) || defined(PLAT_x86_linux) \
|| defined(PLAT_amd64_darwin) || defined(PLAT_x86_darwin) \
- || defined(PLAT_amd64_solaris) || defined(PLAT_x86_solaris)
+ || defined(PLAT_amd64_solaris) || defined(PLAT_x86_solaris) \
+ || defined(PLAT_amd64_freebsd) || defined(PLAT_x86_freebsd)
# define INC(_lval,_lqual) \
__asm__ __volatile__ ( \
"lock ; incl (%0)" : /*out*/ : /*in*/"r"(&(_lval)) : "memory", "cc" )
#undef PLAT_x86_darwin
#undef PLAT_amd64_darwin
+#undef PLAT_x86_freebsd
+#undef PLAT_amd64_freebsd
#undef PLAT_x86_linux
#undef PLAT_amd64_linux
#undef PLAT_ppc32_linux
# define PLAT_x86_darwin 1
#elif defined(__APPLE__) && defined(__x86_64__)
# define PLAT_amd64_darwin 1
+#elif defined(__FreeBSD__) && defined(__i386__)
+# define PLAT_x86_freebsd 1
+#elif defined(__FreeBSD__) && defined(__amd64__)
+# define PLAT_amd64_freebsd 1
#elif defined(__linux__) && defined(__i386__)
# define PLAT_x86_linux 1
#elif defined(__linux__) && defined(__x86_64__)
#if defined(PLAT_amd64_linux) || defined(PLAT_x86_linux) \
|| defined(PLAT_amd64_darwin) || defined(PLAT_x86_darwin) \
- || defined(PLAT_amd64_solaris) || defined(PLAT_x86_solaris)
+ || defined(PLAT_amd64_solaris) || defined(PLAT_x86_solaris) \
+ || defined(PLAT_amd64_freebsd) || defined(PLAT_x86_freebsd)
# define INC(_lval,_lqual) \
__asm__ __volatile__ ( \
"lock ; incl (%0)" : /*out*/ : /*in*/"r"(&(_lval)) : "memory", "cc" )
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
+#include "config.h"
void* child_fn ( void* arg )
{
is reported in child_fn. */
pthread_join(child, NULL );
+#if !defined(VGO_freebsd)
/* Unlocking a totally bogus lock. */
pthread_mutex_unlock( (pthread_mutex_t*) &bogus[50] ); /* ERROR */
+#endif
/* Now we get a freeing-locked-lock error, since the stack
frame is removed whilst mx2 is still locked. */
Thread #x unlocked a not-locked lock at 0x........
at 0x........: mutex_unlock_WRK (hg_intercepts.c:...)
by 0x........: pthread_mutex_unlock (hg_intercepts.c:...)
- by 0x........: nearly_main (tc09_bad_unlock.c:27)
- by 0x........: main (tc09_bad_unlock.c:49)
+ by 0x........: nearly_main (tc09_bad_unlock.c:28)
+ by 0x........: main (tc09_bad_unlock.c:52)
Lock at 0x........ was first observed
at 0x........: pthread_mutex_init (hg_intercepts.c:...)
- by 0x........: nearly_main (tc09_bad_unlock.c:23)
- by 0x........: main (tc09_bad_unlock.c:49)
+ by 0x........: nearly_main (tc09_bad_unlock.c:24)
+ by 0x........: main (tc09_bad_unlock.c:52)
Address 0x........ is on thread #x's stack
- in frame #x, created by nearly_main (tc09_bad_unlock.c:16)
+ in frame #x, created by nearly_main (tc09_bad_unlock.c:17)
---Thread-Announcement------------------------------------------
Thread #x was created
...
by 0x........: pthread_create@* (hg_intercepts.c:...)
- by 0x........: nearly_main (tc09_bad_unlock.c:35)
- by 0x........: main (tc09_bad_unlock.c:49)
+ by 0x........: nearly_main (tc09_bad_unlock.c:36)
+ by 0x........: main (tc09_bad_unlock.c:52)
----------------------------------------------------------------
Thread #x unlocked lock at 0x........ currently held by thread #x
at 0x........: mutex_unlock_WRK (hg_intercepts.c:...)
by 0x........: pthread_mutex_unlock (hg_intercepts.c:...)
- by 0x........: child_fn (tc09_bad_unlock.c:11)
+ by 0x........: child_fn (tc09_bad_unlock.c:12)
by 0x........: mythread_wrapper (hg_intercepts.c:...)
...
Lock at 0x........ was first observed
at 0x........: pthread_mutex_init (hg_intercepts.c:...)
- by 0x........: nearly_main (tc09_bad_unlock.c:31)
- by 0x........: main (tc09_bad_unlock.c:49)
+ by 0x........: nearly_main (tc09_bad_unlock.c:32)
+ by 0x........: main (tc09_bad_unlock.c:52)
Address 0x........ is on thread #x's stack
- in frame #x, created by nearly_main (tc09_bad_unlock.c:16)
+ in frame #x, created by nearly_main (tc09_bad_unlock.c:17)
----------------------------------------------------------------
Thread #x unlocked an invalid lock at 0x........
at 0x........: mutex_unlock_WRK (hg_intercepts.c:...)
by 0x........: pthread_mutex_unlock (hg_intercepts.c:...)
- by 0x........: nearly_main (tc09_bad_unlock.c:41)
- by 0x........: main (tc09_bad_unlock.c:49)
+ by 0x........: nearly_main (tc09_bad_unlock.c:43)
+ by 0x........: main (tc09_bad_unlock.c:52)
----------------------------------------------------------------
with error code 22 (EINVAL: Invalid argument)
at 0x........: mutex_unlock_WRK (hg_intercepts.c:...)
by 0x........: pthread_mutex_unlock (hg_intercepts.c:...)
- by 0x........: nearly_main (tc09_bad_unlock.c:41)
- by 0x........: main (tc09_bad_unlock.c:49)
+ by 0x........: nearly_main (tc09_bad_unlock.c:43)
+ by 0x........: main (tc09_bad_unlock.c:52)
---------------------
----------------------------------------------------------------
Thread #x unlocked a not-locked lock at 0x........
at 0x........: mutex_unlock_WRK (hg_intercepts.c:...)
by 0x........: pthread_mutex_unlock (hg_intercepts.c:...)
- by 0x........: nearly_main (tc09_bad_unlock.c:27)
- by 0x........: main (tc09_bad_unlock.c:50)
+ by 0x........: nearly_main (tc09_bad_unlock.c:28)
+ by 0x........: main (tc09_bad_unlock.c:53)
Lock at 0x........ was first observed
at 0x........: pthread_mutex_init (hg_intercepts.c:...)
- by 0x........: nearly_main (tc09_bad_unlock.c:23)
- by 0x........: main (tc09_bad_unlock.c:49)
+ by 0x........: nearly_main (tc09_bad_unlock.c:24)
+ by 0x........: main (tc09_bad_unlock.c:52)
Address 0x........ is on thread #x's stack
- in frame #x, created by nearly_main (tc09_bad_unlock.c:16)
+ in frame #x, created by nearly_main (tc09_bad_unlock.c:17)
----------------------------------------------------------------
Thread #x: Attempt to re-lock a non-recursive lock I already hold
at 0x........: mutex_lock_WRK (hg_intercepts.c:...)
by 0x........: pthread_mutex_lock (hg_intercepts.c:...)
- by 0x........: nearly_main (tc09_bad_unlock.c:32)
- by 0x........: main (tc09_bad_unlock.c:50)
+ by 0x........: nearly_main (tc09_bad_unlock.c:33)
+ by 0x........: main (tc09_bad_unlock.c:53)
Lock was previously acquired
at 0x........: mutex_lock_WRK (hg_intercepts.c:...)
by 0x........: pthread_mutex_lock (hg_intercepts.c:...)
- by 0x........: nearly_main (tc09_bad_unlock.c:32)
- by 0x........: main (tc09_bad_unlock.c:49)
+ by 0x........: nearly_main (tc09_bad_unlock.c:33)
+ by 0x........: main (tc09_bad_unlock.c:52)
----------------------------------------------------------------
Thread #x: Bug in libpthread: recursive write lock granted on mutex/wrlock which does not support recursion
at 0x........: mutex_lock_WRK (hg_intercepts.c:...)
by 0x........: pthread_mutex_lock (hg_intercepts.c:...)
- by 0x........: nearly_main (tc09_bad_unlock.c:32)
- by 0x........: main (tc09_bad_unlock.c:50)
+ by 0x........: nearly_main (tc09_bad_unlock.c:33)
+ by 0x........: main (tc09_bad_unlock.c:53)
---Thread-Announcement------------------------------------------
Thread #x was created
...
by 0x........: pthread_create@* (hg_intercepts.c:...)
- by 0x........: nearly_main (tc09_bad_unlock.c:35)
- by 0x........: main (tc09_bad_unlock.c:50)
+ by 0x........: nearly_main (tc09_bad_unlock.c:36)
+ by 0x........: main (tc09_bad_unlock.c:53)
----------------------------------------------------------------
Thread #x unlocked lock at 0x........ currently held by thread #x
at 0x........: mutex_unlock_WRK (hg_intercepts.c:...)
by 0x........: pthread_mutex_unlock (hg_intercepts.c:...)
- by 0x........: child_fn (tc09_bad_unlock.c:11)
+ by 0x........: child_fn (tc09_bad_unlock.c:12)
by 0x........: mythread_wrapper (hg_intercepts.c:...)
...
Lock at 0x........ was first observed
at 0x........: pthread_mutex_init (hg_intercepts.c:...)
- by 0x........: nearly_main (tc09_bad_unlock.c:31)
- by 0x........: main (tc09_bad_unlock.c:49)
+ by 0x........: nearly_main (tc09_bad_unlock.c:32)
+ by 0x........: main (tc09_bad_unlock.c:52)
Address 0x........ is on thread #x's stack
- in frame #x, created by nearly_main (tc09_bad_unlock.c:16)
+ in frame #x, created by nearly_main (tc09_bad_unlock.c:17)
----------------------------------------------------------------
Thread #x unlocked an invalid lock at 0x........
at 0x........: mutex_unlock_WRK (hg_intercepts.c:...)
by 0x........: pthread_mutex_unlock (hg_intercepts.c:...)
- by 0x........: nearly_main (tc09_bad_unlock.c:41)
- by 0x........: main (tc09_bad_unlock.c:50)
+ by 0x........: nearly_main (tc09_bad_unlock.c:43)
+ by 0x........: main (tc09_bad_unlock.c:53)
----------------------------------------------------------------
with error code 22 (EINVAL: Invalid argument)
at 0x........: mutex_unlock_WRK (hg_intercepts.c:...)
by 0x........: pthread_mutex_unlock (hg_intercepts.c:...)
- by 0x........: nearly_main (tc09_bad_unlock.c:41)
- by 0x........: main (tc09_bad_unlock.c:50)
+ by 0x........: nearly_main (tc09_bad_unlock.c:43)
+ by 0x........: main (tc09_bad_unlock.c:53)
----------------------------------------------------------------
--- /dev/null
+
+---Thread-Announcement------------------------------------------
+
+Thread #x is the program's root thread
+
+----------------------------------------------------------------
+
+Thread #x unlocked a not-locked lock at 0x........
+ at 0x........: mutex_unlock_WRK (hg_intercepts.c:...)
+ by 0x........: pthread_mutex_unlock (hg_intercepts.c:...)
+ by 0x........: nearly_main (tc09_bad_unlock.c:28)
+ by 0x........: main (tc09_bad_unlock.c:52)
+ Lock at 0x........ was first observed
+ at 0x........: pthread_mutex_init (hg_intercepts.c:...)
+ by 0x........: nearly_main (tc09_bad_unlock.c:24)
+ by 0x........: main (tc09_bad_unlock.c:52)
+ Address 0x........ is on thread #x's stack
+ in frame #x, created by nearly_main (tc09_bad_unlock.c:17)
+
+
+----------------------------------------------------------------
+
+Thread #x's call to pthread_mutex_unlock failed
+ with error code 1 (EPERM: Operation not permitted)
+ at 0x........: mutex_unlock_WRK (hg_intercepts.c:...)
+ by 0x........: pthread_mutex_unlock (hg_intercepts.c:...)
+ by 0x........: nearly_main (tc09_bad_unlock.c:28)
+ by 0x........: main (tc09_bad_unlock.c:52)
+
+---Thread-Announcement------------------------------------------
+
+Thread #x was created
+ ...
+ by 0x........: pthread_create@* (hg_intercepts.c:...)
+ by 0x........: nearly_main (tc09_bad_unlock.c:36)
+ by 0x........: main (tc09_bad_unlock.c:52)
+
+----------------------------------------------------------------
+
+Thread #x unlocked lock at 0x........ currently held by thread #x
+ at 0x........: mutex_unlock_WRK (hg_intercepts.c:...)
+ by 0x........: pthread_mutex_unlock (hg_intercepts.c:...)
+ by 0x........: child_fn (tc09_bad_unlock.c:12)
+ by 0x........: mythread_wrapper (hg_intercepts.c:...)
+ ...
+ Lock at 0x........ was first observed
+ at 0x........: pthread_mutex_init (hg_intercepts.c:...)
+ by 0x........: nearly_main (tc09_bad_unlock.c:32)
+ by 0x........: main (tc09_bad_unlock.c:52)
+ Address 0x........ is on thread #x's stack
+ in frame #x, created by nearly_main (tc09_bad_unlock.c:17)
+
+
+----------------------------------------------------------------
+
+Thread #x's call to pthread_mutex_unlock failed
+ with error code 1 (EPERM: Operation not permitted)
+ at 0x........: mutex_unlock_WRK (hg_intercepts.c:...)
+ by 0x........: pthread_mutex_unlock (hg_intercepts.c:...)
+ by 0x........: child_fn (tc09_bad_unlock.c:12)
+ by 0x........: mythread_wrapper (hg_intercepts.c:...)
+ ...
+
+---------------------
+----------------------------------------------------------------
+
+Thread #x unlocked a not-locked lock at 0x........
+ at 0x........: mutex_unlock_WRK (hg_intercepts.c:...)
+ by 0x........: pthread_mutex_unlock (hg_intercepts.c:...)
+ by 0x........: nearly_main (tc09_bad_unlock.c:28)
+ by 0x........: main (tc09_bad_unlock.c:53)
+ Lock at 0x........ was first observed
+ at 0x........: pthread_mutex_init (hg_intercepts.c:...)
+ by 0x........: nearly_main (tc09_bad_unlock.c:24)
+ by 0x........: main (tc09_bad_unlock.c:52)
+ Address 0x........ is on thread #x's stack
+ in frame #x, created by nearly_main (tc09_bad_unlock.c:17)
+
+
+----------------------------------------------------------------
+
+Thread #x's call to pthread_mutex_unlock failed
+ with error code 1 (EPERM: Operation not permitted)
+ at 0x........: mutex_unlock_WRK (hg_intercepts.c:...)
+ by 0x........: pthread_mutex_unlock (hg_intercepts.c:...)
+ by 0x........: nearly_main (tc09_bad_unlock.c:28)
+ by 0x........: main (tc09_bad_unlock.c:53)
+
+----------------------------------------------------------------
+
+Thread #x: Attempt to re-lock a non-recursive lock I already hold
+ at 0x........: mutex_lock_WRK (hg_intercepts.c:...)
+ by 0x........: pthread_mutex_lock (hg_intercepts.c:...)
+ by 0x........: nearly_main (tc09_bad_unlock.c:33)
+ by 0x........: main (tc09_bad_unlock.c:53)
+ Lock was previously acquired
+ at 0x........: mutex_lock_WRK (hg_intercepts.c:...)
+ by 0x........: pthread_mutex_lock (hg_intercepts.c:...)
+ by 0x........: nearly_main (tc09_bad_unlock.c:33)
+ by 0x........: main (tc09_bad_unlock.c:52)
+
+----------------------------------------------------------------
+
+Thread #x: Bug in libpthread: recursive write lock granted on mutex/wrlock which does not support recursion
+ at 0x........: mutex_lock_WRK (hg_intercepts.c:...)
+ by 0x........: pthread_mutex_lock (hg_intercepts.c:...)
+ by 0x........: nearly_main (tc09_bad_unlock.c:33)
+ by 0x........: main (tc09_bad_unlock.c:53)
+
+---Thread-Announcement------------------------------------------
+
+Thread #x was created
+ ...
+ by 0x........: pthread_create@* (hg_intercepts.c:...)
+ by 0x........: nearly_main (tc09_bad_unlock.c:36)
+ by 0x........: main (tc09_bad_unlock.c:53)
+
+----------------------------------------------------------------
+
+Thread #x unlocked lock at 0x........ currently held by thread #x
+ at 0x........: mutex_unlock_WRK (hg_intercepts.c:...)
+ by 0x........: pthread_mutex_unlock (hg_intercepts.c:...)
+ by 0x........: child_fn (tc09_bad_unlock.c:12)
+ by 0x........: mythread_wrapper (hg_intercepts.c:...)
+ ...
+ Lock at 0x........ was first observed
+ at 0x........: pthread_mutex_init (hg_intercepts.c:...)
+ by 0x........: nearly_main (tc09_bad_unlock.c:32)
+ by 0x........: main (tc09_bad_unlock.c:52)
+ Address 0x........ is on thread #x's stack
+ in frame #x, created by nearly_main (tc09_bad_unlock.c:17)
+
+
+----------------------------------------------------------------
+
+Thread #x's call to pthread_mutex_unlock failed
+ with error code 1 (EPERM: Operation not permitted)
+ at 0x........: mutex_unlock_WRK (hg_intercepts.c:...)
+ by 0x........: pthread_mutex_unlock (hg_intercepts.c:...)
+ by 0x........: child_fn (tc09_bad_unlock.c:12)
+ by 0x........: mythread_wrapper (hg_intercepts.c:...)
+ ...
+
+----------------------------------------------------------------
+
+Thread #x: Exiting thread still holds 1 lock
+ ...
+
+
+ERROR SUMMARY: 11 errors from 11 contexts (suppressed: 0 from 0)
Thread #x unlocked a not-locked lock at 0x........
at 0x........: mutex_unlock_WRK (hg_intercepts.c:...)
by 0x........: pthread_mutex_unlock (hg_intercepts.c:...)
- by 0x........: nearly_main (tc09_bad_unlock.c:27)
- by 0x........: main (tc09_bad_unlock.c:49)
+ by 0x........: nearly_main (tc09_bad_unlock.c:28)
+ by 0x........: main (tc09_bad_unlock.c:52)
Lock at 0x........ was first observed
at 0x........: pthread_mutex_init (hg_intercepts.c:...)
- by 0x........: nearly_main (tc09_bad_unlock.c:23)
- by 0x........: main (tc09_bad_unlock.c:49)
+ by 0x........: nearly_main (tc09_bad_unlock.c:24)
+ by 0x........: main (tc09_bad_unlock.c:52)
Address 0x........ is on thread #x's stack
- in frame #x, created by nearly_main (tc09_bad_unlock.c:16)
+ in frame #x, created by nearly_main (tc09_bad_unlock.c:17)
---Thread-Announcement------------------------------------------
Thread #x was created
...
by 0x........: pthread_create@* (hg_intercepts.c:...)
- by 0x........: nearly_main (tc09_bad_unlock.c:35)
- by 0x........: main (tc09_bad_unlock.c:49)
+ by 0x........: nearly_main (tc09_bad_unlock.c:36)
+ by 0x........: main (tc09_bad_unlock.c:52)
----------------------------------------------------------------
Thread #x unlocked lock at 0x........ currently held by thread #x
at 0x........: mutex_unlock_WRK (hg_intercepts.c:...)
by 0x........: pthread_mutex_unlock (hg_intercepts.c:...)
- by 0x........: child_fn (tc09_bad_unlock.c:11)
+ by 0x........: child_fn (tc09_bad_unlock.c:12)
by 0x........: mythread_wrapper (hg_intercepts.c:...)
...
Lock at 0x........ was first observed
at 0x........: pthread_mutex_init (hg_intercepts.c:...)
- by 0x........: nearly_main (tc09_bad_unlock.c:31)
- by 0x........: main (tc09_bad_unlock.c:49)
+ by 0x........: nearly_main (tc09_bad_unlock.c:32)
+ by 0x........: main (tc09_bad_unlock.c:52)
Address 0x........ is on thread #x's stack
- in frame #x, created by nearly_main (tc09_bad_unlock.c:16)
+ in frame #x, created by nearly_main (tc09_bad_unlock.c:17)
----------------------------------------------------------------
Thread #x unlocked an invalid lock at 0x........
at 0x........: mutex_unlock_WRK (hg_intercepts.c:...)
by 0x........: pthread_mutex_unlock (hg_intercepts.c:...)
- by 0x........: nearly_main (tc09_bad_unlock.c:41)
- by 0x........: main (tc09_bad_unlock.c:49)
+ by 0x........: nearly_main (tc09_bad_unlock.c:43)
+ by 0x........: main (tc09_bad_unlock.c:52)
----------------------------------------------------------------
with error code 1 (EPERM: Operation not permitted)
at 0x........: mutex_unlock_WRK (hg_intercepts.c:...)
by 0x........: pthread_mutex_unlock (hg_intercepts.c:...)
- by 0x........: nearly_main (tc09_bad_unlock.c:41)
- by 0x........: main (tc09_bad_unlock.c:49)
+ by 0x........: nearly_main (tc09_bad_unlock.c:43)
+ by 0x........: main (tc09_bad_unlock.c:52)
---------------------
----------------------------------------------------------------
Thread #x unlocked a not-locked lock at 0x........
at 0x........: mutex_unlock_WRK (hg_intercepts.c:...)
by 0x........: pthread_mutex_unlock (hg_intercepts.c:...)
- by 0x........: nearly_main (tc09_bad_unlock.c:27)
- by 0x........: main (tc09_bad_unlock.c:50)
+ by 0x........: nearly_main (tc09_bad_unlock.c:28)
+ by 0x........: main (tc09_bad_unlock.c:53)
Lock at 0x........ was first observed
at 0x........: pthread_mutex_init (hg_intercepts.c:...)
- by 0x........: nearly_main (tc09_bad_unlock.c:23)
- by 0x........: main (tc09_bad_unlock.c:49)
+ by 0x........: nearly_main (tc09_bad_unlock.c:24)
+ by 0x........: main (tc09_bad_unlock.c:52)
Address 0x........ is on thread #x's stack
- in frame #x, created by nearly_main (tc09_bad_unlock.c:16)
+ in frame #x, created by nearly_main (tc09_bad_unlock.c:17)
----------------------------------------------------------------
Thread #x: Attempt to re-lock a non-recursive lock I already hold
at 0x........: mutex_lock_WRK (hg_intercepts.c:...)
by 0x........: pthread_mutex_lock (hg_intercepts.c:...)
- by 0x........: nearly_main (tc09_bad_unlock.c:32)
- by 0x........: main (tc09_bad_unlock.c:50)
+ by 0x........: nearly_main (tc09_bad_unlock.c:33)
+ by 0x........: main (tc09_bad_unlock.c:53)
Lock was previously acquired
at 0x........: mutex_lock_WRK (hg_intercepts.c:...)
by 0x........: pthread_mutex_lock (hg_intercepts.c:...)
- by 0x........: nearly_main (tc09_bad_unlock.c:32)
- by 0x........: main (tc09_bad_unlock.c:49)
+ by 0x........: nearly_main (tc09_bad_unlock.c:33)
+ by 0x........: main (tc09_bad_unlock.c:52)
----------------------------------------------------------------
Thread #x: Bug in libpthread: recursive write lock granted on mutex/wrlock which does not support recursion
at 0x........: mutex_lock_WRK (hg_intercepts.c:...)
by 0x........: pthread_mutex_lock (hg_intercepts.c:...)
- by 0x........: nearly_main (tc09_bad_unlock.c:32)
- by 0x........: main (tc09_bad_unlock.c:50)
+ by 0x........: nearly_main (tc09_bad_unlock.c:33)
+ by 0x........: main (tc09_bad_unlock.c:53)
---Thread-Announcement------------------------------------------
Thread #x was created
...
by 0x........: pthread_create@* (hg_intercepts.c:...)
- by 0x........: nearly_main (tc09_bad_unlock.c:35)
- by 0x........: main (tc09_bad_unlock.c:50)
+ by 0x........: nearly_main (tc09_bad_unlock.c:36)
+ by 0x........: main (tc09_bad_unlock.c:53)
----------------------------------------------------------------
Thread #x unlocked lock at 0x........ currently held by thread #x
at 0x........: mutex_unlock_WRK (hg_intercepts.c:...)
by 0x........: pthread_mutex_unlock (hg_intercepts.c:...)
- by 0x........: child_fn (tc09_bad_unlock.c:11)
+ by 0x........: child_fn (tc09_bad_unlock.c:12)
by 0x........: mythread_wrapper (hg_intercepts.c:...)
...
Lock at 0x........ was first observed
at 0x........: pthread_mutex_init (hg_intercepts.c:...)
- by 0x........: nearly_main (tc09_bad_unlock.c:31)
- by 0x........: main (tc09_bad_unlock.c:49)
+ by 0x........: nearly_main (tc09_bad_unlock.c:32)
+ by 0x........: main (tc09_bad_unlock.c:52)
Address 0x........ is on thread #x's stack
- in frame #x, created by nearly_main (tc09_bad_unlock.c:16)
+ in frame #x, created by nearly_main (tc09_bad_unlock.c:17)
----------------------------------------------------------------
Thread #x unlocked an invalid lock at 0x........
at 0x........: mutex_unlock_WRK (hg_intercepts.c:...)
by 0x........: pthread_mutex_unlock (hg_intercepts.c:...)
- by 0x........: nearly_main (tc09_bad_unlock.c:41)
- by 0x........: main (tc09_bad_unlock.c:50)
+ by 0x........: nearly_main (tc09_bad_unlock.c:43)
+ by 0x........: main (tc09_bad_unlock.c:53)
----------------------------------------------------------------
with error code 1 (EPERM: Operation not permitted)
at 0x........: mutex_unlock_WRK (hg_intercepts.c:...)
by 0x........: pthread_mutex_unlock (hg_intercepts.c:...)
- by 0x........: nearly_main (tc09_bad_unlock.c:41)
- by 0x........: main (tc09_bad_unlock.c:50)
+ by 0x........: nearly_main (tc09_bad_unlock.c:43)
+ by 0x........: main (tc09_bad_unlock.c:53)
----------------------------------------------------------------
#undef PLAT_x86_darwin
#undef PLAT_amd64_darwin
+#undef PLAT_x86_freebsd
+#undef PLAT_amd64_freebsd
#undef PLAT_x86_linux
#undef PLAT_amd64_linux
#undef PLAT_ppc32_linux
# define PLAT_x86_darwin 1
#elif defined(__APPLE__) && defined(__x86_64__)
# define PLAT_amd64_darwin 1
+#elif defined(__FreeBSD__) && defined(__i386__)
+# define PLAT_x86_freebsd 1
+#elif defined(__FreeBSD__) && defined(__amd64__)
+# define PLAT_amd64_freebsd 1
#elif defined(__linux__) && defined(__i386__)
# define PLAT_x86_linux 1
#elif defined(__linux__) && defined(__x86_64__)
#if defined(PLAT_amd64_linux) || defined(PLAT_x86_linux) \
|| defined(PLAT_amd64_darwin) || defined(PLAT_x86_darwin) \
- || defined(PLAT_amd64_solaris) || defined(PLAT_x86_solaris)
+ || defined(PLAT_amd64_solaris) || defined(PLAT_x86_solaris) \
+ || defined(PLAT_amd64_freebsd) || defined(PLAT_x86_freebsd)
# define XCHG_M_R(_addr,_lval) \
__asm__ __volatile__( \
"xchgl %0, %1" \
/* this should fail - lock is unowned now */
r = pthread_rwlock_unlock( &rwl );
-#if defined(VGO_darwin) || defined(VGO_solaris)
+#if defined(VGO_darwin) || defined(VGO_solaris) || defined(VGO_freebsd)
assert(r != 0);
#else
assert(r == 0);
--- /dev/null
+
+---Thread-Announcement------------------------------------------
+
+Thread #x is the program's root thread
+
+----------------------------------------------------------------
+
+Thread #x unlocked a not-locked lock at 0x........
+ at 0x........: pthread_rwlock_unlock_WRK (hg_intercepts.c:...)
+ by 0x........: pthread_rwlock_unlock (hg_intercepts.c:...)
+ ...
+ by 0x........: main (tc12_rwl_trivial.c:29)
+ Lock at 0x........ was first observed
+ at 0x........: pthread_rwlock_init_WRK (hg_intercepts.c:...)
+ by 0x........: pthread_rwlock_init (hg_intercepts.c:...)
+ by 0x........: main (tc12_rwl_trivial.c:18)
+ Address 0x........ is on thread #x's stack
+ in frame #x, created by main (tc12_rwl_trivial.c:14)
+
+
+----------------------------------------------------------------
+
+Thread #x's call to pthread_rwlock_unlock failed
+ with error code 1 (EPERM: Operation not permitted)
+ at 0x........: pthread_rwlock_unlock_WRK (hg_intercepts.c:...)
+ by 0x........: pthread_rwlock_unlock (hg_intercepts.c:...)
+ ...
+ by 0x........: main (tc12_rwl_trivial.c:29)
+
+
+ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0)
#include <pthread.h>
#include <semaphore.h>
#include <unistd.h>
+#if defined(VGO_freebsd)
+# include <sys/fcntl.h>
+#endif
/* This is really a test of semaphore handling
(sem_{init,destroy,post,wait}). Using semaphores a barrier
function is created. Helgrind-3.3 (p.k.a Thrcheck) does understand
{
sem_t* s;
-#if defined(VGO_linux) || defined(VGO_solaris)
+#if defined(VGO_linux) || defined(VGO_solaris) || defined(VGO_freebsd)
s = malloc(sizeof(*s));
if (s) {
if (sem_init(s, pshared, count) < 0) {
--- /dev/null
+
+---Thread-Announcement------------------------------------------
+
+Thread #x is the program's root thread
+
+----------------------------------------------------------------
+
+Thread #x's call to sem_init failed
+ with error code 22 (EINVAL: Invalid argument)
+ at 0x........: sem_init_WRK (hg_intercepts.c:...)
+ by 0x........: sem_init (hg_intercepts.c:...)
+ by 0x........: main (tc18_semabuse.c:23)
+
+----------------------------------------------------------------
+
+Thread #x's call to sem_wait failed
+ with error code 22 (EINVAL: Invalid argument)
+ at 0x........: sem_wait_WRK (hg_intercepts.c:...)
+ by 0x........: sem_wait (hg_intercepts.c:...)
+ by 0x........: main (tc18_semabuse.c:34)
+
+----------------------------------------------------------------
+
+Thread #x's call to sem_post failed
+ with error code 22 (EINVAL: Invalid argument)
+ at 0x........: sem_post_WRK (hg_intercepts.c:...)
+ by 0x........: sem_post (hg_intercepts.c:...)
+ ...
+ by 0x........: main (tc18_semabuse.c:40)
+
+----------------------------------------------------------------
+
+Thread #x's call to sem_destroy failed
+ with error code 22 (EINVAL: Invalid argument)
+ at 0x........: sem_destroy_WRK (hg_intercepts.c:...)
+ by 0x........: sem_destroy (hg_intercepts.c:...)
+ by 0x........: main (tc18_semabuse.c:42)
+
+
+ERROR SUMMARY: 4 errors from 4 contexts (suppressed: 0 from 0)
#include "safe-pthread.h"
#include "safe-semaphore.h"
-#if !defined(__APPLE__)
+#if !defined(__APPLE__) && !defined(__FreeBSD__)
#if defined(__sun__)
/* Fake __GLIBC_PREREQ on Solaris. Pretend glibc >= 2.4. */
-prereq: test -e tc20_verifywrap
+prereq: test -e tc20_verifywrap && ! ../../tests/os_test freebsd
prog: tc20_verifywrap
vgopts: --read-var-info=yes --sigill-diagnostics=no
prereq: test -e tc22_exit_w_lock
prog: tc22_exit_w_lock
+cleanup: rm -f vgcore.*
#include <semaphore.h>
#include <stdio.h>
#include <stdlib.h>
+#if defined(VGO_freebsd)
+#include <sys/fcntl.h>
+#endif
pthread_mutex_t mx[4];
pthread_cond_t cv; pthread_rwlock_t rwl;
sem_t* quit_now;
static int my_sem_wait(sem_t*); static int my_sem_post(sem_t*);
void* rescue_me ( void* uu )
{
+#if !defined(VGO_freebsd)
/* wait for, and unblock, the first wait */
sleep(1);
pthread_cond_signal( &cv );
+#endif
/* wait for, and unblock, the second wait */
sleep(1);
/* Do stupid things and hope that rescue_me gets us out of
trouble */
+#if !defined(VGO_freebsd)
/* mx is bogus */
r= pthread_cond_wait(&cv, (pthread_mutex_t*)(4 + (char*)&mx[0]) );
+#endif
/* mx is not locked */
r= pthread_cond_wait(&cv, &mx[3]);
{
sem_t* s;
-#if defined(VGO_linux) || defined(VGO_solaris)
+#if defined(VGO_linux) || defined(VGO_solaris) || defined(VGO_freebsd)
s = malloc(sizeof(*s));
if (s) {
if (sem_init(s, pshared, count) < 0) {
Thread #x: pthread_cond_{timed}wait called with invalid mutex
at 0x........: pthread_cond_wait_WRK (hg_intercepts.c:...)
by 0x........: pthread_cond_wait@* (hg_intercepts.c:...)
- by 0x........: main (tc23_bogus_condwait.c:69)
+ by 0x........: main (tc23_bogus_condwait.c:75)
----------------------------------------------------------------
Thread #x: pthread_cond_{timed}wait called with un-held mutex
at 0x........: pthread_cond_wait_WRK (hg_intercepts.c:...)
by 0x........: pthread_cond_wait@* (hg_intercepts.c:...)
- by 0x........: main (tc23_bogus_condwait.c:72)
+ by 0x........: main (tc23_bogus_condwait.c:79)
----------------------------------------------------------------
Thread #x: pthread_cond_{timed}wait: cond is associated with a different mutex
at 0x........: pthread_cond_wait_WRK (hg_intercepts.c:...)
by 0x........: pthread_cond_wait@* (hg_intercepts.c:...)
- by 0x........: main (tc23_bogus_condwait.c:72)
+ by 0x........: main (tc23_bogus_condwait.c:79)
----------------------------------------------------------------
Thread #x: pthread_cond_{timed}wait called with mutex of type pthread_rwlock_t*
at 0x........: pthread_cond_wait_WRK (hg_intercepts.c:...)
by 0x........: pthread_cond_wait@* (hg_intercepts.c:...)
- by 0x........: main (tc23_bogus_condwait.c:75)
+ by 0x........: main (tc23_bogus_condwait.c:82)
----------------------------------------------------------------
Thread #x: pthread_cond_{timed}wait: cond is associated with a different mutex
at 0x........: pthread_cond_wait_WRK (hg_intercepts.c:...)
by 0x........: pthread_cond_wait@* (hg_intercepts.c:...)
- by 0x........: main (tc23_bogus_condwait.c:75)
+ by 0x........: main (tc23_bogus_condwait.c:82)
----------------------------------------------------------------
Thread #x: pthread_cond_{timed}wait called with mutex held by a different thread
at 0x........: pthread_cond_wait_WRK (hg_intercepts.c:...)
by 0x........: pthread_cond_wait@* (hg_intercepts.c:...)
- by 0x........: main (tc23_bogus_condwait.c:78)
+ by 0x........: main (tc23_bogus_condwait.c:85)
----------------------------------------------------------------
Thread #x: pthread_cond_{timed}wait: cond is associated with a different mutex
at 0x........: pthread_cond_wait_WRK (hg_intercepts.c:...)
by 0x........: pthread_cond_wait@* (hg_intercepts.c:...)
- by 0x........: main (tc23_bogus_condwait.c:78)
+ by 0x........: main (tc23_bogus_condwait.c:85)
ERROR SUMMARY: 7 errors from 7 contexts (suppressed: 0 from 0)
--- /dev/null
+
+---Thread-Announcement------------------------------------------
+
+Thread #x is the program's root thread
+
+----------------------------------------------------------------
+
+Thread #x: pthread_cond_{timed}wait called with un-held mutex
+ at 0x........: pthread_cond_wait_WRK (hg_intercepts.c:...)
+ by 0x........: pthread_cond_wait@* (hg_intercepts.c:...)
+ by 0x........: main (tc23_bogus_condwait.c:79)
+
+----------------------------------------------------------------
+
+Thread #x's call to pthread_cond_wait failed
+ with error code 1 (EPERM: Operation not permitted)
+ at 0x........: pthread_cond_wait_WRK (hg_intercepts.c:...)
+ by 0x........: pthread_cond_wait@* (hg_intercepts.c:...)
+ by 0x........: main (tc23_bogus_condwait.c:79)
+
+----------------------------------------------------------------
+
+Thread #x: pthread_cond_{timed}wait called with mutex of type pthread_rwlock_t*
+ at 0x........: pthread_cond_wait_WRK (hg_intercepts.c:...)
+ by 0x........: pthread_cond_wait@* (hg_intercepts.c:...)
+ by 0x........: main (tc23_bogus_condwait.c:82)
+
+----------------------------------------------------------------
+
+Thread #x: pthread_cond_{timed}wait: cond is associated with a different mutex
+ at 0x........: pthread_cond_wait_WRK (hg_intercepts.c:...)
+ by 0x........: pthread_cond_wait@* (hg_intercepts.c:...)
+ by 0x........: main (tc23_bogus_condwait.c:82)
+
+----------------------------------------------------------------
+
+Thread #x's call to pthread_cond_wait failed
+ with error code 1 (EPERM: Operation not permitted)
+ at 0x........: pthread_cond_wait_WRK (hg_intercepts.c:...)
+ by 0x........: pthread_cond_wait@* (hg_intercepts.c:...)
+ by 0x........: main (tc23_bogus_condwait.c:82)
+
+----------------------------------------------------------------
+
+Thread #x: pthread_cond_{timed}wait called with mutex held by a different thread
+ at 0x........: pthread_cond_wait_WRK (hg_intercepts.c:...)
+ by 0x........: pthread_cond_wait@* (hg_intercepts.c:...)
+ by 0x........: main (tc23_bogus_condwait.c:85)
+
+----------------------------------------------------------------
+
+Thread #x: pthread_cond_{timed}wait: cond is associated with a different mutex
+ at 0x........: pthread_cond_wait_WRK (hg_intercepts.c:...)
+ by 0x........: pthread_cond_wait@* (hg_intercepts.c:...)
+ by 0x........: main (tc23_bogus_condwait.c:85)
+
+----------------------------------------------------------------
+
+Thread #x's call to pthread_cond_wait failed
+ with error code 1 (EPERM: Operation not permitted)
+ at 0x........: pthread_cond_wait_WRK (hg_intercepts.c:...)
+ by 0x........: pthread_cond_wait@* (hg_intercepts.c:...)
+ by 0x........: main (tc23_bogus_condwait.c:85)
+
+---Thread-Announcement------------------------------------------
+
+Thread #x was created
+ ...
+ by 0x........: pthread_create@* (hg_intercepts.c:...)
+ by 0x........: main (tc23_bogus_condwait.c:69)
+
+----------------------------------------------------------------
+
+Thread #x: pthread_cond_{signal,broadcast}: dubious: associated lock is not held by any thread
+ at 0x........: pthread_cond_signal_WRK (hg_intercepts.c:...)
+ by 0x........: pthread_cond_signal (hg_intercepts.c:...)
+ by 0x........: rescue_me (tc23_bogus_condwait.c:29)
+ by 0x........: mythread_wrapper (hg_intercepts.c:...)
+ ...
+
+----------------------------------------------------------------
+
+Thread #x: pthread_cond_{signal,broadcast}: dubious: associated lock is not held by any thread
+ at 0x........: pthread_cond_signal_WRK (hg_intercepts.c:...)
+ by 0x........: pthread_cond_signal (hg_intercepts.c:...)
+ by 0x........: rescue_me (tc23_bogus_condwait.c:33)
+ by 0x........: mythread_wrapper (hg_intercepts.c:...)
+ ...
+
+----------------------------------------------------------------
+
+Thread #x: pthread_cond_{signal,broadcast}: dubious: associated lock is not held by any thread
+ at 0x........: pthread_cond_signal_WRK (hg_intercepts.c:...)
+ by 0x........: pthread_cond_signal (hg_intercepts.c:...)
+ by 0x........: rescue_me (tc23_bogus_condwait.c:37)
+ by 0x........: mythread_wrapper (hg_intercepts.c:...)
+ ...
+
+
+ERROR SUMMARY: 11 errors from 11 contexts (suppressed: 0 from 0)
#include <assert.h>
#include <stdlib.h>
#include <unistd.h>
+#if defined(VGO_freebsd)
+# include <sys/fcntl.h>
+#endif
#define N_THREADS 3
{
sem_t* s;
-#if defined(VGO_linux) || defined(VGO_solaris)
+#if defined(VGO_linux) || defined(VGO_solaris) || defined(VGO_freebsd)
s = malloc(sizeof(*s));
if (s) {
if (sem_init(s, pshared, count) < 0) {
fi
done
- for f in $(ls -d filter* 2>/dev/null)
+ for f in $(ls -d filter* 2>/dev/null | grep -v \.in)
do
if ! echo "${parsed_makefile}" 2>/dev/null | grep '^ *dist_noinst_SCRIPTS *=' |
grep -qw "$f"
"linux",
"darwin",
"solaris",
+ "freebsd",
NULL
};
#elif defined(VGO_solaris)
if ( 0 == strcmp( OS, "solaris" ) ) return True;
+#elif defined(VGO_freebsd)
+ if ( 0 == strcmp( OS, "freebsd" ) ) return True;
+
#else
# error Unknown OS
#endif // VGO_*