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