| 1 |
|
|---|
| 2 | #ifndef __WINE_DEBUGTOOLS_H
|
|---|
| 3 | #define __WINE_DEBUGTOOLS_H
|
|---|
| 4 |
|
|---|
| 5 | #ifdef __WIN32OS2__
|
|---|
| 6 | #include <odinwrap.h>
|
|---|
| 7 |
|
|---|
| 8 | #ifndef __MISC_H__
|
|---|
| 9 |
|
|---|
| 10 | #ifdef DEBUG
|
|---|
| 11 | #ifdef PRIVATE_LOGGING
|
|---|
| 12 | //To use private dll logging, define PRIVATE_LOGGING and
|
|---|
| 13 | //add Open/ClosePrivateLogFiles (see below) functions to the dll
|
|---|
| 14 | //to open close the private logfile. The logfile handle should
|
|---|
| 15 | //be stored in the _privateLogFile variable
|
|---|
| 16 | //dprintf can be called like this:
|
|---|
| 17 | //dprintf((LOG, "PE file : %s", szFileName));
|
|---|
| 18 | #define LOG (void*)_privateLogFile
|
|---|
| 19 | #define dprintf(a) WritePrivateLog a
|
|---|
| 20 | #define dprintfGlobal(a) WriteLog a
|
|---|
| 21 | #else
|
|---|
| 22 | #define dprintf(a) WriteLog a
|
|---|
| 23 | #endif
|
|---|
| 24 | #define eprintf(a) WriteLog a ; WriteLogError a
|
|---|
| 25 | #define dassert(a, b) if(!(a)) WriteLogError b
|
|---|
| 26 | #define dbgCheckObj(a) a->checkObject()
|
|---|
| 27 | #define DisableLogging DecreaseLogCount
|
|---|
| 28 | #define EnableLogging IncreaseLogCount
|
|---|
| 29 |
|
|---|
| 30 | #ifdef DEBUG_ENABLELOG_LEVEL2
|
|---|
| 31 | #ifdef PRIVATE_LOGGING
|
|---|
| 32 | #define dprintf2(a) WritePrivateLog a
|
|---|
| 33 | #else
|
|---|
| 34 | #define dprintf2(a) WriteLog a
|
|---|
| 35 | #endif
|
|---|
| 36 | #else
|
|---|
| 37 | #define dprintf2(a)
|
|---|
| 38 | #endif
|
|---|
| 39 |
|
|---|
| 40 | #else
|
|---|
| 41 | #define dprintfGlobal(a)
|
|---|
| 42 | #define dprintf(a)
|
|---|
| 43 | #define dprintf2(a)
|
|---|
| 44 | #define eprintf(a)
|
|---|
| 45 | #define dassert(a, b)
|
|---|
| 46 | #define dbgCheckObj(a)
|
|---|
| 47 | #define DisableLogging
|
|---|
| 48 | #define EnableLogging
|
|---|
| 49 | #endif
|
|---|
| 50 |
|
|---|
| 51 | int SYSTEM WriteLog(char *tekst, ...);
|
|---|
| 52 | int SYSTEM WritePrivateLog(void *logfile, char *tekst, ...);
|
|---|
| 53 | int SYSTEM WriteLogError(char *tekst, ...);
|
|---|
| 54 |
|
|---|
| 55 | void SYSTEM DecreaseLogCount();
|
|---|
| 56 | void SYSTEM IncreaseLogCount();
|
|---|
| 57 |
|
|---|
| 58 | #endif //__MISC_H__
|
|---|
| 59 |
|
|---|
| 60 | #endif
|
|---|
| 61 |
|
|---|
| 62 | #ifdef __WINE__ /* Debugging interface is internal to Wine */
|
|---|
| 63 |
|
|---|
| 64 | #include <stdio.h>
|
|---|
| 65 | #include "config.h"
|
|---|
| 66 | #include "debugstr.h"
|
|---|
| 67 |
|
|---|
| 68 | #define DEBUG_RUNTIME
|
|---|
| 69 |
|
|---|
| 70 | /* Internal definitions (do not use these directly) */
|
|---|
| 71 |
|
|---|
| 72 | enum __DEBUG_CLASS { __DBCL_FIXME, __DBCL_ERR, __DBCL_WARN, __DBCL_TRACE, __DBCL_COUNT };
|
|---|
| 73 |
|
|---|
| 74 | extern char __debug_msg_enabled[][__DBCL_COUNT];
|
|---|
| 75 |
|
|---|
| 76 | extern const char * const debug_cl_name[__DBCL_COUNT];
|
|---|
| 77 | extern const char * const debug_ch_name[];
|
|---|
| 78 |
|
|---|
| 79 | #define __GET_DEBUGGING(dbcl,dbch) (__debug_msg_enabled[(dbch)][(dbcl)])
|
|---|
| 80 | #define __SET_DEBUGGING(dbcl,dbch,on) (__debug_msg_enabled[(dbch)][(dbcl)] = (on))
|
|---|
| 81 |
|
|---|
| 82 | #define __DPRINTF(dbcl,dbch) \
|
|---|
| 83 | (!__GET_DEBUGGING(dbcl,dbch) || \
|
|---|
| 84 | (dprintf(("%s:%s:%s ", debug_cl_name[(dbcl)], debug_ch_name[(dbch)], __line__)),0)) \
|
|---|
| 85 | ? 0 : WriteLog
|
|---|
| 86 |
|
|---|
| 87 | #define __DUMMY_DPRINTF 1 ? (void)0 : (void)((int (*)(char *, ...)) NULL)
|
|---|
| 88 |
|
|---|
| 89 |
|
|---|
| 90 | /* Exported definitions and macros */
|
|---|
| 91 |
|
|---|
| 92 | /* use configure to allow user to compile out debugging messages */
|
|---|
| 93 | #ifndef NO_TRACE_MSGS
|
|---|
| 94 | #define TRACE __DPRINTF(__DBCL_TRACE,*DBCH_DEFAULT)
|
|---|
| 95 | #define TRACE_(ch) __DPRINTF(__DBCL_TRACE,dbch_##ch)
|
|---|
| 96 | #define TRACE_ON(ch) __GET_DEBUGGING(__DBCL_TRACE,dbch_##ch)
|
|---|
| 97 | #else
|
|---|
| 98 | #define TRACE __DUMMY_DPRINTF
|
|---|
| 99 | #define TRACE_(ch) __DUMMY_DPRINTF
|
|---|
| 100 | #define TRACE_ON(ch) 0
|
|---|
| 101 | #endif /* NO_TRACE_MSGS */
|
|---|
| 102 |
|
|---|
| 103 | #ifndef NO_DEBUG_MSGS
|
|---|
| 104 | #define WARN __DPRINTF(__DBCL_WARN,*DBCH_DEFAULT)
|
|---|
| 105 | #define WARN_(ch) __DPRINTF(__DBCL_WARN,dbch_##ch)
|
|---|
| 106 | #define WARN_ON(ch) __GET_DEBUGGING(__DBCL_WARN,dbch_##ch)
|
|---|
| 107 | #define FIXME __DPRINTF(__DBCL_FIXME,*DBCH_DEFAULT)
|
|---|
| 108 | #define FIXME_(ch) __DPRINTF(__DBCL_FIXME,dbch_##ch)
|
|---|
| 109 | #define FIXME_ON(ch) __GET_DEBUGGING(__DBCL_FIXME,dbch_##ch)
|
|---|
| 110 | #else
|
|---|
| 111 | #define WARN __DUMMY_DPRINTF
|
|---|
| 112 | #define WARN_(ch) __DUMMY_DPRINTF
|
|---|
| 113 | #define WARN_ON(ch) 0
|
|---|
| 114 | #define FIXME __DUMMY_DPRINTF
|
|---|
| 115 | #define FIXME_(ch) __DUMMY_DPRINTF
|
|---|
| 116 | #define FIXME_ON(ch) 0
|
|---|
| 117 | #endif /* NO_DEBUG_MSGS */
|
|---|
| 118 |
|
|---|
| 119 | /* define error macro regardless of what is configured */
|
|---|
| 120 | /* Solaris got an 'ERR' define in <sys/reg.h> */
|
|---|
| 121 | #undef ERR
|
|---|
| 122 | #define ERR __DPRINTF(__DBCL_ERR,*DBCH_DEFAULT)
|
|---|
| 123 | #define ERR_(ch) __DPRINTF(__DBCL_ERR,dbch_##ch)
|
|---|
| 124 | #define ERR_ON(ch) __GET_DEBUGGING(__DBCL_ERR,dbch_##ch)
|
|---|
| 125 |
|
|---|
| 126 | #define DECLARE_DEBUG_CHANNEL(ch) \
|
|---|
| 127 | extern const int dbch_##ch;
|
|---|
| 128 | #define DEFAULT_DEBUG_CHANNEL(ch) \
|
|---|
| 129 | extern const int dbch_##ch; static const int *const DBCH_DEFAULT = &dbch_##ch;
|
|---|
| 130 |
|
|---|
| 131 | #define DPRINTF dbg_printf
|
|---|
| 132 | #define MESSAGE dbg_printf
|
|---|
| 133 |
|
|---|
| 134 | #endif /* __WINE__ */
|
|---|
| 135 |
|
|---|
| 136 | #ifdef __WIN32OS2__
|
|---|
| 137 | # undef DECLARE_DEBUG_CHANNEL
|
|---|
| 138 | # define DECLARE_DEBUG_CHANNEL ODINDEBUGCHANNEL
|
|---|
| 139 | # undef DEFAULT_DEBUG_CHANNEL
|
|---|
| 140 | # define DEFAULT_DEBUG_CHANNEL ODINDEBUGCHANNEL
|
|---|
| 141 | # undef TRACE
|
|---|
| 142 | # define TRACE WriteLog
|
|---|
| 143 | # undef TRACE_
|
|---|
| 144 | # define TRACE_(ch) WriteLog
|
|---|
| 145 | # undef TRACE_ON
|
|---|
| 146 | # define TRACE_ON(ch) 0
|
|---|
| 147 | # undef FIXME
|
|---|
| 148 | # define FIXME WriteLog
|
|---|
| 149 | # undef FIXME_
|
|---|
| 150 | # define FIXME_(ch) WriteLog
|
|---|
| 151 | # undef FIXME_ON
|
|---|
| 152 | # define FIXME_ON(ch) 0
|
|---|
| 153 | # undef WARN
|
|---|
| 154 | # define WARN WriteLog
|
|---|
| 155 | # undef WARN_
|
|---|
| 156 | # define WARN_(ch) WriteLog
|
|---|
| 157 | # undef WARN_ON
|
|---|
| 158 | # define WARN_ON(ch) 0
|
|---|
| 159 | # undef ERR
|
|---|
| 160 | # define ERR WriteLog
|
|---|
| 161 | # undef ERR_
|
|---|
| 162 | # define ERR_(ch) WriteLog
|
|---|
| 163 | # undef ERR_ON
|
|---|
| 164 | # define ERR_ON(ch) 0
|
|---|
| 165 |
|
|---|
| 166 | #undef __GET_DEBUGGING
|
|---|
| 167 | #define __GET_DEBUGGING(dbcl,dbch)
|
|---|
| 168 | #undef __SET_DEBUGGING
|
|---|
| 169 | #define __SET_DEBUGGING(dbcl,dbch,on)
|
|---|
| 170 |
|
|---|
| 171 | #undef DPRINTF
|
|---|
| 172 | #define DPRINTF WriteLog
|
|---|
| 173 | #undef MESSAGE
|
|---|
| 174 | #define MESSAGE WriteLog
|
|---|
| 175 |
|
|---|
| 176 | #endif
|
|---|
| 177 |
|
|---|
| 178 |
|
|---|
| 179 | #endif /* __WINE_DEBUGTOOLS_H */
|
|---|