- Renamed the client request VG_USERREQ__GET_THREAD_SELF into
VG_USERREQ__DRD_GET_VALGRIND_THREAD_ID.
- Added a new client request, namely VG_USERREQ__DRD_GET_DRD_THREAD_ID.
- Merged the header file priv_drd_clientreq.h into drd_clientreq.h.
- Removed #include "../drd.h" from the regression tests that do not
perform client requests.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8324 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/exp-drd/Makefile.am b/exp-drd/Makefile.am
index 16199f4..4555f8c 100644
--- a/exp-drd/Makefile.am
+++ b/exp-drd/Makefile.am
@@ -120,7 +120,6 @@
drd_thread.h \
drd_track.h \
drd_vc.h \
- priv_drd_clientreq.h \
pub_drd_bitmap.h
exp_drd_x86_linux_SOURCES = $(DRD_SOURCES_COMMON)
diff --git a/exp-drd/drd.h b/exp-drd/drd.h
index d3be7bd..b8fdc4e 100644
--- a/exp-drd/drd.h
+++ b/exp-drd/drd.h
@@ -82,7 +82,10 @@
enum
{
/* Ask the core the thread ID assigned by Valgrind. */
- VG_USERREQ__GET_THREAD_SELF = VG_USERREQ_TOOL_BASE('D','R'),
+ VG_USERREQ__DRD_GET_VALGRIND_THREAD_ID = VG_USERREQ_TOOL_BASE('D','R'),
+ /* args: none. */
+ /* Ask the core the thread ID assigned by DRD. */
+ VG_USERREQ__DRD_GET_DRD_THREAD_ID,
/* args: none. */
/* To tell the drd tool to suppress data race detection on the specified */
@@ -104,10 +107,20 @@
static __inline__
+int vg_get_valgrind_threadid(void)
+{
+ int res;
+ VALGRIND_DO_CLIENT_REQUEST(res, 0, VG_USERREQ__DRD_GET_VALGRIND_THREAD_ID,
+ 0, 0, 0, 0, 0);
+ return res;
+}
+
+static __inline__
int vg_get_drd_threadid(void)
{
int res;
- VALGRIND_DO_CLIENT_REQUEST(res, 0, VG_USERREQ__GET_THREAD_SELF, 0,0,0,0,0);
+ VALGRIND_DO_CLIENT_REQUEST(res, 0, VG_USERREQ__DRD_GET_DRD_THREAD_ID,
+ 0, 0, 0, 0, 0);
return res;
}
diff --git a/exp-drd/drd_barrier.c b/exp-drd/drd_barrier.c
index d9c3ebb..38238f4 100644
--- a/exp-drd/drd_barrier.c
+++ b/exp-drd/drd_barrier.c
@@ -27,7 +27,6 @@
#include "drd_clientobj.h"
#include "drd_error.h"
#include "drd_suppression.h"
-#include "priv_drd_clientreq.h"
#include "pub_tool_errormgr.h" // VG_(maybe_record_error)()
#include "pub_tool_libcassert.h" // tl_assert()
#include "pub_tool_libcprint.h" // VG_(printf)()
diff --git a/exp-drd/drd_clientreq.c b/exp-drd/drd_clientreq.c
index d69657a..e83d0e6 100644
--- a/exp-drd/drd_clientreq.c
+++ b/exp-drd/drd_clientreq.c
@@ -31,7 +31,6 @@
#include "drd_thread.h"
#include "drd_track.h"
#include "drd_rwlock.h"
-#include "priv_drd_clientreq.h"
#include "pub_tool_basics.h" // Bool
#include "pub_tool_debuginfo.h" // VG_(describe_IP)()
#include "pub_tool_libcassert.h"
@@ -133,10 +132,14 @@
switch (arg[0])
{
- case VG_USERREQ__GET_THREAD_SELF:
+ case VG_USERREQ__DRD_GET_VALGRIND_THREAD_ID:
result = vg_tid;
break;
+ case VG_USERREQ__DRD_GET_DRD_THREAD_ID:
+ result = drd_tid;
+ break;
+
case VG_USERREQ__DRD_START_SUPPRESSION:
drd_start_suppression(arg[1], arg[1] + arg[2], "client");
break;
diff --git a/exp-drd/drd_clientreq.h b/exp-drd/drd_clientreq.h
index 595a8ee..57bd9d1 100644
--- a/exp-drd/drd_clientreq.h
+++ b/exp-drd/drd_clientreq.h
@@ -1,3 +1,28 @@
+/*
+ This file is part of drd, a data race detector.
+
+ Copyright (C) 2006-2008 Bart Van Assche
+ bart.vanassche@gmail.com
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307, USA.
+
+ The GNU General Public License is contained in the file COPYING.
+*/
+
+
#ifndef __DRD_CLIENTREQ_H
#define __DRD_CLIENTREQ_H
@@ -163,5 +188,7 @@
gomp_barrier = 2
} BarrierT;
+void drd_clientreq_init(void);
+
#endif // __DRD_CLIENTREQ_H
diff --git a/exp-drd/drd_main.c b/exp-drd/drd_main.c
index 5e30adf..607331c 100644
--- a/exp-drd/drd_main.c
+++ b/exp-drd/drd_main.c
@@ -39,7 +39,6 @@
#include "drd_track.h"
#include "drd_vc.h"
#include "libvex_guest_offsets.h"
-#include "priv_drd_clientreq.h"
#include "pub_drd_bitmap.h"
#include "pub_tool_vki.h" // Must be included before pub_tool_libcproc
#include "pub_tool_basics.h"
diff --git a/exp-drd/drd_mutex.c b/exp-drd/drd_mutex.c
index 2176ba1..148ec23 100644
--- a/exp-drd/drd_mutex.c
+++ b/exp-drd/drd_mutex.c
@@ -26,7 +26,6 @@
#include "drd_clientobj.h"
#include "drd_error.h"
#include "drd_mutex.h"
-#include "priv_drd_clientreq.h"
#include "pub_tool_vki.h"
#include "pub_tool_errormgr.h" // VG_(maybe_record_error)()
#include "pub_tool_libcassert.h" // tl_assert()
diff --git a/exp-drd/drd_rwlock.c b/exp-drd/drd_rwlock.c
index f4b2fe8..44058b4 100644
--- a/exp-drd/drd_rwlock.c
+++ b/exp-drd/drd_rwlock.c
@@ -26,7 +26,6 @@
#include "drd_clientobj.h"
#include "drd_error.h"
#include "drd_rwlock.h"
-#include "priv_drd_clientreq.h"
#include "pub_tool_vki.h"
#include "pub_tool_errormgr.h" // VG_(maybe_record_error)()
#include "pub_tool_libcassert.h" // tl_assert()
diff --git a/exp-drd/drd_semaphore.c b/exp-drd/drd_semaphore.c
index 4bedf8f..d3d0d17 100644
--- a/exp-drd/drd_semaphore.c
+++ b/exp-drd/drd_semaphore.c
@@ -27,7 +27,6 @@
#include "drd_error.h"
#include "drd_semaphore.h"
#include "drd_suppression.h"
-#include "priv_drd_clientreq.h"
#include "pub_tool_errormgr.h" // VG_(maybe_record_error)()
#include "pub_tool_libcassert.h" // tl_assert()
#include "pub_tool_libcprint.h" // VG_(printf)()
diff --git a/exp-drd/priv_drd_clientreq.h b/exp-drd/priv_drd_clientreq.h
deleted file mode 100644
index 2b566b6..0000000
--- a/exp-drd/priv_drd_clientreq.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- This file is part of drd, a data race detector.
-
- Copyright (C) 2006-2008 Bart Van Assche
- bart.vanassche@gmail.com
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307, USA.
-
- The GNU General Public License is contained in the file COPYING.
-*/
-
-#ifndef __PRIV_DRD_CLIENTREQ_H
-#define __PRIV_DRD_CLIENTREQ_H
-
-void drd_clientreq_init(void);
-
-#endif /* __PRIV_DRD_CLIENTREQ_H */
diff --git a/exp-drd/tests/fp_race.c b/exp-drd/tests/fp_race.c
index 683fc6d..69fa664 100644
--- a/exp-drd/tests/fp_race.c
+++ b/exp-drd/tests/fp_race.c
@@ -28,7 +28,7 @@
#include <stdio.h> // printf()
#include <pthread.h>
#include <unistd.h> // usleep()
-#include "../drd.h"
+
// Local functions declarations.
diff --git a/exp-drd/tests/omp_prime.c b/exp-drd/tests/omp_prime.c
index bc4df51..ea11b6f 100644
--- a/exp-drd/tests/omp_prime.c
+++ b/exp-drd/tests/omp_prime.c
@@ -10,7 +10,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h> // getopt()
-#include "../drd.h"
static int is_prime(int* const pflag, int v)
diff --git a/exp-drd/tests/pth_cond_race.c b/exp-drd/tests/pth_cond_race.c
index cc830de..303a5d8 100644
--- a/exp-drd/tests/pth_cond_race.c
+++ b/exp-drd/tests/pth_cond_race.c
@@ -6,7 +6,6 @@
#include <stdio.h> // printf()
#include <pthread.h>
#include <unistd.h> // usleep()
-#include "../drd.h"
// Local functions declarations.
diff --git a/exp-drd/tests/pth_detached.c b/exp-drd/tests/pth_detached.c
index a2857e0..506693c 100644
--- a/exp-drd/tests/pth_detached.c
+++ b/exp-drd/tests/pth_detached.c
@@ -8,7 +8,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
-#include "../drd.h"
static int s_finished_count;
diff --git a/exp-drd/tests/pth_detached_sem.c b/exp-drd/tests/pth_detached_sem.c
index d76f6c9..27602ab 100644
--- a/exp-drd/tests/pth_detached_sem.c
+++ b/exp-drd/tests/pth_detached_sem.c
@@ -13,7 +13,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
-#include "../drd.h"
static sem_t s_sem;
diff --git a/exp-drd/tests/rwlock_race.c b/exp-drd/tests/rwlock_race.c
index 9f4fe0b..e07524f 100644
--- a/exp-drd/tests/rwlock_race.c
+++ b/exp-drd/tests/rwlock_race.c
@@ -11,7 +11,7 @@
#include <pthread.h>
#include <stdio.h>
#include <unistd.h>
-#include "../drd.h"
+
static pthread_rwlock_t s_rwlock;
diff --git a/exp-drd/tests/sem_as_mutex.c b/exp-drd/tests/sem_as_mutex.c
index d88b350..1e23e1c 100644
--- a/exp-drd/tests/sem_as_mutex.c
+++ b/exp-drd/tests/sem_as_mutex.c
@@ -29,7 +29,7 @@
#include <pthread.h>
#include <semaphore.h>
#include <unistd.h> // usleep()
-#include "../drd.h"
+
// Local functions declarations.
diff --git a/exp-drd/tests/sigalrm.c b/exp-drd/tests/sigalrm.c
index 042ad31..2023cf3 100644
--- a/exp-drd/tests/sigalrm.c
+++ b/exp-drd/tests/sigalrm.c
@@ -31,7 +31,7 @@
char msg[256];
snprintf(msg, sizeof(msg),
"%spid %d / kernel thread ID %d / Valgrind thread ID %d\n",
- label, getpid(), getktid(), vg_get_drd_threadid());
+ label, getpid(), getktid(), vg_get_valgrind_threadid());
write(STDOUT_FILENO, msg, strlen(msg));
}
}
@@ -61,7 +61,7 @@
if (argc > 1)
s_debug = 1;
- vgthreadid = vg_get_drd_threadid();
+ vgthreadid = vg_get_valgrind_threadid();
print_thread_id("main: ");