| 1 | |
| 2 | /* Debug macros for development. |
| 3 | Copyright 1997 |
| 4 | Free Software Foundation, Inc. |
| 5 | |
| 6 | This file is part of GDB. |
| 7 | |
| 8 | This program is free software; you can redistribute it and/or modify |
| 9 | it under the terms of the GNU General Public License as published by |
| 10 | the Free Software Foundation; either version 2 of the License, or |
| 11 | (at your option) any later version. |
| 12 | |
| 13 | This program is distributed in the hope that it will be useful, |
| 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | GNU General Public License for more details. |
| 17 | |
| 18 | You should have received a copy of the GNU General Public License |
| 19 | along with this program; if not, write to the Free Software |
| 20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ |
| 21 | |
| 22 | #ifndef _DEBUGIFY_H_ |
| 23 | #define _DEBUGIFY_H_ |
| 24 | |
| 25 | #include "ansidecl.h" |
| 26 | |
| 27 | #ifdef ANSI_PROTOTYPES |
| 28 | #include <stdarg.h> |
| 29 | #else |
| 30 | #include <varargs.h> |
| 31 | #endif |
| 32 | |
| 33 | #ifdef DEBUGIFY |
| 34 | #include <assert.h> |
| 35 | #ifdef TO_SCREEN |
| 36 | #ifdef _Win32 |
| 37 | #define DBG(x) OutputDebugString x |
| 38 | #else |
| 39 | #define DBG(x) printf x |
| 40 | #endif |
| 41 | #elif TO_GDB |
| 42 | #define DBG(x) printf_unfiltered x |
| 43 | #elif TO_POPUP |
| 44 | #ifdef _Win32 |
| 45 | #define DBG(x) MessageBox x |
| 46 | #else |
| 47 | #define DBG(x) printf x |
| 48 | #endif |
| 49 | #else /* default: TO_FILE "gdb.log" */ |
| 50 | #define DBG(x) printf_dbg x |
| 51 | #endif |
| 52 | |
| 53 | #define ASSERT(x) assert(x) |
| 54 | |
| 55 | #else /* DEBUGIFY */ |
| 56 | #define DBG(x) |
| 57 | #define ASSERT(x) |
| 58 | #endif |
| 59 | |
| 60 | #ifdef __cplusplus |
| 61 | extern "C" |
| 62 | { |
| 63 | #endif |
| 64 | |
| 65 | #ifdef REDIRECT |
| 66 | #define printf_unfiltered printf_dbg |
| 67 | #define fputs_unfiltered fputs_dbg |
| 68 | extern void fputs_dbg PARAMS ((const char *fmt, FILE * fakestream)); |
| 69 | #endif /* REDIRECT */ |
| 70 | |
| 71 | extern void puts_dbg PARAMS ((const char *fmt)); |
| 72 | #ifdef ANSI_PROTOTYPES |
| 73 | extern void printf_dbg PARAMS ((const char *fmt,...)); |
| 74 | #else |
| 75 | extern void printf_dbg PARAMS ((va_alist va_dcl)); |
| 76 | #endif |
| 77 | |
| 78 | |
| 79 | #ifdef __cplusplus |
| 80 | } |
| 81 | #endif |
| 82 | |
| 83 | #endif /* _DEBUGIFY_H_ */ |