blob: 3d06e71598f9b1904b1ebb454fea634f3146e2e8 [file] [log] [blame]
bart5f57be92008-07-01 08:48:56 +00001/*
2 This file is part of drd, a data race detector.
3
4 Copyright (C) 2006-2008 Bart Van Assche
5 bart.vanassche@gmail.com
6
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License as
9 published by the Free Software Foundation; either version 2 of the
10 License, or (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
20 02111-1307, USA.
21
22 The GNU General Public License is contained in the file COPYING.
23*/
24
25
sewardjaf44c822007-11-25 14:01:38 +000026#ifndef __DRD_CLIENTREQ_H
27#define __DRD_CLIENTREQ_H
28
29
bart3c1e9d82008-06-30 17:10:29 +000030#include "drd.h"
bartd00bd222008-03-30 08:40:49 +000031
32
sewardjaf44c822007-11-25 14:01:38 +000033enum {
sewardjaf44c822007-11-25 14:01:38 +000034 /* Ask drd to suppress data race reports on all currently allocated stack */
35 /* data of the current thread. */
bart3c1e9d82008-06-30 17:10:29 +000036 VG_USERREQ__DRD_SUPPRESS_CURRENT_STACK = VG_USERREQ_TOOL_BASE('D', 'r'),
sewardjaf44c822007-11-25 14:01:38 +000037 /* args: none */
38 /* To ask the drd tool to start a new segment in the specified thread. */
39 VG_USERREQ__DRD_START_NEW_SEGMENT,
40 /* args: POSIX thread ID. */
bartbf3a60c2008-04-04 19:10:21 +000041 /* Let the drd tool stop recording memory accesses in the calling thread. */
42 VG_USERREQ__DRD_STOP_RECORDING,
43 /* args: none. */
44 /* Let the drd tool start recording memory accesses in the calling thread. */
45 VG_USERREQ__DRD_START_RECORDING,
46 /* args: none. */
sewardjaf44c822007-11-25 14:01:38 +000047
sewardjaf44c822007-11-25 14:01:38 +000048 /* Tell the core the pthread_t of the running thread */
49 VG_USERREQ__SET_PTHREADID,
50 /* args: pthread_t. */
51 /* Ask the core that a the thread's state transition from */
52 /* VgTs_Zombie to VgTs_Empty is delayed until */
53 /* VG_USERREQ__POST_THREAD_JOIN is performed. */
54 VG_USERREQ__SET_JOINABLE,
55 /* args: pthread_t, Bool */
56
57 /* To notify drd that a thread finished because */
58 /* pthread_thread_join() was called on it. */
59 VG_USERREQ__POST_THREAD_JOIN,
60 /* args: pthread_t (joinee) */
61
bart0f099cd2008-09-27 12:36:48 +000062 /* To notify drd before a pthread_cancel call. */
63 VG_USERREQ__PRE_THREAD_CANCEL,
64 /* args: pthread_t */
65 /* To notify drd after a pthread_cancel call. */
66 VG_USERREQ__POST_THREAD_CANCEL,
67 /* args: pthread_t, Bool */
68
sewardj85642922008-01-14 11:54:56 +000069 /* to notify the drd tool of a pthread_mutex_init call. */
sewardjaf44c822007-11-25 14:01:38 +000070 VG_USERREQ__PRE_MUTEX_INIT,
sewardj721ad7b2007-11-30 08:30:29 +000071 /* args: Addr, MutexT */
bart0268dfa2008-03-11 20:10:21 +000072 /* to notify the drd tool of a pthread_mutex_init call. */
73 VG_USERREQ__POST_MUTEX_INIT,
74 /* args: Addr */
75 /* to notify the drd tool of a pthread_mutex_destroy call. */
76 VG_USERREQ__PRE_MUTEX_DESTROY,
77 /* args: Addr */
sewardj85642922008-01-14 11:54:56 +000078 /* to notify the drd tool of a pthread_mutex_destroy call. */
sewardjaf44c822007-11-25 14:01:38 +000079 VG_USERREQ__POST_MUTEX_DESTROY,
bart0268dfa2008-03-11 20:10:21 +000080 /* args: Addr, MutexT */
sewardj85642922008-01-14 11:54:56 +000081 /* to notify the drd tool of pthread_mutex_lock calls */
bart0268dfa2008-03-11 20:10:21 +000082 VG_USERREQ__PRE_MUTEX_LOCK,
bart2e3a3c12008-03-24 08:33:47 +000083 /* args: Addr, MutexT, Bool */
sewardj85642922008-01-14 11:54:56 +000084 /* to notify the drd tool of pthread_mutex_lock calls */
bart0268dfa2008-03-11 20:10:21 +000085 VG_USERREQ__POST_MUTEX_LOCK,
bart00344642008-03-01 15:27:41 +000086 /* args: Addr, Bool */
sewardj85642922008-01-14 11:54:56 +000087 /* to notify the drd tool of pthread_mutex_unlock calls */
bart0268dfa2008-03-11 20:10:21 +000088 VG_USERREQ__PRE_MUTEX_UNLOCK,
89 /* args: Addr */
90 /* to notify the drd tool of pthread_mutex_unlock calls */
91 VG_USERREQ__POST_MUTEX_UNLOCK,
sewardjaf44c822007-11-25 14:01:38 +000092 /* args: Addr */
bartf4f05812008-07-07 08:10:56 +000093 /* to notify the drd tool of a pthread_spin_init/pthread_spin_unlock call */
94 VG_USERREQ__PRE_SPIN_INIT_OR_UNLOCK,
95 /* args: Addr */
96 /* to notify the drd tool of a pthread_spin_init/pthread_spin_unlock call */
97 VG_USERREQ__POST_SPIN_INIT_OR_UNLOCK,
98 /* args: Addr */
sewardjaf44c822007-11-25 14:01:38 +000099
100
sewardj85642922008-01-14 11:54:56 +0000101 /* to notify the drd tool of a pthread_cond_init call. */
bart0268dfa2008-03-11 20:10:21 +0000102 VG_USERREQ__PRE_COND_INIT,
sewardj721ad7b2007-11-30 08:30:29 +0000103 /* args: Addr */
bart3f4623e2008-07-07 16:53:07 +0000104 /* to notify the drd tool of a pthread_cond_init call. */
105 VG_USERREQ__POST_COND_INIT,
106 /* args: Addr */
107 /* to notify the drd tool of a pthread_cond_destroy call. */
108 VG_USERREQ__PRE_COND_DESTROY,
109 /* args: Addr */
sewardj85642922008-01-14 11:54:56 +0000110 /* to notify the drd tool of a pthread_cond_destroy call. */
bart0268dfa2008-03-11 20:10:21 +0000111 VG_USERREQ__POST_COND_DESTROY,
bart3f4623e2008-07-07 16:53:07 +0000112 /* args: Addr */
bart0268dfa2008-03-11 20:10:21 +0000113 VG_USERREQ__PRE_COND_WAIT,
114 /* args: Addr cond, Addr mutex, MutexT mt */
115 VG_USERREQ__POST_COND_WAIT,
116 /* args: Addr cond, Addr mutex, Bool took_lock*/
117 VG_USERREQ__PRE_COND_SIGNAL,
118 /* args: Addr cond */
bart3f4623e2008-07-07 16:53:07 +0000119 VG_USERREQ__POST_COND_SIGNAL,
120 /* args: Addr cond */
bart0268dfa2008-03-11 20:10:21 +0000121 VG_USERREQ__PRE_COND_BROADCAST,
sewardjaf44c822007-11-25 14:01:38 +0000122 /* args: Addr cond */
bart3f4623e2008-07-07 16:53:07 +0000123 VG_USERREQ__POST_COND_BROADCAST,
124 /* args: Addr cond */
sewardjaf44c822007-11-25 14:01:38 +0000125
sewardj85642922008-01-14 11:54:56 +0000126 /* To notify the drd tool of a sem_init call. */
bart0268dfa2008-03-11 20:10:21 +0000127 VG_USERREQ__PRE_SEM_INIT,
128 /* args: Addr sem, Word pshared, Word value */
129 /* To notify the drd tool of a sem_init call. */
130 VG_USERREQ__POST_SEM_INIT,
131 /* args: Addr sem */
sewardj85642922008-01-14 11:54:56 +0000132 /* To notify the drd tool of a sem_destroy call. */
bart0268dfa2008-03-11 20:10:21 +0000133 VG_USERREQ__PRE_SEM_DESTROY,
134 /* args: Addr sem */
135 /* To notify the drd tool of a sem_destroy call. */
136 VG_USERREQ__POST_SEM_DESTROY,
sewardj85642922008-01-14 11:54:56 +0000137 /* args: Addr sem */
138 /* To notify the drd tool of a sem_wait call. */
bart28230a32008-02-29 17:27:03 +0000139 VG_USERREQ__PRE_SEM_WAIT,
bart0268dfa2008-03-11 20:10:21 +0000140 /* args: Addr sem */
bart28230a32008-02-29 17:27:03 +0000141 /* To notify the drd tool of a sem_wait call. */
142 VG_USERREQ__POST_SEM_WAIT,
143 /* args: Addr sem, Bool waited */
sewardj85642922008-01-14 11:54:56 +0000144 /* To notify the drd tool before a sem_post call. */
145 VG_USERREQ__PRE_SEM_POST,
bart0268dfa2008-03-11 20:10:21 +0000146 /* args: Addr sem */
sewardj85642922008-01-14 11:54:56 +0000147 /* To notify the drd tool after a sem_post call. */
148 VG_USERREQ__POST_SEM_POST,
bart0268dfa2008-03-11 20:10:21 +0000149 /* args: Addr sem, Bool waited */
sewardj85642922008-01-14 11:54:56 +0000150
151 /* To notify the drd tool of a pthread_barrier_init call. */
bart0268dfa2008-03-11 20:10:21 +0000152 VG_USERREQ__PRE_BARRIER_INIT,
153 /* args: Addr barrier, BarrierT type, Word count, Bool reinit */
154 /* To notify the drd tool of a pthread_barrier_init call. */
155 VG_USERREQ__POST_BARRIER_INIT,
156 /* args: Addr barrier, BarrierT type */
sewardj85642922008-01-14 11:54:56 +0000157 /* To notify the drd tool of a pthread_barrier_destroy call. */
bart0268dfa2008-03-11 20:10:21 +0000158 VG_USERREQ__PRE_BARRIER_DESTROY,
159 /* args: Addr barrier, BarrierT type. */
160 /* To notify the drd tool of a pthread_barrier_destroy call. */
161 VG_USERREQ__POST_BARRIER_DESTROY,
162 /* args: Addr barrier, BarrierT type. */
sewardj85642922008-01-14 11:54:56 +0000163 /* To notify the drd tool of a pthread_barrier_wait call. */
164 VG_USERREQ__PRE_BARRIER_WAIT,
bart0268dfa2008-03-11 20:10:21 +0000165 /* args: Addr barrier, BarrierT type. */
sewardj85642922008-01-14 11:54:56 +0000166 /* To notify the drd tool of a pthread_barrier_wait call. */
167 VG_USERREQ__POST_BARRIER_WAIT,
bart0268dfa2008-03-11 20:10:21 +0000168 /* args: Addr barrier, BarrierT type, Word has_waited */
sewardj85642922008-01-14 11:54:56 +0000169
bart00344642008-03-01 15:27:41 +0000170 /* To notify the drd tool of a pthread_rwlock_init call. */
171 VG_USERREQ__PRE_RWLOCK_INIT,
bart0268dfa2008-03-11 20:10:21 +0000172 /* args: Addr rwlock */
bart00344642008-03-01 15:27:41 +0000173 /* To notify the drd tool of a pthread_rwlock_destroy call. */
174 VG_USERREQ__POST_RWLOCK_DESTROY,
bart0268dfa2008-03-11 20:10:21 +0000175 /* args: Addr rwlock */
bart00344642008-03-01 15:27:41 +0000176 /* To notify the drd tool of a pthread_rwlock_rdlock call. */
177 VG_USERREQ__PRE_RWLOCK_RDLOCK,
bart0268dfa2008-03-11 20:10:21 +0000178 /* args: Addr rwlock */
bart00344642008-03-01 15:27:41 +0000179 /* To notify the drd tool of a pthread_rwlock_rdlock call. */
180 VG_USERREQ__POST_RWLOCK_RDLOCK,
181 /* args: Addr rwlock, Bool took_lock */
182 /* To notify the drd tool of a pthread_rwlock_wrlock call. */
183 VG_USERREQ__PRE_RWLOCK_WRLOCK,
bart0268dfa2008-03-11 20:10:21 +0000184 /* args: Addr rwlock */
bart00344642008-03-01 15:27:41 +0000185 /* To notify the drd tool of a pthread_rwlock_wrlock call. */
186 VG_USERREQ__POST_RWLOCK_WRLOCK,
187 /* args: Addr rwlock, Bool took_lock */
188 /* To notify the drd tool of a pthread_rwlock_unlock call. */
bart777f7fe2008-03-02 17:43:18 +0000189 VG_USERREQ__PRE_RWLOCK_UNLOCK,
bart0268dfa2008-03-11 20:10:21 +0000190 /* args: Addr rwlock */
191 /* To notify the drd tool of a pthread_rwlock_unlock call. */
bartd00bd222008-03-30 08:40:49 +0000192 VG_USERREQ__POST_RWLOCK_UNLOCK
bart00344642008-03-01 15:27:41 +0000193 /* args: Addr rwlock, Bool unlocked */
194
sewardjaf44c822007-11-25 14:01:38 +0000195};
196
sewardj721ad7b2007-11-30 08:30:29 +0000197typedef enum
198{
bart3f4623e2008-07-07 16:53:07 +0000199 mutex_type_unknown = -1,
200 mutex_type_invalid_mutex = 0,
201 mutex_type_recursive_mutex = 1,
202 mutex_type_errorcheck_mutex = 2,
203 mutex_type_default_mutex = 3,
204 mutex_type_spinlock = 4
sewardj721ad7b2007-11-30 08:30:29 +0000205} MutexT;
sewardjaf44c822007-11-25 14:01:38 +0000206
bart0268dfa2008-03-11 20:10:21 +0000207typedef enum
208 {
209 pthread_barrier = 1,
bartd00bd222008-03-30 08:40:49 +0000210 gomp_barrier = 2
bart0268dfa2008-03-11 20:10:21 +0000211 } BarrierT;
sewardjaf44c822007-11-25 14:01:38 +0000212
bart5f57be92008-07-01 08:48:56 +0000213void drd_clientreq_init(void);
214
bart3c1e9d82008-06-30 17:10:29 +0000215
sewardjaf44c822007-11-25 14:01:38 +0000216#endif // __DRD_CLIENTREQ_H