blob: 57bd9d13d363d763d10ebdffca90a566734f065e [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
sewardj85642922008-01-14 11:54:56 +000062 /* to notify the drd tool of a pthread_mutex_init call. */
sewardjaf44c822007-11-25 14:01:38 +000063 VG_USERREQ__PRE_MUTEX_INIT,
sewardj721ad7b2007-11-30 08:30:29 +000064 /* args: Addr, MutexT */
bart0268dfa2008-03-11 20:10:21 +000065 /* to notify the drd tool of a pthread_mutex_init call. */
66 VG_USERREQ__POST_MUTEX_INIT,
67 /* args: Addr */
68 /* to notify the drd tool of a pthread_mutex_destroy call. */
69 VG_USERREQ__PRE_MUTEX_DESTROY,
70 /* args: Addr */
sewardj85642922008-01-14 11:54:56 +000071 /* to notify the drd tool of a pthread_mutex_destroy call. */
sewardjaf44c822007-11-25 14:01:38 +000072 VG_USERREQ__POST_MUTEX_DESTROY,
bart0268dfa2008-03-11 20:10:21 +000073 /* args: Addr, MutexT */
sewardj85642922008-01-14 11:54:56 +000074 /* to notify the drd tool of pthread_mutex_lock calls */
bart0268dfa2008-03-11 20:10:21 +000075 VG_USERREQ__PRE_MUTEX_LOCK,
bart2e3a3c12008-03-24 08:33:47 +000076 /* args: Addr, MutexT, Bool */
sewardj85642922008-01-14 11:54:56 +000077 /* to notify the drd tool of pthread_mutex_lock calls */
bart0268dfa2008-03-11 20:10:21 +000078 VG_USERREQ__POST_MUTEX_LOCK,
bart00344642008-03-01 15:27:41 +000079 /* args: Addr, Bool */
sewardj85642922008-01-14 11:54:56 +000080 /* to notify the drd tool of pthread_mutex_unlock calls */
bart0268dfa2008-03-11 20:10:21 +000081 VG_USERREQ__PRE_MUTEX_UNLOCK,
82 /* args: Addr */
83 /* to notify the drd tool of pthread_mutex_unlock calls */
84 VG_USERREQ__POST_MUTEX_UNLOCK,
sewardjaf44c822007-11-25 14:01:38 +000085 /* args: Addr */
86 VG_USERREQ__SPIN_INIT_OR_UNLOCK,
bart0268dfa2008-03-11 20:10:21 +000087 /* args: Addr spinlock */
sewardjaf44c822007-11-25 14:01:38 +000088
89
sewardj85642922008-01-14 11:54:56 +000090 /* to notify the drd tool of a pthread_cond_init call. */
bart0268dfa2008-03-11 20:10:21 +000091 VG_USERREQ__PRE_COND_INIT,
sewardj721ad7b2007-11-30 08:30:29 +000092 /* args: Addr */
sewardj85642922008-01-14 11:54:56 +000093 /* to notify the drd tool of a pthread_cond_destroy call. */
bart0268dfa2008-03-11 20:10:21 +000094 VG_USERREQ__POST_COND_DESTROY,
sewardjaf44c822007-11-25 14:01:38 +000095 /* args: Addr cond */
bart0268dfa2008-03-11 20:10:21 +000096 VG_USERREQ__PRE_COND_WAIT,
97 /* args: Addr cond, Addr mutex, MutexT mt */
98 VG_USERREQ__POST_COND_WAIT,
99 /* args: Addr cond, Addr mutex, Bool took_lock*/
100 VG_USERREQ__PRE_COND_SIGNAL,
101 /* args: Addr cond */
102 VG_USERREQ__PRE_COND_BROADCAST,
sewardjaf44c822007-11-25 14:01:38 +0000103 /* args: Addr cond */
104
sewardj85642922008-01-14 11:54:56 +0000105 /* To notify the drd tool of a sem_init call. */
bart0268dfa2008-03-11 20:10:21 +0000106 VG_USERREQ__PRE_SEM_INIT,
107 /* args: Addr sem, Word pshared, Word value */
108 /* To notify the drd tool of a sem_init call. */
109 VG_USERREQ__POST_SEM_INIT,
110 /* args: Addr sem */
sewardj85642922008-01-14 11:54:56 +0000111 /* To notify the drd tool of a sem_destroy call. */
bart0268dfa2008-03-11 20:10:21 +0000112 VG_USERREQ__PRE_SEM_DESTROY,
113 /* args: Addr sem */
114 /* To notify the drd tool of a sem_destroy call. */
115 VG_USERREQ__POST_SEM_DESTROY,
sewardj85642922008-01-14 11:54:56 +0000116 /* args: Addr sem */
117 /* To notify the drd tool of a sem_wait call. */
bart28230a32008-02-29 17:27:03 +0000118 VG_USERREQ__PRE_SEM_WAIT,
bart0268dfa2008-03-11 20:10:21 +0000119 /* args: Addr sem */
bart28230a32008-02-29 17:27:03 +0000120 /* To notify the drd tool of a sem_wait call. */
121 VG_USERREQ__POST_SEM_WAIT,
122 /* args: Addr sem, Bool waited */
sewardj85642922008-01-14 11:54:56 +0000123 /* To notify the drd tool before a sem_post call. */
124 VG_USERREQ__PRE_SEM_POST,
bart0268dfa2008-03-11 20:10:21 +0000125 /* args: Addr sem */
sewardj85642922008-01-14 11:54:56 +0000126 /* To notify the drd tool after a sem_post call. */
127 VG_USERREQ__POST_SEM_POST,
bart0268dfa2008-03-11 20:10:21 +0000128 /* args: Addr sem, Bool waited */
sewardj85642922008-01-14 11:54:56 +0000129
130 /* To notify the drd tool of a pthread_barrier_init call. */
bart0268dfa2008-03-11 20:10:21 +0000131 VG_USERREQ__PRE_BARRIER_INIT,
132 /* args: Addr barrier, BarrierT type, Word count, Bool reinit */
133 /* To notify the drd tool of a pthread_barrier_init call. */
134 VG_USERREQ__POST_BARRIER_INIT,
135 /* args: Addr barrier, BarrierT type */
sewardj85642922008-01-14 11:54:56 +0000136 /* To notify the drd tool of a pthread_barrier_destroy call. */
bart0268dfa2008-03-11 20:10:21 +0000137 VG_USERREQ__PRE_BARRIER_DESTROY,
138 /* args: Addr barrier, BarrierT type. */
139 /* To notify the drd tool of a pthread_barrier_destroy call. */
140 VG_USERREQ__POST_BARRIER_DESTROY,
141 /* args: Addr barrier, BarrierT type. */
sewardj85642922008-01-14 11:54:56 +0000142 /* To notify the drd tool of a pthread_barrier_wait call. */
143 VG_USERREQ__PRE_BARRIER_WAIT,
bart0268dfa2008-03-11 20:10:21 +0000144 /* args: Addr barrier, BarrierT type. */
sewardj85642922008-01-14 11:54:56 +0000145 /* To notify the drd tool of a pthread_barrier_wait call. */
146 VG_USERREQ__POST_BARRIER_WAIT,
bart0268dfa2008-03-11 20:10:21 +0000147 /* args: Addr barrier, BarrierT type, Word has_waited */
sewardj85642922008-01-14 11:54:56 +0000148
bart00344642008-03-01 15:27:41 +0000149 /* To notify the drd tool of a pthread_rwlock_init call. */
150 VG_USERREQ__PRE_RWLOCK_INIT,
bart0268dfa2008-03-11 20:10:21 +0000151 /* args: Addr rwlock */
bart00344642008-03-01 15:27:41 +0000152 /* To notify the drd tool of a pthread_rwlock_destroy call. */
153 VG_USERREQ__POST_RWLOCK_DESTROY,
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_rdlock call. */
156 VG_USERREQ__PRE_RWLOCK_RDLOCK,
bart0268dfa2008-03-11 20:10:21 +0000157 /* args: Addr rwlock */
bart00344642008-03-01 15:27:41 +0000158 /* To notify the drd tool of a pthread_rwlock_rdlock call. */
159 VG_USERREQ__POST_RWLOCK_RDLOCK,
160 /* args: Addr rwlock, Bool took_lock */
161 /* To notify the drd tool of a pthread_rwlock_wrlock call. */
162 VG_USERREQ__PRE_RWLOCK_WRLOCK,
bart0268dfa2008-03-11 20:10:21 +0000163 /* args: Addr rwlock */
bart00344642008-03-01 15:27:41 +0000164 /* To notify the drd tool of a pthread_rwlock_wrlock call. */
165 VG_USERREQ__POST_RWLOCK_WRLOCK,
166 /* args: Addr rwlock, Bool took_lock */
167 /* To notify the drd tool of a pthread_rwlock_unlock call. */
bart777f7fe2008-03-02 17:43:18 +0000168 VG_USERREQ__PRE_RWLOCK_UNLOCK,
bart0268dfa2008-03-11 20:10:21 +0000169 /* args: Addr rwlock */
170 /* To notify the drd tool of a pthread_rwlock_unlock call. */
bartd00bd222008-03-30 08:40:49 +0000171 VG_USERREQ__POST_RWLOCK_UNLOCK
bart00344642008-03-01 15:27:41 +0000172 /* args: Addr rwlock, Bool unlocked */
173
sewardjaf44c822007-11-25 14:01:38 +0000174};
175
sewardj721ad7b2007-11-30 08:30:29 +0000176typedef enum
177{
bart635cb162008-02-28 08:30:43 +0000178 mutex_type_invalid_mutex = 0,
bart5357fcb2008-02-27 15:46:00 +0000179 mutex_type_recursive_mutex = 1,
180 mutex_type_errorcheck_mutex = 2,
181 mutex_type_default_mutex = 3,
bartd00bd222008-03-30 08:40:49 +0000182 mutex_type_spinlock = 4
sewardj721ad7b2007-11-30 08:30:29 +0000183} MutexT;
sewardjaf44c822007-11-25 14:01:38 +0000184
bart0268dfa2008-03-11 20:10:21 +0000185typedef enum
186 {
187 pthread_barrier = 1,
bartd00bd222008-03-30 08:40:49 +0000188 gomp_barrier = 2
bart0268dfa2008-03-11 20:10:21 +0000189 } BarrierT;
sewardjaf44c822007-11-25 14:01:38 +0000190
bart5f57be92008-07-01 08:48:56 +0000191void drd_clientreq_init(void);
192
bart3c1e9d82008-06-30 17:10:29 +0000193
sewardjaf44c822007-11-25 14:01:38 +0000194#endif // __DRD_CLIENTREQ_H