From: Bart Van Assche Date: Tue, 1 Jul 2008 08:48:56 +0000 (+0000) Subject: - Renamed the client request VG_USERREQ__GET_THREAD_SELF into X-Git-Tag: svn/VALGRIND_3_4_0~400 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bad05e62238a150fbd0a560189b48bf7fc4a4ef8;p=thirdparty%2Fvalgrind.git - 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 --- diff --git a/exp-drd/Makefile.am b/exp-drd/Makefile.am index 16199f4043..4555f8c029 100644 --- a/exp-drd/Makefile.am +++ b/exp-drd/Makefile.am @@ -120,7 +120,6 @@ noinst_HEADERS = \ 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 d3be7bd2e6..b8fdc4e39b 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 */ @@ -103,11 +106,21 @@ enum }; +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 d9c3ebbf9c..38238f434a 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 d69657a9ff..e83d0e67d9 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 @@ static Bool drd_handle_client_request(ThreadId vg_tid, UWord* arg, UWord* ret) 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 595a8eeb40..57bd9d13d3 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 @@ typedef enum 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 5e30adfe41..607331c8bc 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 2176ba1ab3..148ec23975 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 f4b2fe8591..44058b455b 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 4bedf8f0c8..d3d0d17696 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 2b566b699a..0000000000 --- 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 683fc6d6bf..69fa6648ff 100644 --- a/exp-drd/tests/fp_race.c +++ b/exp-drd/tests/fp_race.c @@ -28,7 +28,7 @@ #include // printf() #include #include // usleep() -#include "../drd.h" + // Local functions declarations. diff --git a/exp-drd/tests/omp_prime.c b/exp-drd/tests/omp_prime.c index bc4df51765..ea11b6f395 100644 --- a/exp-drd/tests/omp_prime.c +++ b/exp-drd/tests/omp_prime.c @@ -10,7 +10,6 @@ #include #include #include // 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 cc830dec55..303a5d84fe 100644 --- a/exp-drd/tests/pth_cond_race.c +++ b/exp-drd/tests/pth_cond_race.c @@ -6,7 +6,6 @@ #include // printf() #include #include // usleep() -#include "../drd.h" // Local functions declarations. diff --git a/exp-drd/tests/pth_detached.c b/exp-drd/tests/pth_detached.c index a2857e046e..506693c181 100644 --- a/exp-drd/tests/pth_detached.c +++ b/exp-drd/tests/pth_detached.c @@ -8,7 +8,6 @@ #include #include #include -#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 d76f6c97d7..27602ab6e3 100644 --- a/exp-drd/tests/pth_detached_sem.c +++ b/exp-drd/tests/pth_detached_sem.c @@ -13,7 +13,6 @@ #include #include #include -#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 9f4fe0b052..e07524f090 100644 --- a/exp-drd/tests/rwlock_race.c +++ b/exp-drd/tests/rwlock_race.c @@ -11,7 +11,7 @@ #include #include #include -#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 d88b35019a..1e23e1cc28 100644 --- a/exp-drd/tests/sem_as_mutex.c +++ b/exp-drd/tests/sem_as_mutex.c @@ -29,7 +29,7 @@ #include #include #include // usleep() -#include "../drd.h" + // Local functions declarations. diff --git a/exp-drd/tests/sigalrm.c b/exp-drd/tests/sigalrm.c index 042ad31f13..2023cf35c5 100644 --- a/exp-drd/tests/sigalrm.c +++ b/exp-drd/tests/sigalrm.c @@ -31,7 +31,7 @@ static void print_thread_id(const char* const label) 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 @@ int main(int argc, char** argv) if (argc > 1) s_debug = 1; - vgthreadid = vg_get_drd_threadid(); + vgthreadid = vg_get_valgrind_threadid(); print_thread_id("main: ");