blob: 81d8320dc4b8bd14e86ebc5087d809501da43d48 [file] [log] [blame]
sewardjaf44c822007-11-25 14:01:38 +00001#ifndef __DRD_CLIENTREQ_H
2#define __DRD_CLIENTREQ_H
3
4
5#include "valgrind.h" // VG_USERREQ_TOOL_BASE()
6
7
bartd00bd222008-03-30 08:40:49 +00008#define DRD_IGNORE_VAR(x) { int res; VALGRIND_DO_CLIENT_REQUEST(res, 0, VG_USERREQ__DRD_START_SUPPRESSION, &(x), sizeof(x), 0, 0, 0); }
9#define DRD_TRACE_VAR(x) { int res; VALGRIND_DO_CLIENT_REQUEST(res, 0, VG_USERREQ__DRD_START_TRACE_ADDR, &(x), sizeof(x), 0, 0, 0); }
10
11
sewardjaf44c822007-11-25 14:01:38 +000012enum {
13 /* Ask the core the thread ID assigned by Valgrind. */
14 VG_USERREQ__GET_THREAD_SELF = VG_USERREQ_TOOL_BASE('D', 'R'),
15 /* args: none. */
sewardjaf44c822007-11-25 14:01:38 +000016
17 /* To tell the drd tool to suppress data race detection on the specified */
18 /* address range. */
19 VG_USERREQ__DRD_START_SUPPRESSION,
bartf5bb46a2008-03-29 13:18:02 +000020 /* args: start address, size in bytes */
sewardjaf44c822007-11-25 14:01:38 +000021 /* To tell the drd tool no longer to suppress data race detection on the */
22 /* specified address range. */
23 VG_USERREQ__DRD_FINISH_SUPPRESSION,
bartf5bb46a2008-03-29 13:18:02 +000024 /* args: start address, size in bytes */
sewardjaf44c822007-11-25 14:01:38 +000025 /* Ask drd to suppress data race reports on all currently allocated stack */
26 /* data of the current thread. */
27 VG_USERREQ__DRD_SUPPRESS_CURRENT_STACK,
28 /* args: none */
29 /* To ask the drd tool to start a new segment in the specified thread. */
30 VG_USERREQ__DRD_START_NEW_SEGMENT,
31 /* args: POSIX thread ID. */
bart005dc972008-03-29 14:42:59 +000032 /* To ask the drd tool to trace all accesses to the specified range. */
33 VG_USERREQ__DRD_START_TRACE_ADDR,
34 /* args: Addr, SizeT. */
35 /* To ask the drd tool to stop tracing accesses to the specified range. */
36 VG_USERREQ__DRD_STOP_TRACE_ADDR,
37 /* args: Addr, SizeT. */
sewardjaf44c822007-11-25 14:01:38 +000038
sewardjaf44c822007-11-25 14:01:38 +000039 /* Tell the core the pthread_t of the running thread */
40 VG_USERREQ__SET_PTHREADID,
41 /* args: pthread_t. */
42 /* Ask the core that a the thread's state transition from */
43 /* VgTs_Zombie to VgTs_Empty is delayed until */
44 /* VG_USERREQ__POST_THREAD_JOIN is performed. */
45 VG_USERREQ__SET_JOINABLE,
46 /* args: pthread_t, Bool */
47
48 /* To notify drd that a thread finished because */
49 /* pthread_thread_join() was called on it. */
50 VG_USERREQ__POST_THREAD_JOIN,
51 /* args: pthread_t (joinee) */
52
sewardj85642922008-01-14 11:54:56 +000053 /* to notify the drd tool of a pthread_mutex_init call. */
sewardjaf44c822007-11-25 14:01:38 +000054 VG_USERREQ__PRE_MUTEX_INIT,
sewardj721ad7b2007-11-30 08:30:29 +000055 /* args: Addr, MutexT */
bart0268dfa2008-03-11 20:10:21 +000056 /* to notify the drd tool of a pthread_mutex_init call. */
57 VG_USERREQ__POST_MUTEX_INIT,
58 /* args: Addr */
59 /* to notify the drd tool of a pthread_mutex_destroy call. */
60 VG_USERREQ__PRE_MUTEX_DESTROY,
61 /* args: Addr */
sewardj85642922008-01-14 11:54:56 +000062 /* to notify the drd tool of a pthread_mutex_destroy call. */
sewardjaf44c822007-11-25 14:01:38 +000063 VG_USERREQ__POST_MUTEX_DESTROY,
bart0268dfa2008-03-11 20:10:21 +000064 /* args: Addr, MutexT */
sewardj85642922008-01-14 11:54:56 +000065 /* to notify the drd tool of pthread_mutex_lock calls */
bart0268dfa2008-03-11 20:10:21 +000066 VG_USERREQ__PRE_MUTEX_LOCK,
bart2e3a3c12008-03-24 08:33:47 +000067 /* args: Addr, MutexT, Bool */
sewardj85642922008-01-14 11:54:56 +000068 /* to notify the drd tool of pthread_mutex_lock calls */
bart0268dfa2008-03-11 20:10:21 +000069 VG_USERREQ__POST_MUTEX_LOCK,
bart00344642008-03-01 15:27:41 +000070 /* args: Addr, Bool */
sewardj85642922008-01-14 11:54:56 +000071 /* to notify the drd tool of pthread_mutex_unlock calls */
bart0268dfa2008-03-11 20:10:21 +000072 VG_USERREQ__PRE_MUTEX_UNLOCK,
73 /* args: Addr */
74 /* to notify the drd tool of pthread_mutex_unlock calls */
75 VG_USERREQ__POST_MUTEX_UNLOCK,
sewardjaf44c822007-11-25 14:01:38 +000076 /* args: Addr */
77 VG_USERREQ__SPIN_INIT_OR_UNLOCK,
bart0268dfa2008-03-11 20:10:21 +000078 /* args: Addr spinlock */
sewardjaf44c822007-11-25 14:01:38 +000079
80
sewardj85642922008-01-14 11:54:56 +000081 /* to notify the drd tool of a pthread_cond_init call. */
bart0268dfa2008-03-11 20:10:21 +000082 VG_USERREQ__PRE_COND_INIT,
sewardj721ad7b2007-11-30 08:30:29 +000083 /* args: Addr */
sewardj85642922008-01-14 11:54:56 +000084 /* to notify the drd tool of a pthread_cond_destroy call. */
bart0268dfa2008-03-11 20:10:21 +000085 VG_USERREQ__POST_COND_DESTROY,
sewardjaf44c822007-11-25 14:01:38 +000086 /* args: Addr cond */
bart0268dfa2008-03-11 20:10:21 +000087 VG_USERREQ__PRE_COND_WAIT,
88 /* args: Addr cond, Addr mutex, MutexT mt */
89 VG_USERREQ__POST_COND_WAIT,
90 /* args: Addr cond, Addr mutex, Bool took_lock*/
91 VG_USERREQ__PRE_COND_SIGNAL,
92 /* args: Addr cond */
93 VG_USERREQ__PRE_COND_BROADCAST,
sewardjaf44c822007-11-25 14:01:38 +000094 /* args: Addr cond */
95
sewardj85642922008-01-14 11:54:56 +000096 /* To notify the drd tool of a sem_init call. */
bart0268dfa2008-03-11 20:10:21 +000097 VG_USERREQ__PRE_SEM_INIT,
98 /* args: Addr sem, Word pshared, Word value */
99 /* To notify the drd tool of a sem_init call. */
100 VG_USERREQ__POST_SEM_INIT,
101 /* args: Addr sem */
sewardj85642922008-01-14 11:54:56 +0000102 /* To notify the drd tool of a sem_destroy call. */
bart0268dfa2008-03-11 20:10:21 +0000103 VG_USERREQ__PRE_SEM_DESTROY,
104 /* args: Addr sem */
105 /* To notify the drd tool of a sem_destroy call. */
106 VG_USERREQ__POST_SEM_DESTROY,
sewardj85642922008-01-14 11:54:56 +0000107 /* args: Addr sem */
108 /* To notify the drd tool of a sem_wait call. */
bart28230a32008-02-29 17:27:03 +0000109 VG_USERREQ__PRE_SEM_WAIT,
bart0268dfa2008-03-11 20:10:21 +0000110 /* args: Addr sem */
bart28230a32008-02-29 17:27:03 +0000111 /* To notify the drd tool of a sem_wait call. */
112 VG_USERREQ__POST_SEM_WAIT,
113 /* args: Addr sem, Bool waited */
sewardj85642922008-01-14 11:54:56 +0000114 /* To notify the drd tool before a sem_post call. */
115 VG_USERREQ__PRE_SEM_POST,
bart0268dfa2008-03-11 20:10:21 +0000116 /* args: Addr sem */
sewardj85642922008-01-14 11:54:56 +0000117 /* To notify the drd tool after a sem_post call. */
118 VG_USERREQ__POST_SEM_POST,
bart0268dfa2008-03-11 20:10:21 +0000119 /* args: Addr sem, Bool waited */
sewardj85642922008-01-14 11:54:56 +0000120
121 /* To notify the drd tool of a pthread_barrier_init call. */
bart0268dfa2008-03-11 20:10:21 +0000122 VG_USERREQ__PRE_BARRIER_INIT,
123 /* args: Addr barrier, BarrierT type, Word count, Bool reinit */
124 /* To notify the drd tool of a pthread_barrier_init call. */
125 VG_USERREQ__POST_BARRIER_INIT,
126 /* args: Addr barrier, BarrierT type */
sewardj85642922008-01-14 11:54:56 +0000127 /* To notify the drd tool of a pthread_barrier_destroy call. */
bart0268dfa2008-03-11 20:10:21 +0000128 VG_USERREQ__PRE_BARRIER_DESTROY,
129 /* args: Addr barrier, BarrierT type. */
130 /* To notify the drd tool of a pthread_barrier_destroy call. */
131 VG_USERREQ__POST_BARRIER_DESTROY,
132 /* args: Addr barrier, BarrierT type. */
sewardj85642922008-01-14 11:54:56 +0000133 /* To notify the drd tool of a pthread_barrier_wait call. */
134 VG_USERREQ__PRE_BARRIER_WAIT,
bart0268dfa2008-03-11 20:10:21 +0000135 /* args: Addr barrier, BarrierT type. */
sewardj85642922008-01-14 11:54:56 +0000136 /* To notify the drd tool of a pthread_barrier_wait call. */
137 VG_USERREQ__POST_BARRIER_WAIT,
bart0268dfa2008-03-11 20:10:21 +0000138 /* args: Addr barrier, BarrierT type, Word has_waited */
sewardj85642922008-01-14 11:54:56 +0000139
bart00344642008-03-01 15:27:41 +0000140 /* To notify the drd tool of a pthread_rwlock_init call. */
141 VG_USERREQ__PRE_RWLOCK_INIT,
bart0268dfa2008-03-11 20:10:21 +0000142 /* args: Addr rwlock */
bart00344642008-03-01 15:27:41 +0000143 /* To notify the drd tool of a pthread_rwlock_destroy call. */
144 VG_USERREQ__POST_RWLOCK_DESTROY,
bart0268dfa2008-03-11 20:10:21 +0000145 /* args: Addr rwlock */
bart00344642008-03-01 15:27:41 +0000146 /* To notify the drd tool of a pthread_rwlock_rdlock call. */
147 VG_USERREQ__PRE_RWLOCK_RDLOCK,
bart0268dfa2008-03-11 20:10:21 +0000148 /* args: Addr rwlock */
bart00344642008-03-01 15:27:41 +0000149 /* To notify the drd tool of a pthread_rwlock_rdlock call. */
150 VG_USERREQ__POST_RWLOCK_RDLOCK,
151 /* args: Addr rwlock, Bool took_lock */
152 /* To notify the drd tool of a pthread_rwlock_wrlock call. */
153 VG_USERREQ__PRE_RWLOCK_WRLOCK,
bart0268dfa2008-03-11 20:10:21 +0000154 /* args: Addr rwlock */
bart00344642008-03-01 15:27:41 +0000155 /* To notify the drd tool of a pthread_rwlock_wrlock call. */
156 VG_USERREQ__POST_RWLOCK_WRLOCK,
157 /* args: Addr rwlock, Bool took_lock */
158 /* To notify the drd tool of a pthread_rwlock_unlock call. */
bart777f7fe2008-03-02 17:43:18 +0000159 VG_USERREQ__PRE_RWLOCK_UNLOCK,
bart0268dfa2008-03-11 20:10:21 +0000160 /* args: Addr rwlock */
161 /* To notify the drd tool of a pthread_rwlock_unlock call. */
bartd00bd222008-03-30 08:40:49 +0000162 VG_USERREQ__POST_RWLOCK_UNLOCK
bart00344642008-03-01 15:27:41 +0000163 /* args: Addr rwlock, Bool unlocked */
164
sewardjaf44c822007-11-25 14:01:38 +0000165};
166
sewardj721ad7b2007-11-30 08:30:29 +0000167typedef enum
168{
bart635cb162008-02-28 08:30:43 +0000169 mutex_type_invalid_mutex = 0,
bart5357fcb2008-02-27 15:46:00 +0000170 mutex_type_recursive_mutex = 1,
171 mutex_type_errorcheck_mutex = 2,
172 mutex_type_default_mutex = 3,
bartd00bd222008-03-30 08:40:49 +0000173 mutex_type_spinlock = 4
sewardj721ad7b2007-11-30 08:30:29 +0000174} MutexT;
sewardjaf44c822007-11-25 14:01:38 +0000175
bart0268dfa2008-03-11 20:10:21 +0000176typedef enum
177 {
178 pthread_barrier = 1,
bartd00bd222008-03-30 08:40:49 +0000179 gomp_barrier = 2
bart0268dfa2008-03-11 20:10:21 +0000180 } BarrierT;
sewardjaf44c822007-11-25 14:01:38 +0000181
182#endif // __DRD_CLIENTREQ_H