xref: /illumos-gate/usr/src/lib/libdwarf/common/malloc_check.h (revision ed093b41a93e8563e6e1e5dae0768dda2a7bcc27)
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 */
25 
26 /* malloc_check.h */
27 
28 /* A simple libdwarf-aware malloc checker.
29    define WANT_LIBBDWARF_MALLOC_CHECK and rebuild libdwarf
30    do make a checking-for-alloc-mistakes libdwarf.
31    NOT  recommended for production use.
32 
33    When defined, also add malloc_check.c to the list of
34    files in Makefile.
35 */
36 
37 #undef WANT_LIBBDWARF_MALLOC_CHECK
38 /*#define WANT_LIBBDWARF_MALLOC_CHECK  1 */
39 
40 #ifdef WANT_LIBBDWARF_MALLOC_CHECK
41 
42 void dwarf_malloc_check_alloc_data(void * addr,unsigned char code);
43 void dwarf_malloc_check_dealloc_data(void * addr,unsigned char code);
44 void dwarf_malloc_check_complete(char *wheremsg); /* called at exit of app */
45 
46 #else /* !WANT_LIBBDWARF_MALLOC_CHECK */
47 
48 #define dwarf_malloc_check_alloc_data(a,b)  /* nothing */
49 #define dwarf_malloc_check_dealloc_data(a,b)  /* nothing */
50 #define dwarf_malloc_check_complete(a) /* nothing */
51 
52 #endif /* WANT_LIBBDWARF_MALLOC_CHECK */
53