VirtualBox

source: vbox/trunk/src/VBox/Additions/WINNT/Graphics/Wine/include/wine/debug.h@ 38147

最後變更 在這個檔案從38147是 38147,由 vboxsync 提交於 14 年 前

wddm/wine: disable debugging fixme

  • 屬性 svn:eol-style 設為 native
檔案大小: 10.9 KB
 
1/*
2 * Wine debugging interface
3 *
4 * Copyright 1999 Patrik Stridvall
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 */
20
21/*
22 * Oracle LGPL Disclaimer: For the avoidance of doubt, except that if any license choice
23 * other than GPL or LGPL is available it will apply instead, Oracle elects to use only
24 * the Lesser General Public License version 2.1 (LGPLv2) at this time for any software where
25 * a choice of LGPL license versions is made available with the language indicating
26 * that LGPLv2 or any later version may be used, or where a choice of which version
27 * of the LGPL is applied is otherwise unspecified.
28 */
29
30#ifndef __WINE_WINE_DEBUG_H
31#define __WINE_WINE_DEBUG_H
32
33#include <stdarg.h>
34#include <windef.h>
35#ifndef GUID_DEFINED
36#include <guiddef.h>
37#endif
38
39#ifdef VBOX_WITH_WDDM
40# ifdef VBOX_WINE_WITH_IPRT
41# include <iprt/assert.h>
42# else
43# define AssertBreakpoint() do { } while (0)
44# define Assert(_expr) do { } while (0)
45# define RT_BREAKPOINT()
46# endif
47#endif
48
49#ifdef __WINE_WINE_TEST_H
50#error This file should not be used in Wine tests
51#endif
52
53#ifdef __cplusplus
54extern "C" {
55#endif
56
57struct _GUID;
58
59/*
60 * Internal definitions (do not use these directly)
61 */
62
63enum __wine_debug_class
64{
65 __WINE_DBCL_FIXME,
66 __WINE_DBCL_ERR,
67 __WINE_DBCL_WARN,
68 __WINE_DBCL_TRACE,
69
70 __WINE_DBCL_INIT = 7 /* lazy init flag */
71};
72
73struct __wine_debug_channel
74{
75 unsigned char flags;
76 char name[15];
77};
78
79#ifndef WINE_NO_TRACE_MSGS
80# define __WINE_GET_DEBUGGING_TRACE(dbch) ((dbch)->flags & (1 << __WINE_DBCL_TRACE))
81#else
82# define __WINE_GET_DEBUGGING_TRACE(dbch) 0
83#endif
84
85#ifndef WINE_NO_DEBUG_MSGS
86# define __WINE_GET_DEBUGGING_WARN(dbch) ((dbch)->flags & (1 << __WINE_DBCL_WARN))
87# if 0 && defined(VBOX_WITH_WDDM) && defined(DEBUG_misha)
88# define __WINE_GET_DEBUGGING_FIXME(dbch) (RT_BREAKPOINT(), ((dbch)->flags & (1 << __WINE_DBCL_FIXME)))
89# else
90# define __WINE_GET_DEBUGGING_FIXME(dbch) ((dbch)->flags & (1 << __WINE_DBCL_FIXME))
91# endif
92#else
93# define __WINE_GET_DEBUGGING_WARN(dbch) 0
94# if 0 && defined(VBOX_WITH_WDDM) && defined(DEBUG_misha)
95# define __WINE_GET_DEBUGGING_FIXME(dbch) (RT_BREAKPOINT(), 0)
96# else
97# define __WINE_GET_DEBUGGING_FIXME(dbch) 0
98# endif
99#endif
100
101/* define error macro regardless of what is configured */
102#if defined(VBOX_WITH_WDDM) && defined(DEBUG_misha)
103#define __WINE_GET_DEBUGGING_ERR(dbch) (RT_BREAKPOINT(), ((dbch)->flags & (1 << __WINE_DBCL_ERR)))
104#else
105#define __WINE_GET_DEBUGGING_ERR(dbch) ((dbch)->flags & (1 << __WINE_DBCL_ERR))
106#endif
107
108#define __WINE_GET_DEBUGGING(dbcl,dbch) __WINE_GET_DEBUGGING##dbcl(dbch)
109
110#define __WINE_IS_DEBUG_ON(dbcl,dbch) \
111 (__WINE_GET_DEBUGGING##dbcl(dbch) && (__wine_dbg_get_channel_flags(dbch) & (1 << __WINE_DBCL##dbcl)))
112
113#ifdef __GNUC__
114
115#define __WINE_DPRINTF(dbcl,dbch) \
116 do { if(__WINE_GET_DEBUGGING(dbcl,(dbch))) { \
117 struct __wine_debug_channel * const __dbch = (dbch); \
118 const enum __wine_debug_class __dbcl = __WINE_DBCL##dbcl; \
119 __WINE_DBG_LOG
120
121#define __WINE_DBG_LOG(args...) \
122 wine_dbg_log( __dbcl, __dbch, __FUNCTION__, args); } } while(0)
123
124#define __WINE_PRINTF_ATTR(fmt,args) __attribute__((format (printf,fmt,args)))
125
126
127#ifdef WINE_NO_TRACE_MSGS
128#define WINE_TRACE(args...) do { } while(0)
129#define WINE_TRACE_(ch) WINE_TRACE
130#endif
131
132#ifdef WINE_NO_DEBUG_MSGS
133#define WINE_WARN(args...) do { } while(0)
134#define WINE_WARN_(ch) WINE_WARN
135#define WINE_FIXME(args...) do { } while(0)
136#define WINE_FIXME_(ch) WINE_FIXME
137#endif
138
139#elif defined(__SUNPRO_C)
140
141#define __WINE_DPRINTF(dbcl,dbch) \
142 do { if(__WINE_GET_DEBUGGING(dbcl,(dbch))) { \
143 struct __wine_debug_channel * const __dbch = (dbch); \
144 const enum __WINE_DEBUG_CLASS __dbcl = __WINE_DBCL##dbcl; \
145 __WINE_DBG_LOG
146
147#define __WINE_DBG_LOG(...) \
148 wine_dbg_log( __dbcl, __dbch, __func__, __VA_ARGS__); } } while(0)
149
150#define __WINE_PRINTF_ATTR(fmt,args)
151
152#ifdef WINE_NO_TRACE_MSGS
153#define WINE_TRACE(...) do { } while(0)
154#define WINE_TRACE_(ch) WINE_TRACE
155#endif
156
157#ifdef WINE_NO_DEBUG_MSGS
158#define WINE_WARN(...) do { } while(0)
159#define WINE_WARN_(ch) WINE_WARN
160#define WINE_FIXME(...) do { } while(0)
161#define WINE_FIXME_(ch) WINE_FIXME
162#endif
163
164#else /* !__GNUC__ && !__SUNPRO_C */
165
166#define __WINE_DPRINTF(dbcl,dbch) \
167 (!__WINE_GET_DEBUGGING(dbcl,(dbch)) || \
168 (wine_dbg_log(__WINE_DBCL##dbcl,(dbch),__FILE__,"%d: ",__LINE__) == -1)) ? \
169 (void)0 : (void)wine_dbg_printf
170
171#define __WINE_PRINTF_ATTR(fmt, args)
172
173#endif /* !__GNUC__ && !__SUNPRO_C */
174
175struct __wine_debug_functions
176{
177 char * (*get_temp_buffer)( size_t n );
178 void (*release_temp_buffer)( char *buffer, size_t n );
179 const char * (*dbgstr_an)( const char * s, int n );
180 const char * (*dbgstr_wn)( const WCHAR *s, int n );
181 int (*dbg_vprintf)( const char *format, va_list args );
182 int (*dbg_vlog)( enum __wine_debug_class cls, struct __wine_debug_channel *channel,
183 const char *function, const char *format, va_list args );
184};
185
186extern unsigned char __wine_dbg_get_channel_flags( struct __wine_debug_channel *channel );
187extern int __wine_dbg_set_channel_flags( struct __wine_debug_channel *channel,
188 unsigned char set, unsigned char clear );
189extern void __wine_dbg_set_functions( const struct __wine_debug_functions *new_funcs,
190 struct __wine_debug_functions *old_funcs, size_t size );
191
192/*
193 * Exported definitions and macros
194 */
195
196/* These functions return a printable version of a string, including
197 quotes. The string will be valid for some time, but not indefinitely
198 as strings are re-used. */
199extern const char *wine_dbgstr_an( const char * s, int n );
200extern const char *wine_dbgstr_wn( const WCHAR *s, int n );
201extern const char *wine_dbg_sprintf( const char *format, ... ) __WINE_PRINTF_ATTR(1,2);
202
203extern int wine_dbg_printf( const char *format, ... ) __WINE_PRINTF_ATTR(1,2);
204extern int wine_dbg_log( enum __wine_debug_class cls, struct __wine_debug_channel *ch, const char *func,
205 const char *format, ... ) __WINE_PRINTF_ATTR(4,5);
206
207static inline const char *wine_dbgstr_a( const char *s )
208{
209 return wine_dbgstr_an( s, -1 );
210}
211
212static inline const char *wine_dbgstr_w( const WCHAR *s )
213{
214 return wine_dbgstr_wn( s, -1 );
215}
216
217static inline const char *wine_dbgstr_guid( const GUID *id )
218{
219 if (!id) return "(null)";
220 if (!((ULONG_PTR)id >> 16)) return wine_dbg_sprintf( "<guid-0x%04hx>", (WORD)(ULONG_PTR)id );
221 return wine_dbg_sprintf( "{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
222 id->Data1, id->Data2, id->Data3,
223 id->Data4[0], id->Data4[1], id->Data4[2], id->Data4[3],
224 id->Data4[4], id->Data4[5], id->Data4[6], id->Data4[7] );
225}
226
227static inline const char *wine_dbgstr_point( const POINT *pt )
228{
229 if (!pt) return "(null)";
230 return wine_dbg_sprintf( "(%d,%d)", pt->x, pt->y );
231}
232
233static inline const char *wine_dbgstr_size( const SIZE *size )
234{
235 if (!size) return "(null)";
236 return wine_dbg_sprintf( "(%d,%d)", size->cx, size->cy );
237}
238
239static inline const char *wine_dbgstr_rect( const RECT *rect )
240{
241 if (!rect) return "(null)";
242 return wine_dbg_sprintf( "(%d,%d)-(%d,%d)", rect->left, rect->top,
243 rect->right, rect->bottom );
244}
245
246static inline const char *wine_dbgstr_longlong( ULONGLONG ll )
247{
248 if (sizeof(ll) > sizeof(unsigned long) && ll >> 32)
249 return wine_dbg_sprintf( "%lx%08lx", (unsigned long)(ll >> 32), (unsigned long)ll );
250 else return wine_dbg_sprintf( "%lx", (unsigned long)ll );
251}
252
253#ifndef WINE_TRACE
254#define WINE_TRACE __WINE_DPRINTF(_TRACE,__wine_dbch___default)
255#define WINE_TRACE_(ch) __WINE_DPRINTF(_TRACE,&__wine_dbch_##ch)
256#endif
257#define WINE_TRACE_ON(ch) __WINE_IS_DEBUG_ON(_TRACE,&__wine_dbch_##ch)
258
259#ifndef WINE_WARN
260#define WINE_WARN __WINE_DPRINTF(_WARN,__wine_dbch___default)
261#define WINE_WARN_(ch) __WINE_DPRINTF(_WARN,&__wine_dbch_##ch)
262#endif
263#define WINE_WARN_ON(ch) __WINE_IS_DEBUG_ON(_WARN,&__wine_dbch_##ch)
264
265#ifndef WINE_FIXME
266#define WINE_FIXME __WINE_DPRINTF(_FIXME,__wine_dbch___default)
267#define WINE_FIXME_(ch) __WINE_DPRINTF(_FIXME,&__wine_dbch_##ch)
268#endif
269#define WINE_FIXME_ON(ch) __WINE_IS_DEBUG_ON(_FIXME,&__wine_dbch_##ch)
270
271#define WINE_ERR __WINE_DPRINTF(_ERR,__wine_dbch___default)
272#define WINE_ERR_(ch) __WINE_DPRINTF(_ERR,&__wine_dbch_##ch)
273#define WINE_ERR_ON(ch) __WINE_IS_DEBUG_ON(_ERR,&__wine_dbch_##ch)
274
275#define WINE_DECLARE_DEBUG_CHANNEL(ch) \
276 static struct __wine_debug_channel __wine_dbch_##ch = { ~0, #ch }
277#define WINE_DEFAULT_DEBUG_CHANNEL(ch) \
278 static struct __wine_debug_channel __wine_dbch_##ch = { ~0, #ch }; \
279 static struct __wine_debug_channel * const __wine_dbch___default = &__wine_dbch_##ch
280
281#define WINE_DPRINTF wine_dbg_printf
282#define WINE_MESSAGE wine_dbg_printf
283
284#ifdef __WINESRC__
285/* Wine uses shorter names that are very likely to conflict with other software */
286
287static inline const char *debugstr_an( const char * s, int n ) { return wine_dbgstr_an( s, n ); }
288static inline const char *debugstr_wn( const WCHAR *s, int n ) { return wine_dbgstr_wn( s, n ); }
289static inline const char *debugstr_guid( const struct _GUID *id ) { return wine_dbgstr_guid(id); }
290static inline const char *debugstr_a( const char *s ) { return wine_dbgstr_an( s, -1 ); }
291static inline const char *debugstr_w( const WCHAR *s ) { return wine_dbgstr_wn( s, -1 ); }
292
293#define TRACE WINE_TRACE
294#define TRACE_(ch) WINE_TRACE_(ch)
295#define TRACE_ON(ch) WINE_TRACE_ON(ch)
296
297#define WARN WINE_WARN
298#define WARN_(ch) WINE_WARN_(ch)
299#define WARN_ON(ch) WINE_WARN_ON(ch)
300
301#define FIXME WINE_FIXME
302#define FIXME_(ch) WINE_FIXME_(ch)
303#define FIXME_ON(ch) WINE_FIXME_ON(ch)
304
305#undef ERR /* Solaris got an 'ERR' define in <sys/reg.h> */
306#define ERR WINE_ERR
307#define ERR_(ch) WINE_ERR_(ch)
308#define ERR_ON(ch) WINE_ERR_ON(ch)
309
310#define DPRINTF WINE_DPRINTF
311#define MESSAGE WINE_MESSAGE
312
313#endif /* __WINESRC__ */
314
315#ifdef __cplusplus
316}
317#endif
318
319#endif /* __WINE_WINE_DEBUG_H */
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette