valgrind.h revision 2e93c50dc50235189661b70e3f27a4098d5ccccc
13ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
23ed852eea50f9d4cd633efb8c2b054b8e33c253cristy/*
33ed852eea50f9d4cd633efb8c2b054b8e33c253cristy   This file is part of Valgrind, an x86 protected-mode emulator
43ed852eea50f9d4cd633efb8c2b054b8e33c253cristy   designed for debugging and profiling binaries on x86-Unixes.
53ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
63ed852eea50f9d4cd633efb8c2b054b8e33c253cristy   Copyright (C) 2000-2002 Julian Seward
73ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      jseward@acm.org
83ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      Julian_Seward@muraroa.demon.co.uk
93ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy   This program is free software; you can redistribute it and/or
113ed852eea50f9d4cd633efb8c2b054b8e33c253cristy   modify it under the terms of the GNU General Public License as
123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy   published by the Free Software Foundation; either version 2 of the
133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy   License, or (at your option) any later version.
143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy   This program is distributed in the hope that it will be useful, but
163ed852eea50f9d4cd633efb8c2b054b8e33c253cristy   WITHOUT ANY WARRANTY; without even the implied warranty of
173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy   General Public License for more details.
193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
2045ef08fd6a09813e4a8f5ddadf85ba9e0ec2cdc7cristy   You should have received a copy of the GNU General Public License
213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy   along with this program; if not, write to the Free Software
223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy   02111-1307, USA.
243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy   The GNU General Public License is contained in the file LICENSE.
263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy*/
273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
293ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#ifndef __VALGRIND_H
303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#define __VALGRIND_H
313ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
323ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy/* This file is for inclusion into client (your!) code.
343ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy   You can use these macros to manipulate and query memory permissions
363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy   inside your own programs.
373ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy   The resulting executables will still run without Valgrind, just a
393ed852eea50f9d4cd633efb8c2b054b8e33c253cristy   little bit more slowly than they otherwise would, but otherwise
403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy   unchanged.
413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
424c08aed51c5899665ade97263692328eea4af106cristy   When run on Valgrind with --client-perms=yes, Valgrind observes
434c08aed51c5899665ade97263692328eea4af106cristy   these macro calls and takes appropriate action.  When run on
4476ce6e193e5a305875173a744bbd59d27ddb3148cristy   Valgrind with --client-perms=no (the default), Valgrind observes
454c08aed51c5899665ade97263692328eea4af106cristy   these macro calls but does not take any action as a result.  */
464c08aed51c5899665ade97263692328eea4af106cristy
478a3ce7f37eeb9deabe9134cb75cd69e7dae75301cristy
484c08aed51c5899665ade97263692328eea4af106cristy
498a3ce7f37eeb9deabe9134cb75cd69e7dae75301cristy/* This defines the magic code sequence which the JITter spots and
504c08aed51c5899665ade97263692328eea4af106cristy   handles magically.  Don't look too closely at this; it will rot
514c08aed51c5899665ade97263692328eea4af106cristy   your brain.  Valgrind dumps the result value in %EDX, so we first
524c08aed51c5899665ade97263692328eea4af106cristy   copy the default value there, so that it is returned when not
534c08aed51c5899665ade97263692328eea4af106cristy   running on Valgrind.  Since %EAX points to a block of mem
544c08aed51c5899665ade97263692328eea4af106cristy   containing the args, you can pass as many args as you want like
554c08aed51c5899665ade97263692328eea4af106cristy   this.  Currently this is set up to deal with 4 args since that's
564c08aed51c5899665ade97263692328eea4af106cristy   the max that we appear to need (pthread_create).
578a3ce7f37eeb9deabe9134cb75cd69e7dae75301cristy*/
584c08aed51c5899665ade97263692328eea4af106cristy#define VALGRIND_MAGIC_SEQUENCE(                                        \
594c08aed51c5899665ade97263692328eea4af106cristy        _zzq_rlval,   /* result lvalue */                               \
604c08aed51c5899665ade97263692328eea4af106cristy        _zzq_default, /* result returned when running on real CPU */    \
614c08aed51c5899665ade97263692328eea4af106cristy        _zzq_request, /* request code */                                \
624c08aed51c5899665ade97263692328eea4af106cristy        _zzq_arg1,    /* request first param */                         \
638a3ce7f37eeb9deabe9134cb75cd69e7dae75301cristy        _zzq_arg2,    /* request second param */                        \
648a3ce7f37eeb9deabe9134cb75cd69e7dae75301cristy        _zzq_arg3,    /* request third param */                         \
653ed852eea50f9d4cd633efb8c2b054b8e33c253cristy        _zzq_arg4     /* request fourth param */ )                      \
663ed852eea50f9d4cd633efb8c2b054b8e33c253cristy                                                                        \
673ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  { volatile unsigned int _zzq_args[5];                                 \
683ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    _zzq_args[0] = (volatile unsigned int)_zzq_request;                 \
693ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    _zzq_args[1] = (volatile unsigned int)_zzq_arg1;                    \
703ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    _zzq_args[2] = (volatile unsigned int)_zzq_arg2;                    \
713ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    _zzq_args[3] = (volatile unsigned int)_zzq_arg3;                    \
723ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    _zzq_args[4] = (volatile unsigned int)_zzq_arg4;                    \
733ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    asm volatile("movl %1, %%eax\n\t"                                   \
743ed852eea50f9d4cd633efb8c2b054b8e33c253cristy                 "movl %2, %%edx\n\t"                                   \
753ed852eea50f9d4cd633efb8c2b054b8e33c253cristy                 "roll $29, %%eax ; roll $3, %%eax\n\t"                 \
763ed852eea50f9d4cd633efb8c2b054b8e33c253cristy                 "rorl $27, %%eax ; rorl $5, %%eax\n\t"                 \
773ed852eea50f9d4cd633efb8c2b054b8e33c253cristy                 "roll $13, %%eax ; roll $19, %%eax\n\t"                \
783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy                 "movl %%edx, %0\t"                                     \
793ed852eea50f9d4cd633efb8c2b054b8e33c253cristy                 : "=r" (_zzq_rlval)                                    \
803ed852eea50f9d4cd633efb8c2b054b8e33c253cristy                 : "r" (&_zzq_args[0]), "r" (_zzq_default)              \
813ed852eea50f9d4cd633efb8c2b054b8e33c253cristy                 : "eax", "edx", "cc", "memory"                         \
823ed852eea50f9d4cd633efb8c2b054b8e33c253cristy                );                                                      \
833ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  }
843ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
853ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
863ed852eea50f9d4cd633efb8c2b054b8e33c253cristy/* Some request codes.  There are many more of these, but most are not
873ed852eea50f9d4cd633efb8c2b054b8e33c253cristy   exposed to end-user view.  These are the public ones, all of the
883ed852eea50f9d4cd633efb8c2b054b8e33c253cristy   form 0x1000 + small_number.
893ed852eea50f9d4cd633efb8c2b054b8e33c253cristy*/
903ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
913ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#define VG_USERREQ__MAKE_NOACCESS        0x1001
923ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#define VG_USERREQ__MAKE_WRITABLE        0x1002
933ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#define VG_USERREQ__MAKE_READABLE        0x1003
943ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#define VG_USERREQ__DISCARD              0x1004
953ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#define VG_USERREQ__CHECK_WRITABLE       0x1005
963ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#define VG_USERREQ__CHECK_READABLE       0x1006
973ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#define VG_USERREQ__MAKE_NOACCESS_STACK  0x1007
983ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#define VG_USERREQ__RUNNING_ON_VALGRIND  0x1008
9954ec42737fdec7527afa06ca95be82c8ca0bd866cristy#define VG_USERREQ__DO_LEAK_CHECK        0x1009 /* unimplemented */
10054ec42737fdec7527afa06ca95be82c8ca0bd866cristy
1013ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
1023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
103ab272ac4f115daf25c032de9dbb49a399eebe49bcristy/* Client-code macros to manipulate the state of memory. */
104ab272ac4f115daf25c032de9dbb49a399eebe49bcristy
1053ed852eea50f9d4cd633efb8c2b054b8e33c253cristy/* Mark memory at _qzz_addr as unaddressible and undefined for
1063ed852eea50f9d4cd633efb8c2b054b8e33c253cristy   _qzz_len bytes.  Returns an int handle pertaining to the block
1073ed852eea50f9d4cd633efb8c2b054b8e33c253cristy   descriptions Valgrind will use in subsequent error messages. */
1083ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#define VALGRIND_MAKE_NOACCESS(_qzz_addr,_qzz_len)               \
1093ed852eea50f9d4cd633efb8c2b054b8e33c253cristy   ({unsigned int _qzz_res;                                      \
1103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    VALGRIND_MAGIC_SEQUENCE(_qzz_res, 0 /* default return */,    \
1113ed852eea50f9d4cd633efb8c2b054b8e33c253cristy                            VG_USERREQ__MAKE_NOACCESS,           \
1123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy                            _qzz_addr, _qzz_len, 0, 0);          \
1133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    _qzz_res;                                                    \
1143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy   })
115bb50337b2a8a16ca7e903cc04ab195ff0fd47ae6cristy
1163ed852eea50f9d4cd633efb8c2b054b8e33c253cristy/* Similarly, mark memory at _qzz_addr as addressible but undefined
1173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy   for _qzz_len bytes. */
118bb50337b2a8a16ca7e903cc04ab195ff0fd47ae6cristy#define VALGRIND_MAKE_WRITABLE(_qzz_addr,_qzz_len)               \
1193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy   ({unsigned int _qzz_res;                                      \
1203ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    VALGRIND_MAGIC_SEQUENCE(_qzz_res, 0 /* default return */,    \
1213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy                            VG_USERREQ__MAKE_WRITABLE,           \
1224e82e51d7ebce7b4ef0f808d906124dd6f812248cristy                            _qzz_addr,_ qzz_len, 0, 0);          \
1234e82e51d7ebce7b4ef0f808d906124dd6f812248cristy    _qzz_res;                                                    \
1244e82e51d7ebce7b4ef0f808d906124dd6f812248cristy   })
1253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
1263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy/* Similarly, mark memory at _qzz_addr as addressible and defined
1273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy   for _qzz_len bytes. */
1283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#define VALGRIND_MAKE_READABLE(_qzz_addr,_qzz_len)               \
1293ed852eea50f9d4cd633efb8c2b054b8e33c253cristy   ({unsigned int _qzz_res;                                      \
1303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    VALGRIND_MAGIC_SEQUENCE(_qzz_res, 0 /* default return */,    \
1313ed852eea50f9d4cd633efb8c2b054b8e33c253cristy                            VG_USERREQ__MAKE_READABLE,           \
1323ed852eea50f9d4cd633efb8c2b054b8e33c253cristy                            _qzz_addr, _qzz_len, 0, 0);          \
1333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    _qzz_res;                                                    \
1343ed852eea50f9d4cd633efb8c2b054b8e33c253cristy   })
1359950d57e1124b73f684fb5946e206994cefda628cristy
1363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy/* Discard a block-description-handle obtained from the above three
1373ed852eea50f9d4cd633efb8c2b054b8e33c253cristy   macros.  After this, Valgrind will no longer be able to relate
1383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy   addressing errors to the user-defined block associated with the
1393ed852eea50f9d4cd633efb8c2b054b8e33c253cristy   handle.  The permissions settings associated with the handle remain
140092ec8d083fedaedfb7792995e7ea42164553cffcristy   in place.  Returns 1 for an invalid handle, 0 for a valid
141ab272ac4f115daf25c032de9dbb49a399eebe49bcristy   handle. */
142ab272ac4f115daf25c032de9dbb49a399eebe49bcristy#define VALGRIND_DISCARD(_qzz_blkindex)                          \
143ab272ac4f115daf25c032de9dbb49a399eebe49bcristy   ({unsigned int _qzz_res;                                      \
144ab272ac4f115daf25c032de9dbb49a399eebe49bcristy    VALGRIND_MAGIC_SEQUENCE(_qzz_res, 0 /* default return */,    \
145ab272ac4f115daf25c032de9dbb49a399eebe49bcristy                            VG_USERREQ__DISCARD,                 \
146ab272ac4f115daf25c032de9dbb49a399eebe49bcristy                            0, _qzz_blkindex, 0, 0);             \
147ab272ac4f115daf25c032de9dbb49a399eebe49bcristy    _qzz_res;                                                    \
148ab272ac4f115daf25c032de9dbb49a399eebe49bcristy   })
149d15e65928aec551b7388c2863de3e3e628e2e0ddcristy
1503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
151d15e65928aec551b7388c2863de3e3e628e2e0ddcristy
1523ed852eea50f9d4cd633efb8c2b054b8e33c253cristy/* Client-code macros to check the state of memory. */
1536fc392931fb03ddff4853716af6d51e329f59696cristy
154092ec8d083fedaedfb7792995e7ea42164553cffcristy/* Check that memory at _qzz_addr is addressible for _qzz_len bytes.
1553ed852eea50f9d4cd633efb8c2b054b8e33c253cristy   If suitable addressibility is not established, Valgrind prints an
156042ee78fa9004bf1ac6a95f09d9d1faca631dda1cristy   error message and returns the address of the first offending byte.
1573ed852eea50f9d4cd633efb8c2b054b8e33c253cristy   Otherwise it returns zero. */
1588db9ca45d3b9861f5b18cdc760c8e8f0f157b270cristy#define VALGRIND_CHECK_WRITABLE(_qzz_addr,_qzz_len)                \
1598db9ca45d3b9861f5b18cdc760c8e8f0f157b270cristy   ({unsigned int _qzz_res;                                        \
160e275ada1a7f4f90e73328c35e9f02464bafed8becristy    VALGRIND_MAGIC_SEQUENCE(_qzz_res, 0,                           \
161e275ada1a7f4f90e73328c35e9f02464bafed8becristy                            VG_USERREQ__CHECK_WRITABLE,            \
162e275ada1a7f4f90e73328c35e9f02464bafed8becristy                            _qzz_addr, _qzz_len, 0, 0);            \
163e275ada1a7f4f90e73328c35e9f02464bafed8becristy    _qzz_res;                                                      \
164e275ada1a7f4f90e73328c35e9f02464bafed8becristy   })
165e275ada1a7f4f90e73328c35e9f02464bafed8becristy
166e275ada1a7f4f90e73328c35e9f02464bafed8becristy/* Check that memory at _qzz_addr is addressible and defined for
167e275ada1a7f4f90e73328c35e9f02464bafed8becristy   _qzz_len bytes.  If suitable addressibility and definedness are not
168e275ada1a7f4f90e73328c35e9f02464bafed8becristy   established, Valgrind prints an error message and returns the
169b712c6e549e8dbd76a125beb14182d41cc8027eecristy   address of the first offending byte.  Otherwise it returns zero. */
170a492593efccb08b72392d64966b5c7728e56f16acristy#define VALGRIND_CHECK_READABLE(_qzz_addr,_qzz_len)                \
1718db9ca45d3b9861f5b18cdc760c8e8f0f157b270cristy   ({unsigned int _qzz_res;                                        \
1728db9ca45d3b9861f5b18cdc760c8e8f0f157b270cristy    VALGRIND_MAGIC_SEQUENCE(_qzz_res, 0,                           \
1738db9ca45d3b9861f5b18cdc760c8e8f0f157b270cristy                            VG_USERREQ__CHECK_READABLE,            \
1748db9ca45d3b9861f5b18cdc760c8e8f0f157b270cristy                            _qzz_addr, _qzz_len, 0, 0);            \
175e275ada1a7f4f90e73328c35e9f02464bafed8becristy    _qzz_res;                                                      \
176e275ada1a7f4f90e73328c35e9f02464bafed8becristy   })
177e275ada1a7f4f90e73328c35e9f02464bafed8becristy
178e275ada1a7f4f90e73328c35e9f02464bafed8becristy
179e275ada1a7f4f90e73328c35e9f02464bafed8becristy/* Use this macro to force the definedness and addressibility of a
180e275ada1a7f4f90e73328c35e9f02464bafed8becristy   value to be checked.  If suitable addressibility and definedness
181e275ada1a7f4f90e73328c35e9f02464bafed8becristy   are not established, Valgrind prints an error message and returns
182e275ada1a7f4f90e73328c35e9f02464bafed8becristy   the address of the first offending byte.  Otherwise it returns
183e275ada1a7f4f90e73328c35e9f02464bafed8becristy   zero. */
184a492593efccb08b72392d64966b5c7728e56f16acristy#define VALGRIND_CHECK_DEFINED(__lvalue)                           \
18554ec42737fdec7527afa06ca95be82c8ca0bd866cristy   (void)                                                          \
18654ec42737fdec7527afa06ca95be82c8ca0bd866cristy   VALGRIND_CHECK_READABLE(                                        \
1878db9ca45d3b9861f5b18cdc760c8e8f0f157b270cristy      (volatile unsigned char *)&(__lvalue),                       \
188a492593efccb08b72392d64966b5c7728e56f16acristy                      (unsigned int)(sizeof (__lvalue)))
1893ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
190bdf24b20c5b02c773580a7b8cbf4ae8bb11ef994cristy
191bdf24b20c5b02c773580a7b8cbf4ae8bb11ef994cristy
192bdf24b20c5b02c773580a7b8cbf4ae8bb11ef994cristy/* Mark memory, intended to be on the client's stack, at _qzz_addr as
193bdf24b20c5b02c773580a7b8cbf4ae8bb11ef994cristy   unaddressible and undefined for _qzz_len bytes.  Does not return a
1943ed852eea50f9d4cd633efb8c2b054b8e33c253cristy   value.  The record associated with this setting will be
195bdf24b20c5b02c773580a7b8cbf4ae8bb11ef994cristy   automatically removed by Valgrind when the containing routine
1963ed852eea50f9d4cd633efb8c2b054b8e33c253cristy   exits. */
1978592b059b2b4f03c0280b0e1146b225207e624f8cristy#define VALGRIND_MAKE_NOACCESS_STACK(_qzz_addr,_qzz_len)           \
1983ed852eea50f9d4cd633efb8c2b054b8e33c253cristy   {unsigned int _qzz_res;                                         \
1993ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    VALGRIND_MAGIC_SEQUENCE(_qzz_res, 0,                           \
2009f92e3cee3ca2d153ccb77ee02fd27eed563021ecristy                            VG_USERREQ__MAKE_NOACCESS_STACK,       \
2015cbc016effaa2d7ee617f46ca0a2371533d4ae17cristy                            _qzz_addr, _qzz_len, 0, 0);            \
2023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy   }
2033ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
204b51dff5c0d16a4c1b69ff683e786cb3b4c467694cristy
2053ed852eea50f9d4cd633efb8c2b054b8e33c253cristy/* Returns 1 if running on Valgrind, 0 if running on the real CPU.
2063ed852eea50f9d4cd633efb8c2b054b8e33c253cristy   Currently implemented but untested. */
2073ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#define RUNNING_ON_VALGRIND                                        \
2085cbc016effaa2d7ee617f46ca0a2371533d4ae17cristy   ({unsigned int _qzz_res;                                        \
209bb50337b2a8a16ca7e903cc04ab195ff0fd47ae6cristy    VALGRIND_MAGIC_SEQUENCE(_qzz_res, 0 /* returned if not */,     \
2104e82e51d7ebce7b4ef0f808d906124dd6f812248cristy                            VG_USERREQ__RUNNING_ON_VALGRIND,       \
21154ec42737fdec7527afa06ca95be82c8ca0bd866cristy                            0, 0, 0, 0);                           \
2123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    _qzz_res;                                                      \
21354ec42737fdec7527afa06ca95be82c8ca0bd866cristy   })
2148b235b2d0ea1bce8f9743d2d25bd6ddc9f72ff1dcristy
2153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
2160839c55af3e04dec06756f60da81a58210557c29cristy/* Mark memory, intended to be on the client's stack, at _qzz_addr as
217e275ada1a7f4f90e73328c35e9f02464bafed8becristy   unaddressible and undefined for _qzz_len bytes.  Does not return a
2183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy   value.  The record associated with this setting will be
219bdf24b20c5b02c773580a7b8cbf4ae8bb11ef994cristy   automatically removed by Valgrind when the containing routine
2203ed852eea50f9d4cd633efb8c2b054b8e33c253cristy   exits.
2219f92e3cee3ca2d153ccb77ee02fd27eed563021ecristy
2225cbc016effaa2d7ee617f46ca0a2371533d4ae17cristy   Currently implemented but untested.
2233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy*/
2243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#define VALGRIND_DO_LEAK_CHECK                                     \
225b51dff5c0d16a4c1b69ff683e786cb3b4c467694cristy   {unsigned int _qzz_res;                                         \
2263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    VALGRIND_MAGIC_SEQUENCE(_qzz_res, 0,                           \
2273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy                            VG_USERREQ__DO_LEAK_CHECK,             \
2283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy                            0, 0, 0, 0);                           \
2295cbc016effaa2d7ee617f46ca0a2371533d4ae17cristy   }
230bb50337b2a8a16ca7e903cc04ab195ff0fd47ae6cristy
2314e82e51d7ebce7b4ef0f808d906124dd6f812248cristy#endif
23242f5a6a8af8b1e4fd5f341e709c4d06778b8d85fcristy