138889Sjdp/*	$NetBSD: debug.h,v 1.6 2013/05/06 08:02:20 skrll Exp $	*/
238889Sjdp
338889Sjdp/*
438889Sjdp * Copyright 1996 John D. Polstra.
538889Sjdp * Copyright 1996 Matt Thomas <matt@3am-software.com>
638889Sjdp * All rights reserved.
738889Sjdp *
838889Sjdp * Redistribution and use in source and binary forms, with or without
938889Sjdp * modification, are permitted provided that the following conditions
1038889Sjdp * are met:
1138889Sjdp * 1. Redistributions of source code must retain the above copyright
1238889Sjdp *    notice, this list of conditions and the following disclaimer.
1338889Sjdp * 2. Redistributions in binary form must reproduce the above copyright
1438889Sjdp *    notice, this list of conditions and the following disclaimer in the
1538889Sjdp *    documentation and/or other materials provided with the distribution.
1638889Sjdp * 3. All advertising materials mentioning features or use of this software
1738889Sjdp *    must display the following acknowledgement:
1838889Sjdp *      This product includes software developed by John Polstra.
1960484Sobrien * 4. The name of the author may not be used to endorse or promote products
2038889Sjdp *    derived from this software without specific prior written permission.
2138889Sjdp *
2238889Sjdp * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
2338889Sjdp * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
2460484Sobrien * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
2538889Sjdp * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
2638889Sjdp * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
2738889Sjdp * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2838889Sjdp * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2938889Sjdp * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
3038889Sjdp * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
3138889Sjdp * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3238889Sjdp */
3338889Sjdp
3438889Sjdp/*
3538889Sjdp * Support for printing debugging messages.
3638889Sjdp */
3738889Sjdp
3838889Sjdp#ifndef DEBUG_H
3938889Sjdp#define DEBUG_H
4038889Sjdp
4138889Sjdp
4238889Sjdp#ifdef DEBUG
4338889Sjdp
4438889Sjdpextern void debug_printf __P((const char *, ...))
4538889Sjdp    __attribute__((__format__(__printf__, 1, 2)));
4638889Sjdpextern int debug;
4738889Sjdp
4838889Sjdp# define dbg(a)		debug_printf a
4938889Sjdp#else
5038889Sjdp# define dbg(a)		((void) 0)
5138889Sjdp#endif
5238889Sjdp#ifdef RTLD_DEBUG_RELOC
5338889Sjdp# define rdbg(a)	debug_printf a
5438889Sjdp#else
5538889Sjdp# define rdbg(a)	((void) 0)
5638889Sjdp#endif
5738889Sjdp
5838889Sjdp#if ELFSIZE == 64
5938889Sjdp#define	PRImemsz	PRIu64
6038889Sjdp#else
6138889Sjdp#define	PRImemsz	PRIu32
6238889Sjdp#endif
6338889Sjdp
6438889Sjdp#endif
6538889Sjdp