af062818b47340eef15700d2f0211576ba3506eevboxsync/*
af062818b47340eef15700d2f0211576ba3506eevboxsync * Wine debugging interface
af062818b47340eef15700d2f0211576ba3506eevboxsync *
af062818b47340eef15700d2f0211576ba3506eevboxsync * Copyright 1999 Patrik Stridvall
af062818b47340eef15700d2f0211576ba3506eevboxsync *
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 *
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 *
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
af062818b47340eef15700d2f0211576ba3506eevboxsync */
af062818b47340eef15700d2f0211576ba3506eevboxsync
b955672b950093ff7416d1269dd4d3b69983bd8fvboxsync/*
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.
b955672b950093ff7416d1269dd4d3b69983bd8fvboxsync */
b955672b950093ff7416d1269dd4d3b69983bd8fvboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync#ifndef __WINE_WINE_DEBUG_H
af062818b47340eef15700d2f0211576ba3506eevboxsync#define __WINE_WINE_DEBUG_H
af062818b47340eef15700d2f0211576ba3506eevboxsync
0658e98c3d1b59361863ce3390e57a356fd42217vboxsync#error "Unexpected include! VBOX_WITH_WDDM or VBOX_WINE_WITH_IPRT are defined!"
0658e98c3d1b59361863ce3390e57a356fd42217vboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync
d2432596ad0325b8a9b42552ce4fcd251f37fcc3vboxsync#ifdef VBOX_WINE_WITH_IPRT
d2432596ad0325b8a9b42552ce4fcd251f37fcc3vboxsync# include <iprt/assert.h>
d2432596ad0325b8a9b42552ce4fcd251f37fcc3vboxsync#else
d2432596ad0325b8a9b42552ce4fcd251f37fcc3vboxsync# define AssertBreakpoint() do { } while (0)
d2432596ad0325b8a9b42552ce4fcd251f37fcc3vboxsync# define Assert(_expr) do { } while (0)
6cd9e4d9b3398c78dfee8363a3ad75a33304d76cvboxsync# ifdef DEBUG_misha
6cd9e4d9b3398c78dfee8363a3ad75a33304d76cvboxsync# include <iprt/cdefs.h>
6cd9e4d9b3398c78dfee8363a3ad75a33304d76cvboxsync# endif
3c5c04d7b0973be0757addef8ba44b9352b38386vboxsync#endif
3c5c04d7b0973be0757addef8ba44b9352b38386vboxsync
6cd9e4d9b3398c78dfee8363a3ad75a33304d76cvboxsync#include <stdarg.h>
6cd9e4d9b3398c78dfee8363a3ad75a33304d76cvboxsync#include <windef.h>
6cd9e4d9b3398c78dfee8363a3ad75a33304d76cvboxsync#ifndef GUID_DEFINED
6cd9e4d9b3398c78dfee8363a3ad75a33304d76cvboxsync#include <guiddef.h>
6cd9e4d9b3398c78dfee8363a3ad75a33304d76cvboxsync#endif
6cd9e4d9b3398c78dfee8363a3ad75a33304d76cvboxsync
6cd9e4d9b3398c78dfee8363a3ad75a33304d76cvboxsync#include <iprt/assert.h>
6cd9e4d9b3398c78dfee8363a3ad75a33304d76cvboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync#ifdef __WINE_WINE_TEST_H
af062818b47340eef15700d2f0211576ba3506eevboxsync#error This file should not be used in Wine tests
af062818b47340eef15700d2f0211576ba3506eevboxsync#endif
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync#ifdef __cplusplus
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern "C" {
af062818b47340eef15700d2f0211576ba3506eevboxsync#endif
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsyncstruct _GUID;
af062818b47340eef15700d2f0211576ba3506eevboxsync
d2432596ad0325b8a9b42552ce4fcd251f37fcc3vboxsync#ifdef DEBUG
d2432596ad0325b8a9b42552ce4fcd251f37fcc3vboxsync# define VBOX_WINE_DEBUG
d2432596ad0325b8a9b42552ce4fcd251f37fcc3vboxsync#endif
d2432596ad0325b8a9b42552ce4fcd251f37fcc3vboxsync
d2432596ad0325b8a9b42552ce4fcd251f37fcc3vboxsync#ifdef VBOX_WINE_DEBUG
d2432596ad0325b8a9b42552ce4fcd251f37fcc3vboxsync# ifndef VBOX_WINE_DEBUG_DEFINES
d2432596ad0325b8a9b42552ce4fcd251f37fcc3vboxsyncextern DWORD g_VBoxVDbgBreakOnD3DErr;
d2432596ad0325b8a9b42552ce4fcd251f37fcc3vboxsync# else
d2432596ad0325b8a9b42552ce4fcd251f37fcc3vboxsync# ifdef DEBUG_misha
d2432596ad0325b8a9b42552ce4fcd251f37fcc3vboxsync# define _ERR_BREAK_DEFAULT 1
d2432596ad0325b8a9b42552ce4fcd251f37fcc3vboxsync# else
d2432596ad0325b8a9b42552ce4fcd251f37fcc3vboxsync# define _ERR_BREAK_DEFAULT 0
d2432596ad0325b8a9b42552ce4fcd251f37fcc3vboxsync# endif
d2432596ad0325b8a9b42552ce4fcd251f37fcc3vboxsyncDWORD g_VBoxVDbgBreakOnD3DErr = _ERR_BREAK_DEFAULT;
d2432596ad0325b8a9b42552ce4fcd251f37fcc3vboxsync# endif
d2432596ad0325b8a9b42552ce4fcd251f37fcc3vboxsync
d2432596ad0325b8a9b42552ce4fcd251f37fcc3vboxsync# define _ERR_BREAK() Assert(0)
d2432596ad0325b8a9b42552ce4fcd251f37fcc3vboxsync# define _ERR_ASSERT(_e) Assert((_e))
d2432596ad0325b8a9b42552ce4fcd251f37fcc3vboxsync# define _ERR_CHECK_BREAK(_t) do { \
d2432596ad0325b8a9b42552ce4fcd251f37fcc3vboxsync if (g_VBoxVDbgBreakOn##_t) { _ERR_BREAK(); } \
d2432596ad0325b8a9b42552ce4fcd251f37fcc3vboxsync } while (0)
d2432596ad0325b8a9b42552ce4fcd251f37fcc3vboxsync# define _ERR_CHECK_ASSERT(_t, _e) do { \
d2432596ad0325b8a9b42552ce4fcd251f37fcc3vboxsync if (g_VBoxVDbgBreakOn##_t) { _ERR_ASSERT(_e); } \
d2432596ad0325b8a9b42552ce4fcd251f37fcc3vboxsync } while (0)
d2432596ad0325b8a9b42552ce4fcd251f37fcc3vboxsync
d2432596ad0325b8a9b42552ce4fcd251f37fcc3vboxsync# define ERR_D3D() _ERR_CHECK_BREAK(D3DErr)
d2432596ad0325b8a9b42552ce4fcd251f37fcc3vboxsync# define ASSERT_D3D(_e) _ERR_CHECK_ASSERT(D3DErr, _e)
d2432596ad0325b8a9b42552ce4fcd251f37fcc3vboxsync#else
d2432596ad0325b8a9b42552ce4fcd251f37fcc3vboxsync# define ERR_D3D() do {} while (0)
d2432596ad0325b8a9b42552ce4fcd251f37fcc3vboxsync# define ASSERT_D3D(_e) do {} while (0)
d2432596ad0325b8a9b42552ce4fcd251f37fcc3vboxsync#endif /* #ifdef VBOX_WINE_DEBUG */
d2432596ad0325b8a9b42552ce4fcd251f37fcc3vboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync/*
af062818b47340eef15700d2f0211576ba3506eevboxsync * Internal definitions (do not use these directly)
af062818b47340eef15700d2f0211576ba3506eevboxsync */
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsyncenum __wine_debug_class
af062818b47340eef15700d2f0211576ba3506eevboxsync{
af062818b47340eef15700d2f0211576ba3506eevboxsync __WINE_DBCL_FIXME,
af062818b47340eef15700d2f0211576ba3506eevboxsync __WINE_DBCL_ERR,
af062818b47340eef15700d2f0211576ba3506eevboxsync __WINE_DBCL_WARN,
af062818b47340eef15700d2f0211576ba3506eevboxsync __WINE_DBCL_TRACE,
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync __WINE_DBCL_INIT = 7 /* lazy init flag */
af062818b47340eef15700d2f0211576ba3506eevboxsync};
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsyncstruct __wine_debug_channel
af062818b47340eef15700d2f0211576ba3506eevboxsync{
af062818b47340eef15700d2f0211576ba3506eevboxsync unsigned char flags;
af062818b47340eef15700d2f0211576ba3506eevboxsync char name[15];
af062818b47340eef15700d2f0211576ba3506eevboxsync};
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync#ifndef WINE_NO_TRACE_MSGS
af062818b47340eef15700d2f0211576ba3506eevboxsync# define __WINE_GET_DEBUGGING_TRACE(dbch) ((dbch)->flags & (1 << __WINE_DBCL_TRACE))
af062818b47340eef15700d2f0211576ba3506eevboxsync#else
af062818b47340eef15700d2f0211576ba3506eevboxsync# define __WINE_GET_DEBUGGING_TRACE(dbch) 0
af062818b47340eef15700d2f0211576ba3506eevboxsync#endif
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync#ifndef WINE_NO_DEBUG_MSGS
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# else
3c5c04d7b0973be0757addef8ba44b9352b38386vboxsync# define __WINE_GET_DEBUGGING_FIXME(dbch) ((dbch)->flags & (1 << __WINE_DBCL_FIXME))
3c5c04d7b0973be0757addef8ba44b9352b38386vboxsync# endif
af062818b47340eef15700d2f0211576ba3506eevboxsync#else
af062818b47340eef15700d2f0211576ba3506eevboxsync# define __WINE_GET_DEBUGGING_WARN(dbch) 0
d4af5b054ea5e3fa148cfb539e5fb886338f9c41vboxsync# if 0 && defined(DEBUG_misha)
3c5c04d7b0973be0757addef8ba44b9352b38386vboxsync# define __WINE_GET_DEBUGGING_FIXME(dbch) (RT_BREAKPOINT(), 0)
3c5c04d7b0973be0757addef8ba44b9352b38386vboxsync# else
3c5c04d7b0973be0757addef8ba44b9352b38386vboxsync# define __WINE_GET_DEBUGGING_FIXME(dbch) 0
3c5c04d7b0973be0757addef8ba44b9352b38386vboxsync# endif
af062818b47340eef15700d2f0211576ba3506eevboxsync#endif
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync/* define error macro regardless of what is configured */
d4af5b054ea5e3fa148cfb539e5fb886338f9c41vboxsync#if defined(DEBUG_misha)
3c5c04d7b0973be0757addef8ba44b9352b38386vboxsync#define __WINE_GET_DEBUGGING_ERR(dbch) (RT_BREAKPOINT(), ((dbch)->flags & (1 << __WINE_DBCL_ERR)))
3c5c04d7b0973be0757addef8ba44b9352b38386vboxsync#else
af062818b47340eef15700d2f0211576ba3506eevboxsync#define __WINE_GET_DEBUGGING_ERR(dbch) ((dbch)->flags & (1 << __WINE_DBCL_ERR))
3c5c04d7b0973be0757addef8ba44b9352b38386vboxsync#endif
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync#define __WINE_GET_DEBUGGING(dbcl,dbch) __WINE_GET_DEBUGGING##dbcl(dbch)
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync#define __WINE_IS_DEBUG_ON(dbcl,dbch) \
af062818b47340eef15700d2f0211576ba3506eevboxsync (__WINE_GET_DEBUGGING##dbcl(dbch) && (__wine_dbg_get_channel_flags(dbch) & (1 << __WINE_DBCL##dbcl)))
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync#ifdef __GNUC__
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync#define __WINE_DPRINTF(dbcl,dbch) \
af062818b47340eef15700d2f0211576ba3506eevboxsync do { if(__WINE_GET_DEBUGGING(dbcl,(dbch))) { \
af062818b47340eef15700d2f0211576ba3506eevboxsync struct __wine_debug_channel * const __dbch = (dbch); \
af062818b47340eef15700d2f0211576ba3506eevboxsync const enum __wine_debug_class __dbcl = __WINE_DBCL##dbcl; \
af062818b47340eef15700d2f0211576ba3506eevboxsync __WINE_DBG_LOG
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync#define __WINE_DBG_LOG(args...) \
af062818b47340eef15700d2f0211576ba3506eevboxsync wine_dbg_log( __dbcl, __dbch, __FUNCTION__, args); } } while(0)
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync#define __WINE_PRINTF_ATTR(fmt,args) __attribute__((format (printf,fmt,args)))
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync#ifdef WINE_NO_TRACE_MSGS
af062818b47340eef15700d2f0211576ba3506eevboxsync#define WINE_TRACE(args...) do { } while(0)
af062818b47340eef15700d2f0211576ba3506eevboxsync#define WINE_TRACE_(ch) WINE_TRACE
af062818b47340eef15700d2f0211576ba3506eevboxsync#endif
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync#ifdef WINE_NO_DEBUG_MSGS
af062818b47340eef15700d2f0211576ba3506eevboxsync#define WINE_WARN(args...) do { } while(0)
af062818b47340eef15700d2f0211576ba3506eevboxsync#define WINE_WARN_(ch) WINE_WARN
af062818b47340eef15700d2f0211576ba3506eevboxsync#define WINE_FIXME(args...) do { } while(0)
af062818b47340eef15700d2f0211576ba3506eevboxsync#define WINE_FIXME_(ch) WINE_FIXME
af062818b47340eef15700d2f0211576ba3506eevboxsync#endif
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync#elif defined(__SUNPRO_C)
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync#define __WINE_DPRINTF(dbcl,dbch) \
af062818b47340eef15700d2f0211576ba3506eevboxsync do { if(__WINE_GET_DEBUGGING(dbcl,(dbch))) { \
af062818b47340eef15700d2f0211576ba3506eevboxsync struct __wine_debug_channel * const __dbch = (dbch); \
af062818b47340eef15700d2f0211576ba3506eevboxsync const enum __WINE_DEBUG_CLASS __dbcl = __WINE_DBCL##dbcl; \
af062818b47340eef15700d2f0211576ba3506eevboxsync __WINE_DBG_LOG
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync#define __WINE_DBG_LOG(...) \
af062818b47340eef15700d2f0211576ba3506eevboxsync wine_dbg_log( __dbcl, __dbch, __func__, __VA_ARGS__); } } while(0)
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync#define __WINE_PRINTF_ATTR(fmt,args)
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync#ifdef WINE_NO_TRACE_MSGS
af062818b47340eef15700d2f0211576ba3506eevboxsync#define WINE_TRACE(...) do { } while(0)
af062818b47340eef15700d2f0211576ba3506eevboxsync#define WINE_TRACE_(ch) WINE_TRACE
af062818b47340eef15700d2f0211576ba3506eevboxsync#endif
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync#ifdef WINE_NO_DEBUG_MSGS
af062818b47340eef15700d2f0211576ba3506eevboxsync#define WINE_WARN(...) do { } while(0)
af062818b47340eef15700d2f0211576ba3506eevboxsync#define WINE_WARN_(ch) WINE_WARN
af062818b47340eef15700d2f0211576ba3506eevboxsync#define WINE_FIXME(...) do { } while(0)
af062818b47340eef15700d2f0211576ba3506eevboxsync#define WINE_FIXME_(ch) WINE_FIXME
af062818b47340eef15700d2f0211576ba3506eevboxsync#endif
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync#else /* !__GNUC__ && !__SUNPRO_C */
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync#define __WINE_DPRINTF(dbcl,dbch) \
af062818b47340eef15700d2f0211576ba3506eevboxsync (!__WINE_GET_DEBUGGING(dbcl,(dbch)) || \
af062818b47340eef15700d2f0211576ba3506eevboxsync (wine_dbg_log(__WINE_DBCL##dbcl,(dbch),__FILE__,"%d: ",__LINE__) == -1)) ? \
af062818b47340eef15700d2f0211576ba3506eevboxsync (void)0 : (void)wine_dbg_printf
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync#define __WINE_PRINTF_ATTR(fmt, args)
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync#endif /* !__GNUC__ && !__SUNPRO_C */
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsyncstruct __wine_debug_functions
af062818b47340eef15700d2f0211576ba3506eevboxsync{
af062818b47340eef15700d2f0211576ba3506eevboxsync char * (*get_temp_buffer)( size_t n );
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 );
af062818b47340eef15700d2f0211576ba3506eevboxsync};
af062818b47340eef15700d2f0211576ba3506eevboxsync
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,
af062818b47340eef15700d2f0211576ba3506eevboxsync unsigned char set, unsigned char clear );
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern void __wine_dbg_set_functions( const struct __wine_debug_functions *new_funcs,
af062818b47340eef15700d2f0211576ba3506eevboxsync struct __wine_debug_functions *old_funcs, size_t size );
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync/*
af062818b47340eef15700d2f0211576ba3506eevboxsync * Exported definitions and macros
af062818b47340eef15700d2f0211576ba3506eevboxsync */
af062818b47340eef15700d2f0211576ba3506eevboxsync
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);
af062818b47340eef15700d2f0211576ba3506eevboxsync
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,
af062818b47340eef15700d2f0211576ba3506eevboxsync const char *format, ... ) __WINE_PRINTF_ATTR(4,5);
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsyncstatic inline const char *wine_dbgstr_a( const char *s )
af062818b47340eef15700d2f0211576ba3506eevboxsync{
af062818b47340eef15700d2f0211576ba3506eevboxsync return wine_dbgstr_an( s, -1 );
af062818b47340eef15700d2f0211576ba3506eevboxsync}
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsyncstatic inline const char *wine_dbgstr_w( const WCHAR *s )
af062818b47340eef15700d2f0211576ba3506eevboxsync{
af062818b47340eef15700d2f0211576ba3506eevboxsync return wine_dbgstr_wn( s, -1 );
af062818b47340eef15700d2f0211576ba3506eevboxsync}
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsyncstatic inline const char *wine_dbgstr_guid( const GUID *id )
af062818b47340eef15700d2f0211576ba3506eevboxsync{
af062818b47340eef15700d2f0211576ba3506eevboxsync if (!id) return "(null)";
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->Data1, id->Data2, id->Data3,
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] );
af062818b47340eef15700d2f0211576ba3506eevboxsync}
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsyncstatic inline const char *wine_dbgstr_point( const POINT *pt )
af062818b47340eef15700d2f0211576ba3506eevboxsync{
af062818b47340eef15700d2f0211576ba3506eevboxsync if (!pt) return "(null)";
af062818b47340eef15700d2f0211576ba3506eevboxsync return wine_dbg_sprintf( "(%d,%d)", pt->x, pt->y );
af062818b47340eef15700d2f0211576ba3506eevboxsync}
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsyncstatic inline const char *wine_dbgstr_size( const SIZE *size )
af062818b47340eef15700d2f0211576ba3506eevboxsync{
af062818b47340eef15700d2f0211576ba3506eevboxsync if (!size) return "(null)";
af062818b47340eef15700d2f0211576ba3506eevboxsync return wine_dbg_sprintf( "(%d,%d)", size->cx, size->cy );
af062818b47340eef15700d2f0211576ba3506eevboxsync}
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsyncstatic inline const char *wine_dbgstr_rect( const RECT *rect )
af062818b47340eef15700d2f0211576ba3506eevboxsync{
af062818b47340eef15700d2f0211576ba3506eevboxsync if (!rect) return "(null)";
af062818b47340eef15700d2f0211576ba3506eevboxsync return wine_dbg_sprintf( "(%d,%d)-(%d,%d)", rect->left, rect->top,
af062818b47340eef15700d2f0211576ba3506eevboxsync rect->right, rect->bottom );
af062818b47340eef15700d2f0211576ba3506eevboxsync}
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsyncstatic inline const char *wine_dbgstr_longlong( ULONGLONG ll )
af062818b47340eef15700d2f0211576ba3506eevboxsync{
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}
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync#ifndef WINE_TRACE
af062818b47340eef15700d2f0211576ba3506eevboxsync#define WINE_TRACE __WINE_DPRINTF(_TRACE,__wine_dbch___default)
af062818b47340eef15700d2f0211576ba3506eevboxsync#define WINE_TRACE_(ch) __WINE_DPRINTF(_TRACE,&__wine_dbch_##ch)
af062818b47340eef15700d2f0211576ba3506eevboxsync#endif
af062818b47340eef15700d2f0211576ba3506eevboxsync#define WINE_TRACE_ON(ch) __WINE_IS_DEBUG_ON(_TRACE,&__wine_dbch_##ch)
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync#ifndef WINE_WARN
af062818b47340eef15700d2f0211576ba3506eevboxsync#define WINE_WARN __WINE_DPRINTF(_WARN,__wine_dbch___default)
af062818b47340eef15700d2f0211576ba3506eevboxsync#define WINE_WARN_(ch) __WINE_DPRINTF(_WARN,&__wine_dbch_##ch)
af062818b47340eef15700d2f0211576ba3506eevboxsync#endif
af062818b47340eef15700d2f0211576ba3506eevboxsync#define WINE_WARN_ON(ch) __WINE_IS_DEBUG_ON(_WARN,&__wine_dbch_##ch)
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync#ifndef WINE_FIXME
af062818b47340eef15700d2f0211576ba3506eevboxsync#define WINE_FIXME __WINE_DPRINTF(_FIXME,__wine_dbch___default)
af062818b47340eef15700d2f0211576ba3506eevboxsync#define WINE_FIXME_(ch) __WINE_DPRINTF(_FIXME,&__wine_dbch_##ch)
af062818b47340eef15700d2f0211576ba3506eevboxsync#endif
af062818b47340eef15700d2f0211576ba3506eevboxsync#define WINE_FIXME_ON(ch) __WINE_IS_DEBUG_ON(_FIXME,&__wine_dbch_##ch)
af062818b47340eef15700d2f0211576ba3506eevboxsync
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
af062818b47340eef15700d2f0211576ba3506eevboxsync#define WINE_DECLARE_DEBUG_CHANNEL(ch) \
af062818b47340eef15700d2f0211576ba3506eevboxsync static struct __wine_debug_channel __wine_dbch_##ch = { ~0, #ch }
af062818b47340eef15700d2f0211576ba3506eevboxsync#define WINE_DEFAULT_DEBUG_CHANNEL(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
af062818b47340eef15700d2f0211576ba3506eevboxsync#define WINE_DPRINTF wine_dbg_printf
af062818b47340eef15700d2f0211576ba3506eevboxsync#define WINE_MESSAGE wine_dbg_printf
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync#ifdef __WINESRC__
af062818b47340eef15700d2f0211576ba3506eevboxsync/* Wine uses shorter names that are very likely to conflict with other software */
af062818b47340eef15700d2f0211576ba3506eevboxsync
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
af062818b47340eef15700d2f0211576ba3506eevboxsync#define TRACE WINE_TRACE
af062818b47340eef15700d2f0211576ba3506eevboxsync#define TRACE_(ch) WINE_TRACE_(ch)
af062818b47340eef15700d2f0211576ba3506eevboxsync#define TRACE_ON(ch) WINE_TRACE_ON(ch)
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync#define WARN WINE_WARN
af062818b47340eef15700d2f0211576ba3506eevboxsync#define WARN_(ch) WINE_WARN_(ch)
af062818b47340eef15700d2f0211576ba3506eevboxsync#define WARN_ON(ch) WINE_WARN_ON(ch)
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync#define FIXME WINE_FIXME
af062818b47340eef15700d2f0211576ba3506eevboxsync#define FIXME_(ch) WINE_FIXME_(ch)
af062818b47340eef15700d2f0211576ba3506eevboxsync#define FIXME_ON(ch) WINE_FIXME_ON(ch)
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync#undef ERR /* Solaris got an 'ERR' define in <sys/reg.h> */
af062818b47340eef15700d2f0211576ba3506eevboxsync#define ERR WINE_ERR
af062818b47340eef15700d2f0211576ba3506eevboxsync#define ERR_(ch) WINE_ERR_(ch)
af062818b47340eef15700d2f0211576ba3506eevboxsync#define ERR_ON(ch) WINE_ERR_ON(ch)
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync#define DPRINTF WINE_DPRINTF
af062818b47340eef15700d2f0211576ba3506eevboxsync#define MESSAGE WINE_MESSAGE
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync#endif /* __WINESRC__ */
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync#ifdef __cplusplus
af062818b47340eef15700d2f0211576ba3506eevboxsync}
af062818b47340eef15700d2f0211576ba3506eevboxsync#endif
af062818b47340eef15700d2f0211576ba3506eevboxsync
3a343ca21a267ec3c54e2317e2ed18fe99b8ebbbvboxsync
3a343ca21a267ec3c54e2317e2ed18fe99b8ebbbvboxsync#ifdef DEBUG_misha
3a343ca21a267ec3c54e2317e2ed18fe99b8ebbbvboxsync//# define VBOXWINEDBG_SHADERS
3a343ca21a267ec3c54e2317e2ed18fe99b8ebbbvboxsync#endif
3a343ca21a267ec3c54e2317e2ed18fe99b8ebbbvboxsync
3a343ca21a267ec3c54e2317e2ed18fe99b8ebbbvboxsync#ifdef VBOXWINEDBG_SHADERS
3a343ca21a267ec3c54e2317e2ed18fe99b8ebbbvboxsync
3a343ca21a267ec3c54e2317e2ed18fe99b8ebbbvboxsyncvoid vboxWDbgPrintF(char * szString, ...);
3a343ca21a267ec3c54e2317e2ed18fe99b8ebbbvboxsync
3a343ca21a267ec3c54e2317e2ed18fe99b8ebbbvboxsync# define WDLOG(_m) do {\
3a343ca21a267ec3c54e2317e2ed18fe99b8ebbbvboxsync vboxWDbgPrintF _m ; \
3a343ca21a267ec3c54e2317e2ed18fe99b8ebbbvboxsync } while (0)
3a343ca21a267ec3c54e2317e2ed18fe99b8ebbbvboxsync#else
3a343ca21a267ec3c54e2317e2ed18fe99b8ebbbvboxsync
3a343ca21a267ec3c54e2317e2ed18fe99b8ebbbvboxsync# define WDLOG(_m) do { } while (0)
3a343ca21a267ec3c54e2317e2ed18fe99b8ebbbvboxsync#endif
3a343ca21a267ec3c54e2317e2ed18fe99b8ebbbvboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync#endif /* __WINE_WINE_DEBUG_H */