1*ce716eebSriastradh /* $NetBSD: debug.h,v 1.8 2024/08/03 21:59:57 riastradh Exp $ */ 241fe218bScgd 341fe218bScgd /* 441fe218bScgd * Copyright 1996 John D. Polstra. 541fe218bScgd * Copyright 1996 Matt Thomas <matt@3am-software.com> 641fe218bScgd * All rights reserved. 741fe218bScgd * 841fe218bScgd * Redistribution and use in source and binary forms, with or without 941fe218bScgd * modification, are permitted provided that the following conditions 1041fe218bScgd * are met: 1141fe218bScgd * 1. Redistributions of source code must retain the above copyright 1241fe218bScgd * notice, this list of conditions and the following disclaimer. 1341fe218bScgd * 2. Redistributions in binary form must reproduce the above copyright 1441fe218bScgd * notice, this list of conditions and the following disclaimer in the 1541fe218bScgd * documentation and/or other materials provided with the distribution. 1641fe218bScgd * 3. All advertising materials mentioning features or use of this software 1741fe218bScgd * must display the following acknowledgement: 1841fe218bScgd * This product includes software developed by John Polstra. 1941fe218bScgd * 4. The name of the author may not be used to endorse or promote products 2041fe218bScgd * derived from this software without specific prior written permission. 2141fe218bScgd * 2241fe218bScgd * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 2341fe218bScgd * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 2441fe218bScgd * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 2541fe218bScgd * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 2641fe218bScgd * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 2741fe218bScgd * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 2841fe218bScgd * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 2941fe218bScgd * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 3041fe218bScgd * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 3141fe218bScgd * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 3241fe218bScgd */ 3341fe218bScgd 3441fe218bScgd /* 3541fe218bScgd * Support for printing debugging messages. 3641fe218bScgd */ 3741fe218bScgd 3826475619Schristos #ifndef DEBUG_H 3926475619Schristos #define DEBUG_H 4041fe218bScgd 4141fe218bScgd 4226475619Schristos #ifdef DEBUG 4326475619Schristos 4426475619Schristos extern void debug_printf __P((const char *, ...)) 45ab951f38Schristos __attribute__((__format__(__printf__, 1, 2))); 4641fe218bScgd extern int debug; 4741fe218bScgd 4826475619Schristos # define dbg(a) debug_printf a 4984cb6578Schristos #else 5026475619Schristos # define dbg(a) ((void) 0) 5126475619Schristos #endif 5226475619Schristos #ifdef RTLD_DEBUG_RELOC 53a3b892d1Smycroft # define rdbg(a) debug_printf a 5426475619Schristos #else 55a3b892d1Smycroft # define rdbg(a) ((void) 0) 5684cb6578Schristos #endif 5741fe218bScgd 58ffcdb0b1Sskrll #if ELFSIZE == 64 59ffcdb0b1Sskrll #define PRImemsz PRIu64 60ffcdb0b1Sskrll #else 61ffcdb0b1Sskrll #define PRImemsz PRIu32 62ffcdb0b1Sskrll #endif 63ffcdb0b1Sskrll 6426475619Schristos #endif 65