108
108
/* Mark memory at _qzz_addr as unaddressable for _qzz_len bytes. */
109
109
#define VALGRIND_MAKE_MEM_NOACCESS(_qzz_addr,_qzz_len) \
110
(__extension__({unsigned long _qzz_res; \
111
VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0 /* default return */, \
110
VALGRIND_DO_CLIENT_REQUEST_EXPR(0 /* default return */, \
112
111
VG_USERREQ__MAKE_MEM_NOACCESS, \
113
_qzz_addr, _qzz_len, 0, 0, 0); \
112
(_qzz_addr), (_qzz_len), 0, 0, 0)
117
114
/* Similarly, mark memory at _qzz_addr as addressable but undefined
118
115
for _qzz_len bytes. */
119
116
#define VALGRIND_MAKE_MEM_UNDEFINED(_qzz_addr,_qzz_len) \
120
(__extension__({unsigned long _qzz_res; \
121
VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0 /* default return */, \
117
VALGRIND_DO_CLIENT_REQUEST_EXPR(0 /* default return */, \
122
118
VG_USERREQ__MAKE_MEM_UNDEFINED, \
123
_qzz_addr, _qzz_len, 0, 0, 0); \
119
(_qzz_addr), (_qzz_len), 0, 0, 0)
127
121
/* Similarly, mark memory at _qzz_addr as addressable and defined
128
122
for _qzz_len bytes. */
129
123
#define VALGRIND_MAKE_MEM_DEFINED(_qzz_addr,_qzz_len) \
130
(__extension__({unsigned long _qzz_res; \
131
VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0 /* default return */, \
124
VALGRIND_DO_CLIENT_REQUEST_EXPR(0 /* default return */, \
132
125
VG_USERREQ__MAKE_MEM_DEFINED, \
133
_qzz_addr, _qzz_len, 0, 0, 0); \
126
(_qzz_addr), (_qzz_len), 0, 0, 0)
137
128
/* Similar to VALGRIND_MAKE_MEM_DEFINED except that addressability is
138
129
not altered: bytes which are addressable are marked as defined,
139
130
but those which are not addressable are left unchanged. */
140
#define VALGRIND_MAKE_MEM_DEFINED_IF_ADDRESSABLE(_qzz_addr,_qzz_len) \
141
(__extension__({unsigned long _qzz_res; \
142
VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0 /* default return */, \
131
#define VALGRIND_MAKE_MEM_DEFINED_IF_ADDRESSABLE(_qzz_addr,_qzz_len) \
132
VALGRIND_DO_CLIENT_REQUEST_EXPR(0 /* default return */, \
143
133
VG_USERREQ__MAKE_MEM_DEFINED_IF_ADDRESSABLE, \
144
_qzz_addr, _qzz_len, 0, 0, 0); \
134
(_qzz_addr), (_qzz_len), 0, 0, 0)
148
136
/* Create a block-description handle. The description is an ascii
149
137
string which is included in any messages pertaining to addresses
150
138
within the specified memory range. Has no other effect on the
151
139
properties of the memory range. */
152
#define VALGRIND_CREATE_BLOCK(_qzz_addr,_qzz_len, _qzz_desc) \
153
(__extension__({unsigned long _qzz_res; \
154
VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0 /* default return */, \
155
VG_USERREQ__CREATE_BLOCK, \
156
_qzz_addr, _qzz_len, _qzz_desc, \
140
#define VALGRIND_CREATE_BLOCK(_qzz_addr,_qzz_len, _qzz_desc) \
141
VALGRIND_DO_CLIENT_REQUEST_EXPR(0 /* default return */, \
142
VG_USERREQ__CREATE_BLOCK, \
143
(_qzz_addr), (_qzz_len), (_qzz_desc), \
161
146
/* Discard a block-description-handle. Returns 1 for an
162
147
invalid handle, 0 for a valid handle. */
163
148
#define VALGRIND_DISCARD(_qzz_blkindex) \
164
(__extension__ ({unsigned long _qzz_res; \
165
VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0 /* default return */, \
149
VALGRIND_DO_CLIENT_REQUEST_EXPR(0 /* default return */, \
166
150
VG_USERREQ__DISCARD, \
167
0, _qzz_blkindex, 0, 0, 0); \
151
0, (_qzz_blkindex), 0, 0, 0)
172
154
/* Client-code macros to check the state of memory. */
175
157
If suitable addressibility is not established, Valgrind prints an
176
158
error message and returns the address of the first offending byte.
177
159
Otherwise it returns zero. */
178
#define VALGRIND_CHECK_MEM_IS_ADDRESSABLE(_qzz_addr,_qzz_len) \
179
(__extension__({unsigned long _qzz_res; \
180
VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
181
VG_USERREQ__CHECK_MEM_IS_ADDRESSABLE,\
182
_qzz_addr, _qzz_len, 0, 0, 0); \
160
#define VALGRIND_CHECK_MEM_IS_ADDRESSABLE(_qzz_addr,_qzz_len) \
161
VALGRIND_DO_CLIENT_REQUEST_EXPR(0, \
162
VG_USERREQ__CHECK_MEM_IS_ADDRESSABLE, \
163
(_qzz_addr), (_qzz_len), 0, 0, 0)
186
165
/* Check that memory at _qzz_addr is addressable and defined for
187
166
_qzz_len bytes. If suitable addressibility and definedness are not
188
167
established, Valgrind prints an error message and returns the
189
168
address of the first offending byte. Otherwise it returns zero. */
190
169
#define VALGRIND_CHECK_MEM_IS_DEFINED(_qzz_addr,_qzz_len) \
191
(__extension__({unsigned long _qzz_res; \
192
VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
170
VALGRIND_DO_CLIENT_REQUEST_EXPR(0, \
193
171
VG_USERREQ__CHECK_MEM_IS_DEFINED, \
194
_qzz_addr, _qzz_len, 0, 0, 0); \
172
(_qzz_addr), (_qzz_len), 0, 0, 0);
198
174
/* Use this macro to force the definedness and addressibility of an
199
175
lvalue to be checked. If suitable addressibility and definedness
276
252
The metadata is not copied in cases 0, 2 or 3 so it should be
277
253
impossible to segfault your system by using this call.
279
#define VALGRIND_GET_VBITS(zza,zzvbits,zznbytes) \
280
(__extension__({unsigned long _qzz_res; \
281
char* czza = (char*)zza; \
282
char* czzvbits = (char*)zzvbits; \
283
VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
284
VG_USERREQ__GET_VBITS, \
285
czza, czzvbits, zznbytes, 0, 0 ); \
255
#define VALGRIND_GET_VBITS(zza,zzvbits,zznbytes) \
256
VALGRIND_DO_CLIENT_REQUEST_EXPR(0, \
257
VG_USERREQ__GET_VBITS, \
258
(char*)(zza), (char*)(zzvbits), \
289
261
/* Set the validity data for addresses [zza..zza+zznbytes-1], copying it
290
262
from the provided zzvbits array. Return values:
295
267
The metadata is not copied in cases 0, 2 or 3 so it should be
296
268
impossible to segfault your system by using this call.
298
#define VALGRIND_SET_VBITS(zza,zzvbits,zznbytes) \
299
(__extension__({unsigned int _qzz_res; \
300
char* czza = (char*)zza; \
301
char* czzvbits = (char*)zzvbits; \
302
VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
303
VG_USERREQ__SET_VBITS, \
304
czza, czzvbits, zznbytes, 0, 0 ); \
270
#define VALGRIND_SET_VBITS(zza,zzvbits,zznbytes) \
271
VALGRIND_DO_CLIENT_REQUEST_EXPR(0, \
272
VG_USERREQ__SET_VBITS, \
273
(char*)(zza), (char*)(zzvbits), \