af062818b47340eef15700d2f0211576ba3506eevboxsync * Wine debugging interface
af062818b47340eef15700d2f0211576ba3506eevboxsync * Copyright 1999 Patrik Stridvall
af062818b47340eef15700d2f0211576ba3506eevboxsync * This library is free software; you can redistribute it and/or
af062818b47340eef15700d2f0211576ba3506eevboxsync * modify it under the terms of the GNU Lesser General Public
af062818b47340eef15700d2f0211576ba3506eevboxsync * License as published by the Free Software Foundation; either
af062818b47340eef15700d2f0211576ba3506eevboxsync * version 2.1 of the License, or (at your option) any later version.
af062818b47340eef15700d2f0211576ba3506eevboxsync * This library is distributed in the hope that it will be useful,
af062818b47340eef15700d2f0211576ba3506eevboxsync * but WITHOUT ANY WARRANTY; without even the implied warranty of
af062818b47340eef15700d2f0211576ba3506eevboxsync * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
af062818b47340eef15700d2f0211576ba3506eevboxsync * Lesser General Public License for more details.
af062818b47340eef15700d2f0211576ba3506eevboxsync * You should have received a copy of the GNU Lesser General Public
af062818b47340eef15700d2f0211576ba3506eevboxsync * License along with this library; if not, write to the Free Software
af062818b47340eef15700d2f0211576ba3506eevboxsync * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
4b9d6701570cb98fd36e209314239d104ec584d3vboxsync * Oracle LGPL Disclaimer: For the avoidance of doubt, except that if any license choice
4b9d6701570cb98fd36e209314239d104ec584d3vboxsync * other than GPL or LGPL is available it will apply instead, Oracle elects to use only
b955672b950093ff7416d1269dd4d3b69983bd8fvboxsync * the Lesser General Public License version 2.1 (LGPLv2) at this time for any software where
b955672b950093ff7416d1269dd4d3b69983bd8fvboxsync * a choice of LGPL license versions is made available with the language indicating
b955672b950093ff7416d1269dd4d3b69983bd8fvboxsync * that LGPLv2 or any later version may be used, or where a choice of which version
b955672b950093ff7416d1269dd4d3b69983bd8fvboxsync * of the LGPL is applied is otherwise unspecified.
0658e98c3d1b59361863ce3390e57a356fd42217vboxsync#error "Unexpected include! VBOX_WITH_WDDM or VBOX_WINE_WITH_IPRT are defined!"
d2432596ad0325b8a9b42552ce4fcd251f37fcc3vboxsync# define AssertBreakpoint() do { } while (0)
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern "C" {
d2432596ad0325b8a9b42552ce4fcd251f37fcc3vboxsync } while (0)
d2432596ad0325b8a9b42552ce4fcd251f37fcc3vboxsync } while (0)
d2432596ad0325b8a9b42552ce4fcd251f37fcc3vboxsync# define ASSERT_D3D(_e) _ERR_CHECK_ASSERT(D3DErr, _e)
d2432596ad0325b8a9b42552ce4fcd251f37fcc3vboxsync# define ERR_D3D() do {} while (0)
d2432596ad0325b8a9b42552ce4fcd251f37fcc3vboxsync#endif /* #ifdef VBOX_WINE_DEBUG */
af062818b47340eef15700d2f0211576ba3506eevboxsync * Internal definitions (do not use these directly)
af062818b47340eef15700d2f0211576ba3506eevboxsync unsigned char flags;
af062818b47340eef15700d2f0211576ba3506eevboxsync# define __WINE_GET_DEBUGGING_TRACE(dbch) ((dbch)->flags & (1 << __WINE_DBCL_TRACE))
af062818b47340eef15700d2f0211576ba3506eevboxsync# define __WINE_GET_DEBUGGING_WARN(dbch) ((dbch)->flags & (1 << __WINE_DBCL_WARN))
d4af5b054ea5e3fa148cfb539e5fb886338f9c41vboxsync# if 0 && defined(DEBUG_misha)
3c5c04d7b0973be0757addef8ba44b9352b38386vboxsync# define __WINE_GET_DEBUGGING_FIXME(dbch) (RT_BREAKPOINT(), ((dbch)->flags & (1 << __WINE_DBCL_FIXME)))
3c5c04d7b0973be0757addef8ba44b9352b38386vboxsync# define __WINE_GET_DEBUGGING_FIXME(dbch) ((dbch)->flags & (1 << __WINE_DBCL_FIXME))
d4af5b054ea5e3fa148cfb539e5fb886338f9c41vboxsync# if 0 && defined(DEBUG_misha)
3c5c04d7b0973be0757addef8ba44b9352b38386vboxsync# define __WINE_GET_DEBUGGING_FIXME(dbch) (RT_BREAKPOINT(), 0)
af062818b47340eef15700d2f0211576ba3506eevboxsync/* define error macro regardless of what is configured */
3c5c04d7b0973be0757addef8ba44b9352b38386vboxsync#define __WINE_GET_DEBUGGING_ERR(dbch) (RT_BREAKPOINT(), ((dbch)->flags & (1 << __WINE_DBCL_ERR)))
af062818b47340eef15700d2f0211576ba3506eevboxsync#define __WINE_GET_DEBUGGING_ERR(dbch) ((dbch)->flags & (1 << __WINE_DBCL_ERR))
af062818b47340eef15700d2f0211576ba3506eevboxsync#define __WINE_GET_DEBUGGING(dbcl,dbch) __WINE_GET_DEBUGGING##dbcl(dbch)
af062818b47340eef15700d2f0211576ba3506eevboxsync (__WINE_GET_DEBUGGING##dbcl(dbch) && (__wine_dbg_get_channel_flags(dbch) & (1 << __WINE_DBCL##dbcl)))
af062818b47340eef15700d2f0211576ba3506eevboxsync struct __wine_debug_channel * const __dbch = (dbch); \
af062818b47340eef15700d2f0211576ba3506eevboxsync const enum __wine_debug_class __dbcl = __WINE_DBCL##dbcl; \
af062818b47340eef15700d2f0211576ba3506eevboxsync wine_dbg_log( __dbcl, __dbch, __FUNCTION__, args); } } while(0)
af062818b47340eef15700d2f0211576ba3506eevboxsync#define __WINE_PRINTF_ATTR(fmt,args) __attribute__((format (printf,fmt,args)))
af062818b47340eef15700d2f0211576ba3506eevboxsync struct __wine_debug_channel * const __dbch = (dbch); \
af062818b47340eef15700d2f0211576ba3506eevboxsync const enum __WINE_DEBUG_CLASS __dbcl = __WINE_DBCL##dbcl; \
af062818b47340eef15700d2f0211576ba3506eevboxsync wine_dbg_log( __dbcl, __dbch, __func__, __VA_ARGS__); } } while(0)
af062818b47340eef15700d2f0211576ba3506eevboxsync#define WINE_TRACE(...) do { } while(0)
af062818b47340eef15700d2f0211576ba3506eevboxsync#define WINE_WARN(...) do { } while(0)
af062818b47340eef15700d2f0211576ba3506eevboxsync#define WINE_FIXME(...) do { } while(0)
af062818b47340eef15700d2f0211576ba3506eevboxsync#else /* !__GNUC__ && !__SUNPRO_C */
af062818b47340eef15700d2f0211576ba3506eevboxsync (wine_dbg_log(__WINE_DBCL##dbcl,(dbch),__FILE__,"%d: ",__LINE__) == -1)) ? \
af062818b47340eef15700d2f0211576ba3506eevboxsync (void)0 : (void)wine_dbg_printf
af062818b47340eef15700d2f0211576ba3506eevboxsync#endif /* !__GNUC__ && !__SUNPRO_C */
af062818b47340eef15700d2f0211576ba3506eevboxsync void (*release_temp_buffer)( char *buffer, size_t n );
af062818b47340eef15700d2f0211576ba3506eevboxsync const char * (*dbgstr_an)( const char * s, int n );
af062818b47340eef15700d2f0211576ba3506eevboxsync const char * (*dbgstr_wn)( const WCHAR *s, int n );
af062818b47340eef15700d2f0211576ba3506eevboxsync int (*dbg_vprintf)( const char *format, va_list args );
af062818b47340eef15700d2f0211576ba3506eevboxsync int (*dbg_vlog)( enum __wine_debug_class cls, struct __wine_debug_channel *channel,
af062818b47340eef15700d2f0211576ba3506eevboxsync const char *function, const char *format, va_list args );
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern unsigned char __wine_dbg_get_channel_flags( struct __wine_debug_channel *channel );
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern int __wine_dbg_set_channel_flags( struct __wine_debug_channel *channel,
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern void __wine_dbg_set_functions( const struct __wine_debug_functions *new_funcs,
af062818b47340eef15700d2f0211576ba3506eevboxsync struct __wine_debug_functions *old_funcs, size_t size );
af062818b47340eef15700d2f0211576ba3506eevboxsync * Exported definitions and macros
af062818b47340eef15700d2f0211576ba3506eevboxsync/* These functions return a printable version of a string, including
af062818b47340eef15700d2f0211576ba3506eevboxsync quotes. The string will be valid for some time, but not indefinitely
af062818b47340eef15700d2f0211576ba3506eevboxsync as strings are re-used. */
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern const char *wine_dbgstr_an( const char * s, int n );
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern const char *wine_dbgstr_wn( const WCHAR *s, int n );
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern const char *wine_dbg_sprintf( const char *format, ... ) __WINE_PRINTF_ATTR(1,2);
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern int wine_dbg_printf( const char *format, ... ) __WINE_PRINTF_ATTR(1,2);
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern int wine_dbg_log( enum __wine_debug_class cls, struct __wine_debug_channel *ch, const char *func,
af062818b47340eef15700d2f0211576ba3506eevboxsyncstatic inline const char *wine_dbgstr_a( const char *s )
af062818b47340eef15700d2f0211576ba3506eevboxsyncstatic inline const char *wine_dbgstr_w( const WCHAR *s )
af062818b47340eef15700d2f0211576ba3506eevboxsyncstatic inline const char *wine_dbgstr_guid( const GUID *id )
589fd26cedb2b4ebbed14f2964cad03cc8ebbca2vboxsync if (!((ULONG_PTR)id >> 16)) return wine_dbg_sprintf( "<guid-0x%04hx>", (WORD)(ULONG_PTR)id );
af062818b47340eef15700d2f0211576ba3506eevboxsync return wine_dbg_sprintf( "{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
af062818b47340eef15700d2f0211576ba3506eevboxsync id->Data4[0], id->Data4[1], id->Data4[2], id->Data4[3],
af062818b47340eef15700d2f0211576ba3506eevboxsync id->Data4[4], id->Data4[5], id->Data4[6], id->Data4[7] );
af062818b47340eef15700d2f0211576ba3506eevboxsyncstatic inline const char *wine_dbgstr_point( const POINT *pt )
af062818b47340eef15700d2f0211576ba3506eevboxsync return wine_dbg_sprintf( "(%d,%d)", pt->x, pt->y );
af062818b47340eef15700d2f0211576ba3506eevboxsyncstatic inline const char *wine_dbgstr_size( const SIZE *size )
af062818b47340eef15700d2f0211576ba3506eevboxsync return wine_dbg_sprintf( "(%d,%d)", size->cx, size->cy );
af062818b47340eef15700d2f0211576ba3506eevboxsyncstatic inline const char *wine_dbgstr_rect( const RECT *rect )
af062818b47340eef15700d2f0211576ba3506eevboxsync return wine_dbg_sprintf( "(%d,%d)-(%d,%d)", rect->left, rect->top,
af062818b47340eef15700d2f0211576ba3506eevboxsyncstatic inline const char *wine_dbgstr_longlong( ULONGLONG ll )
af062818b47340eef15700d2f0211576ba3506eevboxsync if (sizeof(ll) > sizeof(unsigned long) && ll >> 32)
af062818b47340eef15700d2f0211576ba3506eevboxsync return wine_dbg_sprintf( "%lx%08lx", (unsigned long)(ll >> 32), (unsigned long)ll );
af062818b47340eef15700d2f0211576ba3506eevboxsync else return wine_dbg_sprintf( "%lx", (unsigned long)ll );
af062818b47340eef15700d2f0211576ba3506eevboxsync#define WINE_TRACE __WINE_DPRINTF(_TRACE,__wine_dbch___default)
af062818b47340eef15700d2f0211576ba3506eevboxsync#define WINE_TRACE_(ch) __WINE_DPRINTF(_TRACE,&__wine_dbch_##ch)
af062818b47340eef15700d2f0211576ba3506eevboxsync#define WINE_TRACE_ON(ch) __WINE_IS_DEBUG_ON(_TRACE,&__wine_dbch_##ch)
af062818b47340eef15700d2f0211576ba3506eevboxsync#define WINE_WARN __WINE_DPRINTF(_WARN,__wine_dbch___default)
af062818b47340eef15700d2f0211576ba3506eevboxsync#define WINE_WARN_(ch) __WINE_DPRINTF(_WARN,&__wine_dbch_##ch)
af062818b47340eef15700d2f0211576ba3506eevboxsync#define WINE_WARN_ON(ch) __WINE_IS_DEBUG_ON(_WARN,&__wine_dbch_##ch)
af062818b47340eef15700d2f0211576ba3506eevboxsync#define WINE_FIXME __WINE_DPRINTF(_FIXME,__wine_dbch___default)
af062818b47340eef15700d2f0211576ba3506eevboxsync#define WINE_FIXME_(ch) __WINE_DPRINTF(_FIXME,&__wine_dbch_##ch)
af062818b47340eef15700d2f0211576ba3506eevboxsync#define WINE_FIXME_ON(ch) __WINE_IS_DEBUG_ON(_FIXME,&__wine_dbch_##ch)
af062818b47340eef15700d2f0211576ba3506eevboxsync#define WINE_ERR __WINE_DPRINTF(_ERR,__wine_dbch___default)
af062818b47340eef15700d2f0211576ba3506eevboxsync#define WINE_ERR_(ch) __WINE_DPRINTF(_ERR,&__wine_dbch_##ch)
af062818b47340eef15700d2f0211576ba3506eevboxsync#define WINE_ERR_ON(ch) __WINE_IS_DEBUG_ON(_ERR,&__wine_dbch_##ch)
af062818b47340eef15700d2f0211576ba3506eevboxsync static struct __wine_debug_channel __wine_dbch_##ch = { ~0, #ch }
af062818b47340eef15700d2f0211576ba3506eevboxsync static struct __wine_debug_channel __wine_dbch_##ch = { ~0, #ch }; \
af062818b47340eef15700d2f0211576ba3506eevboxsync static struct __wine_debug_channel * const __wine_dbch___default = &__wine_dbch_##ch
af062818b47340eef15700d2f0211576ba3506eevboxsync/* Wine uses shorter names that are very likely to conflict with other software */
af062818b47340eef15700d2f0211576ba3506eevboxsyncstatic inline const char *debugstr_an( const char * s, int n ) { return wine_dbgstr_an( s, n ); }
af062818b47340eef15700d2f0211576ba3506eevboxsyncstatic inline const char *debugstr_wn( const WCHAR *s, int n ) { return wine_dbgstr_wn( s, n ); }
af062818b47340eef15700d2f0211576ba3506eevboxsyncstatic inline const char *debugstr_guid( const struct _GUID *id ) { return wine_dbgstr_guid(id); }
af062818b47340eef15700d2f0211576ba3506eevboxsyncstatic inline const char *debugstr_a( const char *s ) { return wine_dbgstr_an( s, -1 ); }
af062818b47340eef15700d2f0211576ba3506eevboxsyncstatic inline const char *debugstr_w( const WCHAR *s ) { return wine_dbgstr_wn( s, -1 ); }
af062818b47340eef15700d2f0211576ba3506eevboxsync#undef ERR /* Solaris got an 'ERR' define in <sys/reg.h> */
af062818b47340eef15700d2f0211576ba3506eevboxsync#endif /* __WINESRC__ */
3a343ca21a267ec3c54e2317e2ed18fe99b8ebbbvboxsync//# define VBOXWINEDBG_SHADERS
3a343ca21a267ec3c54e2317e2ed18fe99b8ebbbvboxsync } while (0)
af062818b47340eef15700d2f0211576ba3506eevboxsync#endif /* __WINE_WINE_DEBUG_H */