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