| 1 |
|
|---|
| 2 | #ifndef __WINE_DEBUGTOOLS_H
|
|---|
| 3 | #define __WINE_DEBUGTOOLS_H
|
|---|
| 4 |
|
|---|
| 5 | #ifdef __WINE__ /* Debugging interface is internal to Wine */
|
|---|
| 6 |
|
|---|
| 7 | #include <stdio.h>
|
|---|
| 8 | #include "config.h"
|
|---|
| 9 | #include "debugstr.h"
|
|---|
| 10 |
|
|---|
| 11 | #define DEBUG_RUNTIME
|
|---|
| 12 |
|
|---|
| 13 | /* Internal definitions (do not use these directly) */
|
|---|
| 14 |
|
|---|
| 15 | enum __DEBUG_CLASS { __DBCL_FIXME, __DBCL_ERR, __DBCL_WARN, __DBCL_TRACE, __DBCL_COUNT };
|
|---|
| 16 |
|
|---|
| 17 | extern char __debug_msg_enabled[][__DBCL_COUNT];
|
|---|
| 18 |
|
|---|
| 19 | extern const char * const debug_cl_name[__DBCL_COUNT];
|
|---|
| 20 | extern const char * const debug_ch_name[];
|
|---|
| 21 |
|
|---|
| 22 | #define __GET_DEBUGGING(dbcl,dbch) (__debug_msg_enabled[(dbch)][(dbcl)])
|
|---|
| 23 | #define __SET_DEBUGGING(dbcl,dbch,on) (__debug_msg_enabled[(dbch)][(dbcl)] = (on))
|
|---|
| 24 |
|
|---|
| 25 | #define __DPRINTF(dbcl,dbch) \
|
|---|
| 26 | (!__GET_DEBUGGING(dbcl,dbch) || \
|
|---|
| 27 | (dprintf(("%s:%s:%s ", debug_cl_name[(dbcl)], debug_ch_name[(dbch)], __line__)),0)) \
|
|---|
| 28 | ? 0 : WriteLog
|
|---|
| 29 |
|
|---|
| 30 | #define __DUMMY_DPRINTF 1 ? (void)0 : (void)((int (*)(char *, ...)) NULL)
|
|---|
| 31 |
|
|---|
| 32 |
|
|---|
| 33 | /* Exported definitions and macros */
|
|---|
| 34 |
|
|---|
| 35 | /* use configure to allow user to compile out debugging messages */
|
|---|
| 36 | #ifndef NO_TRACE_MSGS
|
|---|
| 37 | #define TRACE __DPRINTF(__DBCL_TRACE,*DBCH_DEFAULT)
|
|---|
| 38 | #define TRACE_(ch) __DPRINTF(__DBCL_TRACE,dbch_##ch)
|
|---|
| 39 | #define TRACE_ON(ch) __GET_DEBUGGING(__DBCL_TRACE,dbch_##ch)
|
|---|
| 40 | #else
|
|---|
| 41 | #define TRACE __DUMMY_DPRINTF
|
|---|
| 42 | #define TRACE_(ch) __DUMMY_DPRINTF
|
|---|
| 43 | #define TRACE_ON(ch) 0
|
|---|
| 44 | #endif /* NO_TRACE_MSGS */
|
|---|
| 45 |
|
|---|
| 46 | #ifndef NO_DEBUG_MSGS
|
|---|
| 47 | #define WARN __DPRINTF(__DBCL_WARN,*DBCH_DEFAULT)
|
|---|
| 48 | #define WARN_(ch) __DPRINTF(__DBCL_WARN,dbch_##ch)
|
|---|
| 49 | #define WARN_ON(ch) __GET_DEBUGGING(__DBCL_WARN,dbch_##ch)
|
|---|
| 50 | #define FIXME __DPRINTF(__DBCL_FIXME,*DBCH_DEFAULT)
|
|---|
| 51 | #define FIXME_(ch) __DPRINTF(__DBCL_FIXME,dbch_##ch)
|
|---|
| 52 | #define FIXME_ON(ch) __GET_DEBUGGING(__DBCL_FIXME,dbch_##ch)
|
|---|
| 53 | #else
|
|---|
| 54 | #define WARN __DUMMY_DPRINTF
|
|---|
| 55 | #define WARN_(ch) __DUMMY_DPRINTF
|
|---|
| 56 | #define WARN_ON(ch) 0
|
|---|
| 57 | #define FIXME __DUMMY_DPRINTF
|
|---|
| 58 | #define FIXME_(ch) __DUMMY_DPRINTF
|
|---|
| 59 | #define FIXME_ON(ch) 0
|
|---|
| 60 | #endif /* NO_DEBUG_MSGS */
|
|---|
| 61 |
|
|---|
| 62 | /* define error macro regardless of what is configured */
|
|---|
| 63 | /* Solaris got an 'ERR' define in <sys/reg.h> */
|
|---|
| 64 | #undef ERR
|
|---|
| 65 | #define ERR __DPRINTF(__DBCL_ERR,*DBCH_DEFAULT)
|
|---|
| 66 | #define ERR_(ch) __DPRINTF(__DBCL_ERR,dbch_##ch)
|
|---|
| 67 | #define ERR_ON(ch) __GET_DEBUGGING(__DBCL_ERR,dbch_##ch)
|
|---|
| 68 |
|
|---|
| 69 | #define DECLARE_DEBUG_CHANNEL(ch) \
|
|---|
| 70 | extern const int dbch_##ch;
|
|---|
| 71 | #define DEFAULT_DEBUG_CHANNEL(ch) \
|
|---|
| 72 | extern const int dbch_##ch; static const int *const DBCH_DEFAULT = &dbch_##ch;
|
|---|
| 73 |
|
|---|
| 74 | #define DPRINTF dbg_printf
|
|---|
| 75 | #define MESSAGE dbg_printf
|
|---|
| 76 |
|
|---|
| 77 | #endif /* __WINE__ */
|
|---|
| 78 |
|
|---|
| 79 | #ifdef __WIN32OS2__
|
|---|
| 80 | # undef DECLARE_DEBUG_CHANNEL
|
|---|
| 81 | # define DECLARE_DEBUG_CHANNEL(ch)
|
|---|
| 82 | # undef DEFAULT_DEBUG_CHANNEL
|
|---|
| 83 | # define DEFAULT_DEBUG_CHANNEL(ch)
|
|---|
| 84 | # undef TRACE
|
|---|
| 85 | # define TRACE WriteLog
|
|---|
| 86 | # undef TRACE_
|
|---|
| 87 | # define TRACE_(ch) WriteLog
|
|---|
| 88 | # undef TRACE_ON
|
|---|
| 89 | # define TRACE_ON(ch) 0
|
|---|
| 90 | # undef FIXME
|
|---|
| 91 | # define FIXME WriteLog
|
|---|
| 92 | # undef FIXME_
|
|---|
| 93 | # define FIXME_(ch) WriteLog
|
|---|
| 94 | # undef FIXME_ON
|
|---|
| 95 | # define FIXME_ON(ch) 0
|
|---|
| 96 | # undef WARN
|
|---|
| 97 | # define WARN WriteLog
|
|---|
| 98 | # undef WARN_
|
|---|
| 99 | # define WARN_(ch) WriteLog
|
|---|
| 100 | # undef WARN_ON
|
|---|
| 101 | # define WARN_ON(ch) 0
|
|---|
| 102 | # undef ERR
|
|---|
| 103 | # define ERR WriteLog
|
|---|
| 104 | # undef ERR_
|
|---|
| 105 | # define ERR_(ch) WriteLog
|
|---|
| 106 | # undef ERR_ON
|
|---|
| 107 | # define ERR_ON(ch) 0
|
|---|
| 108 |
|
|---|
| 109 | #undef __GET_DEBUGGING
|
|---|
| 110 | #define __GET_DEBUGGING(dbcl,dbch)
|
|---|
| 111 | #undef __SET_DEBUGGING
|
|---|
| 112 | #define __SET_DEBUGGING(dbcl,dbch,on)
|
|---|
| 113 |
|
|---|
| 114 | #undef DPRINTF
|
|---|
| 115 | #define DPRINTF WriteLog
|
|---|
| 116 | #undef MESSAGE
|
|---|
| 117 | #define MESSAGE WriteLog
|
|---|
| 118 |
|
|---|
| 119 | #endif
|
|---|
| 120 |
|
|---|
| 121 |
|
|---|
| 122 | #endif /* __WINE_DEBUGTOOLS_H */
|
|---|