1 |
148 |
jeremybenn |
/* Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
|
2 |
|
|
This file is part of the GNU C Library.
|
3 |
|
|
|
4 |
|
|
The GNU C Library is free software; you can redistribute it and/or
|
5 |
|
|
modify it under the terms of the GNU Lesser General Public
|
6 |
|
|
License as published by the Free Software Foundation; either
|
7 |
|
|
version 2.1 of the License, or (at your option) any later version.
|
8 |
|
|
|
9 |
|
|
The GNU C Library is distributed in the hope that it will be useful,
|
10 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
12 |
|
|
Lesser General Public License for more details.
|
13 |
|
|
|
14 |
|
|
You should have received a copy of the GNU Lesser General Public
|
15 |
|
|
License along with the GNU C Library; if not, write to the Free
|
16 |
|
|
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
17 |
|
|
02111-1307 USA. */
|
18 |
|
|
|
19 |
|
|
/* Modified for newlib, July 9, 2002 by Jeff Johnston */
|
20 |
|
|
|
21 |
|
|
#ifndef _MCHECK_H
|
22 |
|
|
#define _MCHECK_H 1
|
23 |
|
|
|
24 |
|
|
#ifdef __cplusplus
|
25 |
|
|
extern "C" {
|
26 |
|
|
#endif
|
27 |
|
|
|
28 |
|
|
/* Return values for `mprobe': these are the kinds of inconsistencies that
|
29 |
|
|
`mcheck' enables detection of. */
|
30 |
|
|
enum mcheck_status
|
31 |
|
|
{
|
32 |
|
|
MCHECK_DISABLED = -1, /* Consistency checking is not turned on. */
|
33 |
|
|
MCHECK_OK, /* Block is fine. */
|
34 |
|
|
MCHECK_FREE, /* Block freed twice. */
|
35 |
|
|
MCHECK_HEAD, /* Memory before the block was clobbered. */
|
36 |
|
|
MCHECK_TAIL /* Memory after the block was clobbered. */
|
37 |
|
|
};
|
38 |
|
|
|
39 |
|
|
|
40 |
|
|
/* Activate a standard collection of debugging hooks. This must be called
|
41 |
|
|
before `malloc' is ever called. ABORTFUNC is called with an error code
|
42 |
|
|
(see enum above) when an inconsistency is detected. If ABORTFUNC is
|
43 |
|
|
null, the standard function prints on stderr and then calls `abort'. */
|
44 |
|
|
extern int mcheck (void (*__abortfunc) (enum mcheck_status));
|
45 |
|
|
|
46 |
|
|
/* Similar to `mcheck´ but performs checks for all block whenever one of
|
47 |
|
|
the memory handling functions is called. This can be very slow. */
|
48 |
|
|
extern int mcheck_pedantic (void (*__abortfunc) (enum mcheck_status));
|
49 |
|
|
|
50 |
|
|
/* Force check of all blocks now. */
|
51 |
|
|
extern void mcheck_check_all (void);
|
52 |
|
|
|
53 |
|
|
/* Check for aberrations in a particular malloc'd block. You must have
|
54 |
|
|
called `mcheck' already. These are the same checks that `mcheck' does
|
55 |
|
|
when you free or reallocate a block. */
|
56 |
|
|
extern enum mcheck_status mprobe (void *__ptr);
|
57 |
|
|
|
58 |
|
|
#ifdef __cplusplus
|
59 |
|
|
}
|
60 |
|
|
#endif
|
61 |
|
|
|
62 |
|
|
#endif /* mcheck.h */
|