107dc1947SRichard Lowe /*
207dc1947SRichard Lowe 
307dc1947SRichard Lowe   Copyright (C) 2005 Silicon Graphics, Inc.  All Rights Reserved.
407dc1947SRichard Lowe   This program is free software; you can redistribute it and/or modify it
507dc1947SRichard Lowe   under the terms of version 2.1 of the GNU Lesser General Public License
607dc1947SRichard Lowe   as published by the Free Software Foundation.
707dc1947SRichard Lowe 
807dc1947SRichard Lowe   This program is distributed in the hope that it would be useful, but
907dc1947SRichard Lowe   WITHOUT ANY WARRANTY; without even the implied warranty of
1007dc1947SRichard Lowe   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1107dc1947SRichard Lowe 
1207dc1947SRichard Lowe   Further, this software is distributed without any warranty that it is
1307dc1947SRichard Lowe   free of the rightful claim of any third person regarding infringement
1407dc1947SRichard Lowe   or the like.  Any license provided herein, whether implied or
1507dc1947SRichard Lowe   otherwise, applies only to this software file.  Patent licenses, if
1607dc1947SRichard Lowe   any, provided herein do not apply to combinations of this program with
1707dc1947SRichard Lowe   other software, or any other product whatsoever.
1807dc1947SRichard Lowe 
1907dc1947SRichard Lowe   You should have received a copy of the GNU Lesser General Public
2007dc1947SRichard Lowe   License along with this program; if not, write the Free Software
2107dc1947SRichard Lowe   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston MA 02110-1301,
2207dc1947SRichard Lowe   USA.
2307dc1947SRichard Lowe 
2407dc1947SRichard Lowe */
2507dc1947SRichard Lowe 
2607dc1947SRichard Lowe /* malloc_check.h */
2707dc1947SRichard Lowe 
28*4d9fdb46SRobert Mustacchi /* A simple libdwarf-aware malloc checker.
2907dc1947SRichard Lowe    define WANT_LIBBDWARF_MALLOC_CHECK and rebuild libdwarf
3007dc1947SRichard Lowe    do make a checking-for-alloc-mistakes libdwarf.
3107dc1947SRichard Lowe    NOT  recommended for production use.
3207dc1947SRichard Lowe 
3307dc1947SRichard Lowe    When defined, also add malloc_check.c to the list of
3407dc1947SRichard Lowe    files in Makefile.
3507dc1947SRichard Lowe */
3607dc1947SRichard Lowe 
37*4d9fdb46SRobert Mustacchi #undef WANT_LIBBDWARF_MALLOC_CHECK
3807dc1947SRichard Lowe /*#define WANT_LIBBDWARF_MALLOC_CHECK  1 */
3907dc1947SRichard Lowe 
4007dc1947SRichard Lowe #ifdef WANT_LIBBDWARF_MALLOC_CHECK
4107dc1947SRichard Lowe 
4207dc1947SRichard Lowe void dwarf_malloc_check_alloc_data(void * addr,unsigned char code);
4307dc1947SRichard Lowe void dwarf_malloc_check_dealloc_data(void * addr,unsigned char code);
4407dc1947SRichard Lowe void dwarf_malloc_check_complete(char *wheremsg); /* called at exit of app */
4507dc1947SRichard Lowe 
4607dc1947SRichard Lowe #else /* !WANT_LIBBDWARF_MALLOC_CHECK */
4707dc1947SRichard Lowe 
4807dc1947SRichard Lowe #define dwarf_malloc_check_alloc_data(a,b)  /* nothing */
4907dc1947SRichard Lowe #define dwarf_malloc_check_dealloc_data(a,b)  /* nothing */
5007dc1947SRichard Lowe #define dwarf_malloc_check_complete(a) /* nothing */
5107dc1947SRichard Lowe 
5207dc1947SRichard Lowe #endif /* WANT_LIBBDWARF_MALLOC_CHECK */
53