1*84d9c625SLionel Sambuc /* $NetBSD: debug.h,v 1.7 2013/08/03 13:17:05 skrll Exp $ */ 2e83f7ba2SBen Gras 3e83f7ba2SBen Gras /* 4e83f7ba2SBen Gras * Copyright 1996 John D. Polstra. 5e83f7ba2SBen Gras * Copyright 1996 Matt Thomas <matt@3am-software.com> 6e83f7ba2SBen Gras * All rights reserved. 7e83f7ba2SBen Gras * 8e83f7ba2SBen Gras * Redistribution and use in source and binary forms, with or without 9e83f7ba2SBen Gras * modification, are permitted provided that the following conditions 10e83f7ba2SBen Gras * are met: 11e83f7ba2SBen Gras * 1. Redistributions of source code must retain the above copyright 12e83f7ba2SBen Gras * notice, this list of conditions and the following disclaimer. 13e83f7ba2SBen Gras * 2. Redistributions in binary form must reproduce the above copyright 14e83f7ba2SBen Gras * notice, this list of conditions and the following disclaimer in the 15e83f7ba2SBen Gras * documentation and/or other materials provided with the distribution. 16e83f7ba2SBen Gras * 3. All advertising materials mentioning features or use of this software 17e83f7ba2SBen Gras * must display the following acknowledgement: 18e83f7ba2SBen Gras * This product includes software developed by John Polstra. 19e83f7ba2SBen Gras * 4. The name of the author may not be used to endorse or promote products 20e83f7ba2SBen Gras * derived from this software without specific prior written permission. 21e83f7ba2SBen Gras * 22e83f7ba2SBen Gras * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 23e83f7ba2SBen Gras * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 24e83f7ba2SBen Gras * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 25e83f7ba2SBen Gras * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 26e83f7ba2SBen Gras * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 27e83f7ba2SBen Gras * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28e83f7ba2SBen Gras * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29e83f7ba2SBen Gras * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30e83f7ba2SBen Gras * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 31e83f7ba2SBen Gras * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32e83f7ba2SBen Gras */ 33e83f7ba2SBen Gras 34e83f7ba2SBen Gras /* 35e83f7ba2SBen Gras * Support for printing debugging messages. 36e83f7ba2SBen Gras */ 37e83f7ba2SBen Gras 38e83f7ba2SBen Gras #ifndef DEBUG_H 39e83f7ba2SBen Gras #define DEBUG_H 40e83f7ba2SBen Gras 41e83f7ba2SBen Gras 42e83f7ba2SBen Gras #ifdef DEBUG 43e83f7ba2SBen Gras 44e83f7ba2SBen Gras extern void debug_printf __P((const char *, ...)) 45e83f7ba2SBen Gras __attribute__((__format__(__printf__, 1, 2))); 46e83f7ba2SBen Gras extern int debug; 47e83f7ba2SBen Gras 48e83f7ba2SBen Gras # define dbg(a) debug_printf a 49e83f7ba2SBen Gras #else 50e83f7ba2SBen Gras # define dbg(a) ((void) 0) 51e83f7ba2SBen Gras #endif 52e83f7ba2SBen Gras #ifdef RTLD_DEBUG_RELOC 53e83f7ba2SBen Gras # define rdbg(a) debug_printf a 54e83f7ba2SBen Gras #else 55e83f7ba2SBen Gras # define rdbg(a) ((void) 0) 56e83f7ba2SBen Gras #endif 57e83f7ba2SBen Gras 58*84d9c625SLionel Sambuc #if ELFSIZE == 64 59*84d9c625SLionel Sambuc #define PRImemsz PRIu64 60*84d9c625SLionel Sambuc #else 61*84d9c625SLionel Sambuc #define PRImemsz PRIu32 62*84d9c625SLionel Sambuc #endif 63*84d9c625SLionel Sambuc 64e83f7ba2SBen Gras #endif 65