blob: 08a6d4a4488f1dae6139228a4aa48bcc455b9c62 [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
8enum {
9 /* Ask the core the thread ID assigned by Valgrind. */
10 VG_USERREQ__GET_THREAD_SELF = VG_USERREQ_TOOL_BASE('D', 'R'),
11 /* args: none. */
sewardjaf44c822007-11-25 14:01:38 +000012
13 /* To tell the drd tool to suppress data race detection on the specified */
14 /* address range. */
15 VG_USERREQ__DRD_START_SUPPRESSION,
bartf5bb46a2008-03-29 13:18:02 +000016 /* args: start address, size in bytes */
sewardjaf44c822007-11-25 14:01:38 +000017 /* To tell the drd tool no longer to suppress data race detection on the */
18 /* specified address range. */
19 VG_USERREQ__DRD_FINISH_SUPPRESSION,
bartf5bb46a2008-03-29 13:18:02 +000020 /* args: start address, size in bytes */
sewardjaf44c822007-11-25 14:01:38 +000021 /* Ask drd to suppress data race reports on all currently allocated stack */
22 /* data of the current thread. */
23 VG_USERREQ__DRD_SUPPRESS_CURRENT_STACK,
24 /* args: none */
25 /* To ask the drd tool to start a new segment in the specified thread. */
26 VG_USERREQ__DRD_START_NEW_SEGMENT,
27 /* args: POSIX thread ID. */
bart005dc972008-03-29 14:42:59 +000028 /* To ask the drd tool to trace all accesses to the specified range. */
29 VG_USERREQ__DRD_START_TRACE_ADDR,
30 /* args: Addr, SizeT. */
31 /* To ask the drd tool to stop tracing accesses to the specified range. */
32 VG_USERREQ__DRD_STOP_TRACE_ADDR,
33 /* args: Addr, SizeT. */
sewardjaf44c822007-11-25 14:01:38 +000034
sewardjaf44c822007-11-25 14:01:38 +000035 /* Tell the core the pthread_t of the running thread */
36 VG_USERREQ__SET_PTHREADID,
37 /* args: pthread_t. */
38 /* Ask the core that a the thread's state transition from */
39 /* VgTs_Zombie to VgTs_Empty is delayed until */
40 /* VG_USERREQ__POST_THREAD_JOIN is performed. */
41 VG_USERREQ__SET_JOINABLE,
42 /* args: pthread_t, Bool */
43
44 /* To notify drd that a thread finished because */
45 /* pthread_thread_join() was called on it. */
46 VG_USERREQ__POST_THREAD_JOIN,
47 /* args: pthread_t (joinee) */
48
sewardj85642922008-01-14 11:54:56 +000049 /* to notify the drd tool of a pthread_mutex_init call. */
sewardjaf44c822007-11-25 14:01:38 +000050 VG_USERREQ__PRE_MUTEX_INIT,
sewardj721ad7b2007-11-30 08:30:29 +000051 /* args: Addr, MutexT */
bart0268dfa2008-03-11 20:10:21 +000052 /* to notify the drd tool of a pthread_mutex_init call. */
53 VG_USERREQ__POST_MUTEX_INIT,
54 /* args: Addr */
55 /* to notify the drd tool of a pthread_mutex_destroy call. */
56 VG_USERREQ__PRE_MUTEX_DESTROY,
57 /* args: Addr */
sewardj85642922008-01-14 11:54:56 +000058 /* to notify the drd tool of a pthread_mutex_destroy call. */
sewardjaf44c822007-11-25 14:01:38 +000059 VG_USERREQ__POST_MUTEX_DESTROY,
bart0268dfa2008-03-11 20:10:21 +000060 /* args: Addr, MutexT */
sewardj85642922008-01-14 11:54:56 +000061 /* to notify the drd tool of pthread_mutex_lock calls */
bart0268dfa2008-03-11 20:10:21 +000062 VG_USERREQ__PRE_MUTEX_LOCK,
bart2e3a3c12008-03-24 08:33:47 +000063 /* args: Addr, MutexT, Bool */
sewardj85642922008-01-14 11:54:56 +000064 /* to notify the drd tool of pthread_mutex_lock calls */
bart0268dfa2008-03-11 20:10:21 +000065 VG_USERREQ__POST_MUTEX_LOCK,
bart00344642008-03-01 15:27:41 +000066 /* args: Addr, Bool */
sewardj85642922008-01-14 11:54:56 +000067 /* to notify the drd tool of pthread_mutex_unlock calls */
bart0268dfa2008-03-11 20:10:21 +000068 VG_USERREQ__PRE_MUTEX_UNLOCK,
69 /* args: Addr */
70 /* to notify the drd tool of pthread_mutex_unlock calls */
71 VG_USERREQ__POST_MUTEX_UNLOCK,
sewardjaf44c822007-11-25 14:01:38 +000072 /* args: Addr */
73 VG_USERREQ__SPIN_INIT_OR_UNLOCK,
bart0268dfa2008-03-11 20:10:21 +000074 /* args: Addr spinlock */
sewardjaf44c822007-11-25 14:01:38 +000075
76
sewardj85642922008-01-14 11:54:56 +000077 /* to notify the drd tool of a pthread_cond_init call. */
bart0268dfa2008-03-11 20:10:21 +000078 VG_USERREQ__PRE_COND_INIT,
sewardj721ad7b2007-11-30 08:30:29 +000079 /* args: Addr */
sewardj85642922008-01-14 11:54:56 +000080 /* to notify the drd tool of a pthread_cond_destroy call. */
bart0268dfa2008-03-11 20:10:21 +000081 VG_USERREQ__POST_COND_DESTROY,
sewardjaf44c822007-11-25 14:01:38 +000082 /* args: Addr cond */
bart0268dfa2008-03-11 20:10:21 +000083 VG_USERREQ__PRE_COND_WAIT,
84 /* args: Addr cond, Addr mutex, MutexT mt */
85 VG_USERREQ__POST_COND_WAIT,
86 /* args: Addr cond, Addr mutex, Bool took_lock*/
87 VG_USERREQ__PRE_COND_SIGNAL,
88 /* args: Addr cond */
89 VG_USERREQ__PRE_COND_BROADCAST,
sewardjaf44c822007-11-25 14:01:38 +000090 /* args: Addr cond */
91
sewardj85642922008-01-14 11:54:56 +000092 /* To notify the drd tool of a sem_init call. */
bart0268dfa2008-03-11 20:10:21 +000093 VG_USERREQ__PRE_SEM_INIT,
94 /* args: Addr sem, Word pshared, Word value */
95 /* To notify the drd tool of a sem_init call. */
96 VG_USERREQ__POST_SEM_INIT,
97 /* args: Addr sem */
sewardj85642922008-01-14 11:54:56 +000098 /* To notify the drd tool of a sem_destroy call. */
bart0268dfa2008-03-11 20:10:21 +000099 VG_USERREQ__PRE_SEM_DESTROY,
100 /* args: Addr sem */
101 /* To notify the drd tool of a sem_destroy call. */
102 VG_USERREQ__POST_SEM_DESTROY,
sewardj85642922008-01-14 11:54:56 +0000103 /* args: Addr sem */
104 /* To notify the drd tool of a sem_wait call. */
bart28230a32008-02-29 17:27:03 +0000105 VG_USERREQ__PRE_SEM_WAIT,
bart0268dfa2008-03-11 20:10:21 +0000106 /* args: Addr sem */
bart28230a32008-02-29 17:27:03 +0000107 /* To notify the drd tool of a sem_wait call. */
108 VG_USERREQ__POST_SEM_WAIT,
109 /* args: Addr sem, Bool waited */
sewardj85642922008-01-14 11:54:56 +0000110 /* To notify the drd tool before a sem_post call. */
111 VG_USERREQ__PRE_SEM_POST,
bart0268dfa2008-03-11 20:10:21 +0000112 /* args: Addr sem */
sewardj85642922008-01-14 11:54:56 +0000113 /* To notify the drd tool after a sem_post call. */
114 VG_USERREQ__POST_SEM_POST,
bart0268dfa2008-03-11 20:10:21 +0000115 /* args: Addr sem, Bool waited */
sewardj85642922008-01-14 11:54:56 +0000116
117 /* To notify the drd tool of a pthread_barrier_init call. */
bart0268dfa2008-03-11 20:10:21 +0000118 VG_USERREQ__PRE_BARRIER_INIT,
119 /* args: Addr barrier, BarrierT type, Word count, Bool reinit */
120 /* To notify the drd tool of a pthread_barrier_init call. */
121 VG_USERREQ__POST_BARRIER_INIT,
122 /* args: Addr barrier, BarrierT type */
sewardj85642922008-01-14 11:54:56 +0000123 /* To notify the drd tool of a pthread_barrier_destroy call. */
bart0268dfa2008-03-11 20:10:21 +0000124 VG_USERREQ__PRE_BARRIER_DESTROY,
125 /* args: Addr barrier, BarrierT type. */
126 /* To notify the drd tool of a pthread_barrier_destroy call. */
127 VG_USERREQ__POST_BARRIER_DESTROY,
128 /* args: Addr barrier, BarrierT type. */
sewardj85642922008-01-14 11:54:56 +0000129 /* To notify the drd tool of a pthread_barrier_wait call. */
130 VG_USERREQ__PRE_BARRIER_WAIT,
bart0268dfa2008-03-11 20:10:21 +0000131 /* args: Addr barrier, BarrierT type. */
sewardj85642922008-01-14 11:54:56 +0000132 /* To notify the drd tool of a pthread_barrier_wait call. */
133 VG_USERREQ__POST_BARRIER_WAIT,
bart0268dfa2008-03-11 20:10:21 +0000134 /* args: Addr barrier, BarrierT type, Word has_waited */
sewardj85642922008-01-14 11:54:56 +0000135
bart00344642008-03-01 15:27:41 +0000136 /* To notify the drd tool of a pthread_rwlock_init call. */
137 VG_USERREQ__PRE_RWLOCK_INIT,
bart0268dfa2008-03-11 20:10:21 +0000138 /* args: Addr rwlock */
bart00344642008-03-01 15:27:41 +0000139 /* To notify the drd tool of a pthread_rwlock_destroy call. */
140 VG_USERREQ__POST_RWLOCK_DESTROY,
bart0268dfa2008-03-11 20:10:21 +0000141 /* args: Addr rwlock */
bart00344642008-03-01 15:27:41 +0000142 /* To notify the drd tool of a pthread_rwlock_rdlock call. */
143 VG_USERREQ__PRE_RWLOCK_RDLOCK,
bart0268dfa2008-03-11 20:10:21 +0000144 /* args: Addr rwlock */
bart00344642008-03-01 15:27:41 +0000145 /* To notify the drd tool of a pthread_rwlock_rdlock call. */
146 VG_USERREQ__POST_RWLOCK_RDLOCK,
147 /* args: Addr rwlock, Bool took_lock */
148 /* To notify the drd tool of a pthread_rwlock_wrlock call. */
149 VG_USERREQ__PRE_RWLOCK_WRLOCK,
bart0268dfa2008-03-11 20:10:21 +0000150 /* args: Addr rwlock */
bart00344642008-03-01 15:27:41 +0000151 /* To notify the drd tool of a pthread_rwlock_wrlock call. */
152 VG_USERREQ__POST_RWLOCK_WRLOCK,
153 /* args: Addr rwlock, Bool took_lock */
154 /* To notify the drd tool of a pthread_rwlock_unlock call. */
bart777f7fe2008-03-02 17:43:18 +0000155 VG_USERREQ__PRE_RWLOCK_UNLOCK,
bart0268dfa2008-03-11 20:10:21 +0000156 /* args: Addr rwlock */
157 /* To notify the drd tool of a pthread_rwlock_unlock call. */
158 VG_USERREQ__POST_RWLOCK_UNLOCK,
bart00344642008-03-01 15:27:41 +0000159 /* args: Addr rwlock, Bool unlocked */
160
sewardjaf44c822007-11-25 14:01:38 +0000161};
162
sewardj721ad7b2007-11-30 08:30:29 +0000163typedef enum
164{
bart635cb162008-02-28 08:30:43 +0000165 mutex_type_invalid_mutex = 0,
bart5357fcb2008-02-27 15:46:00 +0000166 mutex_type_recursive_mutex = 1,
167 mutex_type_errorcheck_mutex = 2,
168 mutex_type_default_mutex = 3,
169 mutex_type_spinlock = 4,
sewardj721ad7b2007-11-30 08:30:29 +0000170} MutexT;
sewardjaf44c822007-11-25 14:01:38 +0000171
bart0268dfa2008-03-11 20:10:21 +0000172typedef enum
173 {
174 pthread_barrier = 1,
175 gomp_barrier = 2,
176 } BarrierT;
sewardjaf44c822007-11-25 14:01:38 +0000177
178#endif // __DRD_CLIENTREQ_H