blob: 8d421d65145d5ea0cac3cbe52a57746372363060 [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,
bart5e85d262008-03-01 10:49:37 +000016 /* args: start address, end address */
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,
bart5e85d262008-03-01 10:49:37 +000020 /* args: start address, end address */
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. */
bart5bd9f2d2008-03-03 20:31:58 +000028 /* To ask the drd tool to trace all accesses to the specified address. */
29 VG_USERREQ__DRD_TRACE_ADDR,
30 /* args: Addr. */
sewardjaf44c822007-11-25 14:01:38 +000031
sewardjaf44c822007-11-25 14:01:38 +000032 /* Tell the core the pthread_t of the running thread */
33 VG_USERREQ__SET_PTHREADID,
34 /* args: pthread_t. */
35 /* Ask the core that a the thread's state transition from */
36 /* VgTs_Zombie to VgTs_Empty is delayed until */
37 /* VG_USERREQ__POST_THREAD_JOIN is performed. */
38 VG_USERREQ__SET_JOINABLE,
39 /* args: pthread_t, Bool */
40
41 /* To notify drd that a thread finished because */
42 /* pthread_thread_join() was called on it. */
43 VG_USERREQ__POST_THREAD_JOIN,
44 /* args: pthread_t (joinee) */
45
sewardj85642922008-01-14 11:54:56 +000046 /* to notify the drd tool of a pthread_mutex_init call. */
sewardjaf44c822007-11-25 14:01:38 +000047 VG_USERREQ__PRE_MUTEX_INIT,
sewardj721ad7b2007-11-30 08:30:29 +000048 /* args: Addr, MutexT */
bart0268dfa2008-03-11 20:10:21 +000049 /* to notify the drd tool of a pthread_mutex_init call. */
50 VG_USERREQ__POST_MUTEX_INIT,
51 /* args: Addr */
52 /* to notify the drd tool of a pthread_mutex_destroy call. */
53 VG_USERREQ__PRE_MUTEX_DESTROY,
54 /* args: Addr */
sewardj85642922008-01-14 11:54:56 +000055 /* to notify the drd tool of a pthread_mutex_destroy call. */
sewardjaf44c822007-11-25 14:01:38 +000056 VG_USERREQ__POST_MUTEX_DESTROY,
bart0268dfa2008-03-11 20:10:21 +000057 /* args: Addr, MutexT */
sewardj85642922008-01-14 11:54:56 +000058 /* to notify the drd tool of pthread_mutex_lock calls */
bart0268dfa2008-03-11 20:10:21 +000059 VG_USERREQ__PRE_MUTEX_LOCK,
60 /* 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__POST_MUTEX_LOCK,
bart00344642008-03-01 15:27:41 +000063 /* args: Addr, Bool */
sewardj85642922008-01-14 11:54:56 +000064 /* to notify the drd tool of pthread_mutex_unlock calls */
bart0268dfa2008-03-11 20:10:21 +000065 VG_USERREQ__PRE_MUTEX_UNLOCK,
66 /* args: Addr */
67 /* to notify the drd tool of pthread_mutex_unlock calls */
68 VG_USERREQ__POST_MUTEX_UNLOCK,
sewardjaf44c822007-11-25 14:01:38 +000069 /* args: Addr */
70 VG_USERREQ__SPIN_INIT_OR_UNLOCK,
bart0268dfa2008-03-11 20:10:21 +000071 /* args: Addr spinlock */
sewardjaf44c822007-11-25 14:01:38 +000072
73
sewardj85642922008-01-14 11:54:56 +000074 /* to notify the drd tool of a pthread_cond_init call. */
bart0268dfa2008-03-11 20:10:21 +000075 VG_USERREQ__PRE_COND_INIT,
sewardj721ad7b2007-11-30 08:30:29 +000076 /* args: Addr */
sewardj85642922008-01-14 11:54:56 +000077 /* to notify the drd tool of a pthread_cond_destroy call. */
bart0268dfa2008-03-11 20:10:21 +000078 VG_USERREQ__POST_COND_DESTROY,
sewardjaf44c822007-11-25 14:01:38 +000079 /* args: Addr cond */
bart0268dfa2008-03-11 20:10:21 +000080 VG_USERREQ__PRE_COND_WAIT,
81 /* args: Addr cond, Addr mutex, MutexT mt */
82 VG_USERREQ__POST_COND_WAIT,
83 /* args: Addr cond, Addr mutex, Bool took_lock*/
84 VG_USERREQ__PRE_COND_SIGNAL,
85 /* args: Addr cond */
86 VG_USERREQ__PRE_COND_BROADCAST,
sewardjaf44c822007-11-25 14:01:38 +000087 /* args: Addr cond */
88
sewardj85642922008-01-14 11:54:56 +000089 /* To notify the drd tool of a sem_init call. */
bart0268dfa2008-03-11 20:10:21 +000090 VG_USERREQ__PRE_SEM_INIT,
91 /* args: Addr sem, Word pshared, Word value */
92 /* To notify the drd tool of a sem_init call. */
93 VG_USERREQ__POST_SEM_INIT,
94 /* args: Addr sem */
sewardj85642922008-01-14 11:54:56 +000095 /* To notify the drd tool of a sem_destroy call. */
bart0268dfa2008-03-11 20:10:21 +000096 VG_USERREQ__PRE_SEM_DESTROY,
97 /* args: Addr sem */
98 /* To notify the drd tool of a sem_destroy call. */
99 VG_USERREQ__POST_SEM_DESTROY,
sewardj85642922008-01-14 11:54:56 +0000100 /* args: Addr sem */
101 /* To notify the drd tool of a sem_wait call. */
bart28230a32008-02-29 17:27:03 +0000102 VG_USERREQ__PRE_SEM_WAIT,
bart0268dfa2008-03-11 20:10:21 +0000103 /* args: Addr sem */
bart28230a32008-02-29 17:27:03 +0000104 /* To notify the drd tool of a sem_wait call. */
105 VG_USERREQ__POST_SEM_WAIT,
106 /* args: Addr sem, Bool waited */
sewardj85642922008-01-14 11:54:56 +0000107 /* To notify the drd tool before a sem_post call. */
108 VG_USERREQ__PRE_SEM_POST,
bart0268dfa2008-03-11 20:10:21 +0000109 /* args: Addr sem */
sewardj85642922008-01-14 11:54:56 +0000110 /* To notify the drd tool after a sem_post call. */
111 VG_USERREQ__POST_SEM_POST,
bart0268dfa2008-03-11 20:10:21 +0000112 /* args: Addr sem, Bool waited */
sewardj85642922008-01-14 11:54:56 +0000113
114 /* To notify the drd tool of a pthread_barrier_init call. */
bart0268dfa2008-03-11 20:10:21 +0000115 VG_USERREQ__PRE_BARRIER_INIT,
116 /* args: Addr barrier, BarrierT type, Word count, Bool reinit */
117 /* To notify the drd tool of a pthread_barrier_init call. */
118 VG_USERREQ__POST_BARRIER_INIT,
119 /* args: Addr barrier, BarrierT type */
sewardj85642922008-01-14 11:54:56 +0000120 /* To notify the drd tool of a pthread_barrier_destroy call. */
bart0268dfa2008-03-11 20:10:21 +0000121 VG_USERREQ__PRE_BARRIER_DESTROY,
122 /* args: Addr barrier, BarrierT type. */
123 /* To notify the drd tool of a pthread_barrier_destroy call. */
124 VG_USERREQ__POST_BARRIER_DESTROY,
125 /* args: Addr barrier, BarrierT type. */
sewardj85642922008-01-14 11:54:56 +0000126 /* To notify the drd tool of a pthread_barrier_wait call. */
127 VG_USERREQ__PRE_BARRIER_WAIT,
bart0268dfa2008-03-11 20:10:21 +0000128 /* 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__POST_BARRIER_WAIT,
bart0268dfa2008-03-11 20:10:21 +0000131 /* args: Addr barrier, BarrierT type, Word has_waited */
sewardj85642922008-01-14 11:54:56 +0000132
bart00344642008-03-01 15:27:41 +0000133 /* To notify the drd tool of a pthread_rwlock_init call. */
134 VG_USERREQ__PRE_RWLOCK_INIT,
bart0268dfa2008-03-11 20:10:21 +0000135 /* args: Addr rwlock */
bart00344642008-03-01 15:27:41 +0000136 /* To notify the drd tool of a pthread_rwlock_destroy call. */
137 VG_USERREQ__POST_RWLOCK_DESTROY,
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_rdlock call. */
140 VG_USERREQ__PRE_RWLOCK_RDLOCK,
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__POST_RWLOCK_RDLOCK,
144 /* args: Addr rwlock, Bool took_lock */
145 /* To notify the drd tool of a pthread_rwlock_wrlock call. */
146 VG_USERREQ__PRE_RWLOCK_WRLOCK,
bart0268dfa2008-03-11 20:10:21 +0000147 /* args: Addr rwlock */
bart00344642008-03-01 15:27:41 +0000148 /* To notify the drd tool of a pthread_rwlock_wrlock call. */
149 VG_USERREQ__POST_RWLOCK_WRLOCK,
150 /* args: Addr rwlock, Bool took_lock */
151 /* To notify the drd tool of a pthread_rwlock_unlock call. */
bart777f7fe2008-03-02 17:43:18 +0000152 VG_USERREQ__PRE_RWLOCK_UNLOCK,
bart0268dfa2008-03-11 20:10:21 +0000153 /* args: Addr rwlock */
154 /* To notify the drd tool of a pthread_rwlock_unlock call. */
155 VG_USERREQ__POST_RWLOCK_UNLOCK,
bart00344642008-03-01 15:27:41 +0000156 /* args: Addr rwlock, Bool unlocked */
157
sewardjaf44c822007-11-25 14:01:38 +0000158};
159
sewardj721ad7b2007-11-30 08:30:29 +0000160typedef enum
161{
bart635cb162008-02-28 08:30:43 +0000162 mutex_type_invalid_mutex = 0,
bart5357fcb2008-02-27 15:46:00 +0000163 mutex_type_recursive_mutex = 1,
164 mutex_type_errorcheck_mutex = 2,
165 mutex_type_default_mutex = 3,
166 mutex_type_spinlock = 4,
sewardj721ad7b2007-11-30 08:30:29 +0000167} MutexT;
sewardjaf44c822007-11-25 14:01:38 +0000168
bart0268dfa2008-03-11 20:10:21 +0000169typedef enum
170 {
171 pthread_barrier = 1,
172 gomp_barrier = 2,
173 } BarrierT;
sewardjaf44c822007-11-25 14:01:38 +0000174
175#endif // __DRD_CLIENTREQ_H