Back to index

glibc  2.9
mcheck.h
Go to the documentation of this file.
00001 /* Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
00002    This file is part of the GNU C Library.
00003 
00004    The GNU C Library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Lesser General Public
00006    License as published by the Free Software Foundation; either
00007    version 2.1 of the License, or (at your option) any later version.
00008 
00009    The GNU C Library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Lesser General Public License for more details.
00013 
00014    You should have received a copy of the GNU Lesser General Public
00015    License along with the GNU C Library; if not, write to the Free
00016    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00017    02111-1307 USA.  */
00018 
00019 #ifndef _MCHECK_H
00020 #define _MCHECK_H    1
00021 
00022 #include <features.h>
00023 
00024 __BEGIN_DECLS
00025 
00026 /* Return values for `mprobe': these are the kinds of inconsistencies that
00027    `mcheck' enables detection of.  */
00028 enum mcheck_status
00029   {
00030     MCHECK_DISABLED = -1,       /* Consistency checking is not turned on.  */
00031     MCHECK_OK,                  /* Block is fine.  */
00032     MCHECK_FREE,                /* Block freed twice.  */
00033     MCHECK_HEAD,                /* Memory before the block was clobbered.  */
00034     MCHECK_TAIL                 /* Memory after the block was clobbered.  */
00035   };
00036 
00037 
00038 /* Activate a standard collection of debugging hooks.  This must be called
00039    before `malloc' is ever called.  ABORTFUNC is called with an error code
00040    (see enum above) when an inconsistency is detected.  If ABORTFUNC is
00041    null, the standard function prints on stderr and then calls `abort'.  */
00042 extern int mcheck (void (*__abortfunc) (enum mcheck_status)) __THROW;
00043 
00044 /* Similar to `mcheck´ but performs checks for all block whenever one of
00045    the memory handling functions is called.  This can be very slow.  */
00046 extern int mcheck_pedantic (void (*__abortfunc) (enum mcheck_status)) __THROW;
00047 
00048 /* Force check of all blocks now.  */
00049 extern void mcheck_check_all (void);
00050 
00051 /* Check for aberrations in a particular malloc'd block.  You must have
00052    called `mcheck' already.  These are the same checks that `mcheck' does
00053    when you free or reallocate a block.  */
00054 extern enum mcheck_status mprobe (void *__ptr) __THROW;
00055 
00056 /* Activate a standard collection of tracing hooks.  */
00057 extern void mtrace (void) __THROW;
00058 extern void muntrace (void) __THROW;
00059 
00060 __END_DECLS
00061 
00062 #endif /* mcheck.h */