VirtualBox

source: vbox/trunk/src/VBox/Devices/Graphics/shaderlib/libWineStub/include/wine/debug.h@ 64572

最後變更 在這個檔案從64572是 62948,由 vboxsync 提交於 9 年 前

VBoxSVGA3D: warnings

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Author Date Id Revision
檔案大小: 12.2 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 <windows.h>
34#ifndef GUID_DEFINED
35#include <guiddef.h>
36#endif
37
38#ifdef __WINE_WINE_TEST_H
39#error This file should not be used in Wine tests
40#endif
41
42#ifdef VBOX_WINE_WITH_IPRT
43# include <iprt/assert.h>
44#else
45# define AssertBreakpoint() do { } while (0)
46# define Assert(_expr) do { } while (0)
47# ifdef DEBUG_misha
48# include <iprt/cdefs.h>
49# endif
50#endif
51
52#ifdef __cplusplus
53extern "C" {
54#endif
55
56struct _GUID;
57
58//#ifdef DEBUG
59//# define VBOX_WINE_DEBUG
60//#endif
61
62#ifdef VBOX_WINE_DEBUG
63# ifndef VBOX_WINE_DEBUG_DEFINES
64extern DWORD g_VBoxVDbgBreakOnD3DErr;
65# else
66# ifdef DEBUG_misha
67# define _ERR_BREAK_DEFAULT 1
68# else
69# define _ERR_BREAK_DEFAULT 0
70# endif
71DWORD g_VBoxVDbgBreakOnD3DErr = _ERR_BREAK_DEFAULT;
72# endif
73
74# define _ERR_BREAK() Assert(0)
75# define _ERR_ASSERT(_e) Assert((_e))
76# define _ERR_CHECK_BREAK(_t) do { \
77 if (g_VBoxVDbgBreakOn##_t) { _ERR_BREAK(); } \
78 } while (0)
79# define _ERR_CHECK_ASSERT(_t, _e) do { \
80 if (g_VBoxVDbgBreakOn##_t) { _ERR_ASSERT(_e); } \
81 } while (0)
82
83# define ERR_D3D() _ERR_CHECK_BREAK(D3DErr)
84# define ASSERT_D3D(_e) _ERR_CHECK_ASSERT(D3DErr, _e)
85#else
86# define ERR_D3D() ERR("Error!");
87# define ASSERT_D3D(_e) do { \
88 if (!(_e)) \
89 { \
90 ERR("Error: Assertion failure expr (%s)", #_e); \
91 } \
92 } while (0)
93#endif /* #ifdef VBOX_WINE_DEBUG */
94
95#ifdef inline
96#undef inline
97#endif
98#define inline __inline
99
100/*
101 * Internal definitions (do not use these directly)
102 */
103
104enum __wine_debug_class
105{
106 __WINE_DBCL_FIXME,
107 __WINE_DBCL_ERR,
108 __WINE_DBCL_WARN,
109 __WINE_DBCL_TRACE,
110
111 __WINE_DBCL_INIT = 7 /* lazy init flag */
112};
113
114struct __wine_debug_channel
115{
116 unsigned char flags;
117 char name[15];
118};
119
120#ifndef WINE_NO_TRACE_MSGS
121# define __WINE_GET_DEBUGGING_TRACE(dbch) ((dbch)->flags & (1 << __WINE_DBCL_TRACE))
122#else
123# define __WINE_GET_DEBUGGING_TRACE(dbch) 0
124#endif
125
126#ifndef WINE_NO_DEBUG_MSGS
127# define __WINE_GET_DEBUGGING_WARN(dbch) ((dbch)->flags & (1 << __WINE_DBCL_WARN))
128# if 0// && defined(DEBUG_misha)
129# define __WINE_GET_DEBUGGING_FIXME(dbch) (RT_BREAKPOINT(), ((dbch)->flags & (1 << __WINE_DBCL_FIXME)))
130# else
131# define __WINE_GET_DEBUGGING_FIXME(dbch) ((dbch)->flags & (1 << __WINE_DBCL_FIXME))
132# endif
133#else
134# define __WINE_GET_DEBUGGING_WARN(dbch) 0
135# if 0 && defined(DEBUG_misha)
136# define __WINE_GET_DEBUGGING_FIXME(dbch) (RT_BREAKPOINT(), 0)
137# else
138# define __WINE_GET_DEBUGGING_FIXME(dbch) 0
139# endif
140#endif
141
142/* define error macro regardless of what is configured */
143#if defined(DEBUG_misha)
144#define __WINE_GET_DEBUGGING_ERR(dbch) (RT_BREAKPOINT(), ((dbch)->flags & (1 << __WINE_DBCL_ERR)))
145#else
146#define __WINE_GET_DEBUGGING_ERR(dbch) ((dbch)->flags & (1 << __WINE_DBCL_ERR))
147#endif
148
149#define __WINE_GET_DEBUGGING(dbcl,dbch) __WINE_GET_DEBUGGING##dbcl(dbch)
150
151#define __WINE_IS_DEBUG_ON(dbcl,dbch) \
152 (__WINE_GET_DEBUGGING##dbcl(dbch) && (__wine_dbg_get_channel_flags(dbch) & (1 << __WINE_DBCL##dbcl)))
153
154#ifdef __GNUC__
155
156#define __WINE_DPRINTF(dbcl,dbch) \
157 do { if(__WINE_GET_DEBUGGING(dbcl,(dbch))) { \
158 struct __wine_debug_channel * const __dbch = (dbch); \
159 const enum __wine_debug_class __dbcl = __WINE_DBCL##dbcl; \
160 __WINE_DBG_LOG
161
162#define __WINE_DBG_LOG(args...) \
163 wine_dbg_log( __dbcl, __dbch, __FUNCTION__, args); } } while(0)
164
165#define __WINE_PRINTF_ATTR(fmt,args) __attribute__((format (printf,fmt,args)))
166
167
168#ifdef WINE_NO_TRACE_MSGS
169#define WINE_TRACE(args...) do { } while(0)
170#define WINE_TRACE_(ch) WINE_TRACE
171#endif
172
173#ifdef WINE_NO_DEBUG_MSGS
174#define WINE_WARN(args...) do { } while(0)
175#define WINE_WARN_(ch) WINE_WARN
176#define WINE_FIXME(args...) do { } while(0)
177#define WINE_FIXME_(ch) WINE_FIXME
178#endif
179
180#elif defined(__SUNPRO_C)
181
182#define __WINE_DPRINTF(dbcl,dbch) \
183 do { if(__WINE_GET_DEBUGGING(dbcl,(dbch))) { \
184 struct __wine_debug_channel * const __dbch = (dbch); \
185 const enum __WINE_DEBUG_CLASS __dbcl = __WINE_DBCL##dbcl; \
186 __WINE_DBG_LOG
187
188#define __WINE_DBG_LOG(...) \
189 wine_dbg_log( __dbcl, __dbch, __func__, __VA_ARGS__); } } while(0)
190
191#define __WINE_PRINTF_ATTR(fmt,args)
192
193#ifdef WINE_NO_TRACE_MSGS
194#define WINE_TRACE(...) do { } while(0)
195#define WINE_TRACE_(ch) WINE_TRACE
196#endif
197
198#ifdef WINE_NO_DEBUG_MSGS
199#define WINE_WARN(...) do { } while(0)
200#define WINE_WARN_(ch) WINE_WARN
201#define WINE_FIXME(...) do { } while(0)
202#define WINE_FIXME_(ch) WINE_FIXME
203#endif
204
205#else /* !__GNUC__ && !__SUNPRO_C */
206
207#define __WINE_DPRINTF(dbcl,dbch) \
208 (!__WINE_GET_DEBUGGING(dbcl,(dbch)) || \
209 (wine_dbg_log(__WINE_DBCL##dbcl,(dbch),__FILE__,"%d: ",__LINE__) == -1)) ? \
210 (void)0 : (void)wine_dbg_printf
211
212#define __WINE_PRINTF_ATTR(fmt, args)
213
214#endif /* !__GNUC__ && !__SUNPRO_C */
215
216struct __wine_debug_functions
217{
218 char * (*get_temp_buffer)( size_t n );
219 void (*release_temp_buffer)( char *buffer, size_t n );
220 const char * (*dbgstr_an)( const char * s, int n );
221 const char * (*dbgstr_wn)( const WCHAR *s, int n );
222 int (*dbg_vprintf)( const char *format, va_list args );
223 int (*dbg_vlog)( enum __wine_debug_class cls, struct __wine_debug_channel *channel,
224 const char *function, const char *format, va_list args );
225};
226
227extern unsigned char __wine_dbg_get_channel_flags( struct __wine_debug_channel *channel );
228extern int __wine_dbg_set_channel_flags( struct __wine_debug_channel *channel,
229 unsigned char set, unsigned char clear );
230extern void __wine_dbg_set_functions( const struct __wine_debug_functions *new_funcs,
231 struct __wine_debug_functions *old_funcs, size_t size );
232
233/*
234 * Exported definitions and macros
235 */
236
237/* These functions return a printable version of a string, including
238 quotes. The string will be valid for some time, but not indefinitely
239 as strings are re-used. */
240extern const char *wine_dbgstr_an( const char * s, int n );
241extern const char *wine_dbgstr_wn( const WCHAR *s, int n );
242extern const char *wine_dbg_sprintf( const char *format, ... ) __WINE_PRINTF_ATTR(1,2);
243
244extern int wine_dbg_printf( const char *format, ... ) __WINE_PRINTF_ATTR(1,2);
245extern int wine_dbg_log( enum __wine_debug_class cls, struct __wine_debug_channel *ch, const char *func,
246 const char *format, ... ) __WINE_PRINTF_ATTR(4,5);
247
248static inline const char *wine_dbgstr_a( const char *s )
249{
250 return wine_dbgstr_an( s, -1 );
251}
252
253static inline const char *wine_dbgstr_w( const WCHAR *s )
254{
255 return wine_dbgstr_wn( s, -1 );
256}
257
258static inline const char *wine_dbgstr_guid( const GUID *id )
259{
260 if (!id) return "(null)";
261 if (!((ULONG_PTR)id >> 16)) return wine_dbg_sprintf( "<guid-0x%04hx>", (WORD)(ULONG_PTR)id );
262 return wine_dbg_sprintf( "{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
263 id->Data1, id->Data2, id->Data3,
264 id->Data4[0], id->Data4[1], id->Data4[2], id->Data4[3],
265 id->Data4[4], id->Data4[5], id->Data4[6], id->Data4[7] );
266}
267
268static inline const char *wine_dbgstr_point( const POINT *pt )
269{
270 if (!pt) return "(null)";
271 return wine_dbg_sprintf( "(%d,%d)", pt->x, pt->y );
272}
273
274static inline const char *wine_dbgstr_size( const SIZE *size )
275{
276 if (!size) return "(null)";
277 return wine_dbg_sprintf( "(%d,%d)", size->cx, size->cy );
278}
279
280static inline const char *wine_dbgstr_rect( const RECT *rect )
281{
282 if (!rect) return "(null)";
283 return wine_dbg_sprintf( "(%d,%d)-(%d,%d)", rect->left, rect->top,
284 rect->right, rect->bottom );
285}
286
287static inline const char *wine_dbgstr_longlong( ULONGLONG ll )
288{
289 if (sizeof(ll) > sizeof(unsigned long) && ll >> 32)
290 return wine_dbg_sprintf( "%lx%08lx", (unsigned long)(ll >> 32), (unsigned long)ll );
291 else return wine_dbg_sprintf( "%lx", (unsigned long)ll );
292}
293
294#ifndef WINE_TRACE
295#define WINE_TRACE __WINE_DPRINTF(_TRACE,__wine_dbch___default)
296#define WINE_TRACE_(ch) __WINE_DPRINTF(_TRACE,&__wine_dbch_##ch)
297#endif
298#define WINE_TRACE_ON(ch) __WINE_IS_DEBUG_ON(_TRACE,&__wine_dbch_##ch)
299
300#ifndef WINE_WARN
301#define WINE_WARN __WINE_DPRINTF(_WARN,__wine_dbch___default)
302#define WINE_WARN_(ch) __WINE_DPRINTF(_WARN,&__wine_dbch_##ch)
303#endif
304#define WINE_WARN_ON(ch) __WINE_IS_DEBUG_ON(_WARN,&__wine_dbch_##ch)
305
306#ifndef WINE_FIXME
307#define WINE_FIXME __WINE_DPRINTF(_FIXME,__wine_dbch___default)
308#define WINE_FIXME_(ch) __WINE_DPRINTF(_FIXME,&__wine_dbch_##ch)
309#endif
310#define WINE_FIXME_ON(ch) __WINE_IS_DEBUG_ON(_FIXME,&__wine_dbch_##ch)
311
312#define WINE_ERR __WINE_DPRINTF(_ERR,__wine_dbch___default)
313#define WINE_ERR_(ch) __WINE_DPRINTF(_ERR,&__wine_dbch_##ch)
314#define WINE_ERR_ON(ch) __WINE_IS_DEBUG_ON(_ERR,&__wine_dbch_##ch)
315
316#define WINE_DECLARE_DEBUG_CHANNEL(ch) \
317 static struct __wine_debug_channel __wine_dbch_##ch = { /* was: ~0, VBox:*/ UINT8_MAX, #ch }
318#define WINE_DEFAULT_DEBUG_CHANNEL(ch) \
319 static struct __wine_debug_channel __wine_dbch_##ch = { /* was: ~0, VBox:*/ UINT8_MAX, #ch }; \
320 static struct __wine_debug_channel * const __wine_dbch___default = &__wine_dbch_##ch
321
322#define WINE_DPRINTF wine_dbg_printf
323#define WINE_MESSAGE wine_dbg_printf
324
325#ifdef __WINESRC__
326/* Wine uses shorter names that are very likely to conflict with other software */
327
328static inline const char *debugstr_an( const char * s, int n ) { return wine_dbgstr_an( s, n ); }
329static inline const char *debugstr_wn( const WCHAR *s, int n ) { return wine_dbgstr_wn( s, n ); }
330static inline const char *debugstr_guid( const struct _GUID *id ) { return wine_dbgstr_guid(id); }
331static inline const char *debugstr_a( const char *s ) { return wine_dbgstr_an( s, -1 ); }
332static inline const char *debugstr_w( const WCHAR *s ) { return wine_dbgstr_wn( s, -1 ); }
333
334#define TRACE WINE_TRACE
335#define TRACE_(ch) WINE_TRACE_(ch)
336#define TRACE_ON(ch) WINE_TRACE_ON(ch)
337
338#define WARN WINE_WARN
339#define WARN_(ch) WINE_WARN_(ch)
340#define WARN_ON(ch) WINE_WARN_ON(ch)
341
342#define FIXME WINE_FIXME
343#define FIXME_(ch) WINE_FIXME_(ch)
344#define FIXME_ON(ch) WINE_FIXME_ON(ch)
345
346#undef ERR /* Solaris got an 'ERR' define in <sys/reg.h> */
347#define ERR WINE_ERR
348#define ERR_(ch) WINE_ERR_(ch)
349#define ERR_ON(ch) WINE_ERR_ON(ch)
350
351#define DPRINTF WINE_DPRINTF
352#define MESSAGE WINE_MESSAGE
353
354#endif /* __WINESRC__ */
355
356#ifdef __cplusplus
357}
358#endif
359
360
361#if 0//def DEBUG_misha
362# define VBOXWINEDBG_SHADERS
363#endif
364
365#if defined(VBOXWINEDBG_SHADERS) || defined(VBOX_WINE_WITH_PROFILE)
366#include <stdio.h>
367#include <stdarg.h>
368
369void vboxWDbgPrintF(char * szString, ...);
370#endif
371
372#ifdef VBOXWINEDBG_SHADERS
373# define WDLOG(_m) do {\
374 vboxWDbgPrintF _m ; \
375 } while (0)
376#else
377
378# define WDLOG(_m) do { } while (0)
379#endif
380
381#endif /* __WINE_WINE_DEBUG_H */
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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