sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 1 | #ifndef __DRD_CLIENTREQ_H |
| 2 | #define __DRD_CLIENTREQ_H |
| 3 | |
| 4 | |
| 5 | #include "valgrind.h" // VG_USERREQ_TOOL_BASE() |
| 6 | |
| 7 | |
bart | d00bd22 | 2008-03-30 08:40:49 +0000 | [diff] [blame] | 8 | #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 | |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 12 | enum { |
| 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. */ |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 16 | |
| 17 | /* To tell the drd tool to suppress data race detection on the specified */ |
| 18 | /* address range. */ |
| 19 | VG_USERREQ__DRD_START_SUPPRESSION, |
bart | f5bb46a | 2008-03-29 13:18:02 +0000 | [diff] [blame] | 20 | /* args: start address, size in bytes */ |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 21 | /* To tell the drd tool no longer to suppress data race detection on the */ |
| 22 | /* specified address range. */ |
| 23 | VG_USERREQ__DRD_FINISH_SUPPRESSION, |
bart | f5bb46a | 2008-03-29 13:18:02 +0000 | [diff] [blame] | 24 | /* args: start address, size in bytes */ |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 25 | /* 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. */ |
bart | 005dc97 | 2008-03-29 14:42:59 +0000 | [diff] [blame] | 32 | /* 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. */ |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 38 | |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 39 | /* 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 | |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 53 | /* to notify the drd tool of a pthread_mutex_init call. */ |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 54 | VG_USERREQ__PRE_MUTEX_INIT, |
sewardj | 721ad7b | 2007-11-30 08:30:29 +0000 | [diff] [blame] | 55 | /* args: Addr, MutexT */ |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 56 | /* 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 */ |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 62 | /* to notify the drd tool of a pthread_mutex_destroy call. */ |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 63 | VG_USERREQ__POST_MUTEX_DESTROY, |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 64 | /* args: Addr, MutexT */ |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 65 | /* to notify the drd tool of pthread_mutex_lock calls */ |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 66 | VG_USERREQ__PRE_MUTEX_LOCK, |
bart | 2e3a3c1 | 2008-03-24 08:33:47 +0000 | [diff] [blame] | 67 | /* args: Addr, MutexT, Bool */ |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 68 | /* to notify the drd tool of pthread_mutex_lock calls */ |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 69 | VG_USERREQ__POST_MUTEX_LOCK, |
bart | 0034464 | 2008-03-01 15:27:41 +0000 | [diff] [blame] | 70 | /* args: Addr, Bool */ |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 71 | /* to notify the drd tool of pthread_mutex_unlock calls */ |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 72 | 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, |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 76 | /* args: Addr */ |
| 77 | VG_USERREQ__SPIN_INIT_OR_UNLOCK, |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 78 | /* args: Addr spinlock */ |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 79 | |
| 80 | |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 81 | /* to notify the drd tool of a pthread_cond_init call. */ |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 82 | VG_USERREQ__PRE_COND_INIT, |
sewardj | 721ad7b | 2007-11-30 08:30:29 +0000 | [diff] [blame] | 83 | /* args: Addr */ |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 84 | /* to notify the drd tool of a pthread_cond_destroy call. */ |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 85 | VG_USERREQ__POST_COND_DESTROY, |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 86 | /* args: Addr cond */ |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 87 | 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, |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 94 | /* args: Addr cond */ |
| 95 | |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 96 | /* To notify the drd tool of a sem_init call. */ |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 97 | 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 */ |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 102 | /* To notify the drd tool of a sem_destroy call. */ |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 103 | 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, |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 107 | /* args: Addr sem */ |
| 108 | /* To notify the drd tool of a sem_wait call. */ |
bart | 28230a3 | 2008-02-29 17:27:03 +0000 | [diff] [blame] | 109 | VG_USERREQ__PRE_SEM_WAIT, |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 110 | /* args: Addr sem */ |
bart | 28230a3 | 2008-02-29 17:27:03 +0000 | [diff] [blame] | 111 | /* To notify the drd tool of a sem_wait call. */ |
| 112 | VG_USERREQ__POST_SEM_WAIT, |
| 113 | /* args: Addr sem, Bool waited */ |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 114 | /* To notify the drd tool before a sem_post call. */ |
| 115 | VG_USERREQ__PRE_SEM_POST, |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 116 | /* args: Addr sem */ |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 117 | /* To notify the drd tool after a sem_post call. */ |
| 118 | VG_USERREQ__POST_SEM_POST, |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 119 | /* args: Addr sem, Bool waited */ |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 120 | |
| 121 | /* To notify the drd tool of a pthread_barrier_init call. */ |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 122 | 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 */ |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 127 | /* To notify the drd tool of a pthread_barrier_destroy call. */ |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 128 | 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. */ |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 133 | /* To notify the drd tool of a pthread_barrier_wait call. */ |
| 134 | VG_USERREQ__PRE_BARRIER_WAIT, |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 135 | /* args: Addr barrier, BarrierT type. */ |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 136 | /* To notify the drd tool of a pthread_barrier_wait call. */ |
| 137 | VG_USERREQ__POST_BARRIER_WAIT, |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 138 | /* args: Addr barrier, BarrierT type, Word has_waited */ |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 139 | |
bart | 0034464 | 2008-03-01 15:27:41 +0000 | [diff] [blame] | 140 | /* To notify the drd tool of a pthread_rwlock_init call. */ |
| 141 | VG_USERREQ__PRE_RWLOCK_INIT, |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 142 | /* args: Addr rwlock */ |
bart | 0034464 | 2008-03-01 15:27:41 +0000 | [diff] [blame] | 143 | /* To notify the drd tool of a pthread_rwlock_destroy call. */ |
| 144 | VG_USERREQ__POST_RWLOCK_DESTROY, |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 145 | /* args: Addr rwlock */ |
bart | 0034464 | 2008-03-01 15:27:41 +0000 | [diff] [blame] | 146 | /* To notify the drd tool of a pthread_rwlock_rdlock call. */ |
| 147 | VG_USERREQ__PRE_RWLOCK_RDLOCK, |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 148 | /* args: Addr rwlock */ |
bart | 0034464 | 2008-03-01 15:27:41 +0000 | [diff] [blame] | 149 | /* 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, |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 154 | /* args: Addr rwlock */ |
bart | 0034464 | 2008-03-01 15:27:41 +0000 | [diff] [blame] | 155 | /* 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. */ |
bart | 777f7fe | 2008-03-02 17:43:18 +0000 | [diff] [blame] | 159 | VG_USERREQ__PRE_RWLOCK_UNLOCK, |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 160 | /* args: Addr rwlock */ |
| 161 | /* To notify the drd tool of a pthread_rwlock_unlock call. */ |
bart | d00bd22 | 2008-03-30 08:40:49 +0000 | [diff] [blame] | 162 | VG_USERREQ__POST_RWLOCK_UNLOCK |
bart | 0034464 | 2008-03-01 15:27:41 +0000 | [diff] [blame] | 163 | /* args: Addr rwlock, Bool unlocked */ |
| 164 | |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 165 | }; |
| 166 | |
sewardj | 721ad7b | 2007-11-30 08:30:29 +0000 | [diff] [blame] | 167 | typedef enum |
| 168 | { |
bart | 635cb16 | 2008-02-28 08:30:43 +0000 | [diff] [blame] | 169 | mutex_type_invalid_mutex = 0, |
bart | 5357fcb | 2008-02-27 15:46:00 +0000 | [diff] [blame] | 170 | mutex_type_recursive_mutex = 1, |
| 171 | mutex_type_errorcheck_mutex = 2, |
| 172 | mutex_type_default_mutex = 3, |
bart | d00bd22 | 2008-03-30 08:40:49 +0000 | [diff] [blame] | 173 | mutex_type_spinlock = 4 |
sewardj | 721ad7b | 2007-11-30 08:30:29 +0000 | [diff] [blame] | 174 | } MutexT; |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 175 | |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 176 | typedef enum |
| 177 | { |
| 178 | pthread_barrier = 1, |
bart | d00bd22 | 2008-03-30 08:40:49 +0000 | [diff] [blame] | 179 | gomp_barrier = 2 |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 180 | } BarrierT; |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 181 | |
| 182 | #endif // __DRD_CLIENTREQ_H |