xref: /titanic_44/usr/src/tools/ctf/dwarf/common/malloc_check.h (revision 07dc1947c362e187fb955d283b692f8769dd5def)
1*07dc1947SRichard Lowe /*
2*07dc1947SRichard Lowe 
3*07dc1947SRichard Lowe   Copyright (C) 2005 Silicon Graphics, Inc.  All Rights Reserved.
4*07dc1947SRichard Lowe   This program is free software; you can redistribute it and/or modify it
5*07dc1947SRichard Lowe   under the terms of version 2.1 of the GNU Lesser General Public License
6*07dc1947SRichard Lowe   as published by the Free Software Foundation.
7*07dc1947SRichard Lowe 
8*07dc1947SRichard Lowe   This program is distributed in the hope that it would be useful, but
9*07dc1947SRichard Lowe   WITHOUT ANY WARRANTY; without even the implied warranty of
10*07dc1947SRichard Lowe   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11*07dc1947SRichard Lowe 
12*07dc1947SRichard Lowe   Further, this software is distributed without any warranty that it is
13*07dc1947SRichard Lowe   free of the rightful claim of any third person regarding infringement
14*07dc1947SRichard Lowe   or the like.  Any license provided herein, whether implied or
15*07dc1947SRichard Lowe   otherwise, applies only to this software file.  Patent licenses, if
16*07dc1947SRichard Lowe   any, provided herein do not apply to combinations of this program with
17*07dc1947SRichard Lowe   other software, or any other product whatsoever.
18*07dc1947SRichard Lowe 
19*07dc1947SRichard Lowe   You should have received a copy of the GNU Lesser General Public
20*07dc1947SRichard Lowe   License along with this program; if not, write the Free Software
21*07dc1947SRichard Lowe   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston MA 02110-1301,
22*07dc1947SRichard Lowe   USA.
23*07dc1947SRichard Lowe 
24*07dc1947SRichard Lowe   Contact information:  Silicon Graphics, Inc., 1500 Crittenden Lane,
25*07dc1947SRichard Lowe   Mountain View, CA 94043, or:
26*07dc1947SRichard Lowe 
27*07dc1947SRichard Lowe   http://www.sgi.com
28*07dc1947SRichard Lowe 
29*07dc1947SRichard Lowe   For further information regarding this notice, see:
30*07dc1947SRichard Lowe 
31*07dc1947SRichard Lowe   http://oss.sgi.com/projects/GenInfo/NoticeExplan
32*07dc1947SRichard Lowe 
33*07dc1947SRichard Lowe */
34*07dc1947SRichard Lowe 
35*07dc1947SRichard Lowe 
36*07dc1947SRichard Lowe /* malloc_check.h */
37*07dc1947SRichard Lowe 
38*07dc1947SRichard Lowe /* A simple libdwarf-aware malloc checker.
39*07dc1947SRichard Lowe    define WANT_LIBBDWARF_MALLOC_CHECK and rebuild libdwarf
40*07dc1947SRichard Lowe    do make a checking-for-alloc-mistakes libdwarf.
41*07dc1947SRichard Lowe    NOT  recommended for production use.
42*07dc1947SRichard Lowe 
43*07dc1947SRichard Lowe    When defined, also add malloc_check.c to the list of
44*07dc1947SRichard Lowe    files in Makefile.
45*07dc1947SRichard Lowe */
46*07dc1947SRichard Lowe 
47*07dc1947SRichard Lowe #undef WANT_LIBBDWARF_MALLOC_CHECK
48*07dc1947SRichard Lowe /*#define WANT_LIBBDWARF_MALLOC_CHECK  1 */
49*07dc1947SRichard Lowe 
50*07dc1947SRichard Lowe #ifdef WANT_LIBBDWARF_MALLOC_CHECK
51*07dc1947SRichard Lowe 
52*07dc1947SRichard Lowe void dwarf_malloc_check_alloc_data(void * addr,unsigned char code);
53*07dc1947SRichard Lowe void dwarf_malloc_check_dealloc_data(void * addr,unsigned char code);
54*07dc1947SRichard Lowe void dwarf_malloc_check_complete(char *wheremsg); /* called at exit of app */
55*07dc1947SRichard Lowe 
56*07dc1947SRichard Lowe #else /* !WANT_LIBBDWARF_MALLOC_CHECK */
57*07dc1947SRichard Lowe 
58*07dc1947SRichard Lowe #define dwarf_malloc_check_alloc_data(a,b)  /* nothing */
59*07dc1947SRichard Lowe #define dwarf_malloc_check_dealloc_data(a,b)  /* nothing */
60*07dc1947SRichard Lowe #define dwarf_malloc_check_complete(a) /* nothing */
61*07dc1947SRichard Lowe 
62*07dc1947SRichard Lowe #endif /* WANT_LIBBDWARF_MALLOC_CHECK */
63