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