debug.h revision d2432596ad0325b8a9b42552ce4fcd251f37fcc3
/*
* Wine debugging interface
*
* Copyright 1999 Patrik Stridvall
*
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
/*
* Oracle LGPL Disclaimer: For the avoidance of doubt, except that if any license choice
* other than GPL or LGPL is available it will apply instead, Oracle elects to use only
* the Lesser General Public License version 2.1 (LGPLv2) at this time for any software where
* a choice of LGPL license versions is made available with the language indicating
* that LGPLv2 or any later version may be used, or where a choice of which version
* of the LGPL is applied is otherwise unspecified.
*/
#ifndef __WINE_WINE_DEBUG_H
#define __WINE_WINE_DEBUG_H
#if defined(VBOX_WITH_WDDM) || defined(VBOX_WINE_WITHOUT_LIBWINE)
# error "unexpected include!!"
#endif
#include <stdarg.h>
#include <windef.h>
#ifndef GUID_DEFINED
#include <guiddef.h>
#endif
#ifdef VBOX_WINE_WITH_IPRT
#else
# define AssertBreakpoint() do { } while (0)
# define RT_BREAKPOINT()
#endif
#ifdef __WINE_WINE_TEST_H
#endif
#ifdef __cplusplus
extern "C" {
#endif
struct _GUID;
#ifdef DEBUG
# define VBOX_WINE_DEBUG
#endif
#ifdef VBOX_WINE_DEBUG
# ifndef VBOX_WINE_DEBUG_DEFINES
extern DWORD g_VBoxVDbgBreakOnD3DErr;
# else
# ifdef DEBUG_misha
# define _ERR_BREAK_DEFAULT 1
# else
# define _ERR_BREAK_DEFAULT 0
# endif
# endif
# define _ERR_BREAK() Assert(0)
# define _ERR_CHECK_BREAK(_t) do { \
} while (0)
} while (0)
#else
# define ERR_D3D() do {} while (0)
# define ASSERT_D3D(_e) do {} while (0)
#endif /* #ifdef VBOX_WINE_DEBUG */
/*
* Internal definitions (do not use these directly)
*/
enum __wine_debug_class
{
};
struct __wine_debug_channel
{
unsigned char flags;
char name[15];
};
#ifndef WINE_NO_TRACE_MSGS
#else
# define __WINE_GET_DEBUGGING_TRACE(dbch) 0
#endif
#ifndef WINE_NO_DEBUG_MSGS
# if 0 && defined(VBOX_WITH_WDDM) && defined(DEBUG_misha)
# define __WINE_GET_DEBUGGING_FIXME(dbch) (RT_BREAKPOINT(), ((dbch)->flags & (1 << __WINE_DBCL_FIXME)))
# else
# endif
#else
# define __WINE_GET_DEBUGGING_WARN(dbch) 0
# if 0 && defined(VBOX_WITH_WDDM) && defined(DEBUG_misha)
# else
# define __WINE_GET_DEBUGGING_FIXME(dbch) 0
# endif
#endif
/* define error macro regardless of what is configured */
#if defined(VBOX_WITH_WDDM) && defined(DEBUG_misha)
#else
#endif
(__WINE_GET_DEBUGGING##dbcl(dbch) && (__wine_dbg_get_channel_flags(dbch) & (1 << __WINE_DBCL##dbcl)))
#ifdef __GNUC__
#define __WINE_DBG_LOG(args...) \
#ifdef WINE_NO_TRACE_MSGS
#define WINE_TRACE(args...) do { } while(0)
#endif
#ifdef WINE_NO_DEBUG_MSGS
#define WINE_FIXME(args...) do { } while(0)
#endif
#elif defined(__SUNPRO_C)
#define __WINE_DBG_LOG(...) \
#ifdef WINE_NO_TRACE_MSGS
#define WINE_TRACE(...) do { } while(0)
#endif
#ifdef WINE_NO_DEBUG_MSGS
#define WINE_WARN(...) do { } while(0)
#define WINE_FIXME(...) do { } while(0)
#endif
#else /* !__GNUC__ && !__SUNPRO_C */
(void)0 : (void)wine_dbg_printf
#endif /* !__GNUC__ && !__SUNPRO_C */
struct __wine_debug_functions
{
char * (*get_temp_buffer)( size_t n );
const char * (*dbgstr_an)( const char * s, int n );
};
/*
* Exported definitions and macros
*/
/* These functions return a printable version of a string, including
quotes. The string will be valid for some time, but not indefinitely
as strings are re-used. */
extern const char *wine_dbgstr_an( const char * s, int n );
extern const char *wine_dbgstr_wn( const WCHAR *s, int n );
extern int wine_dbg_log( enum __wine_debug_class cls, struct __wine_debug_channel *ch, const char *func,
static inline const char *wine_dbgstr_a( const char *s )
{
return wine_dbgstr_an( s, -1 );
}
static inline const char *wine_dbgstr_w( const WCHAR *s )
{
return wine_dbgstr_wn( s, -1 );
}
{
if (!id) return "(null)";
return wine_dbg_sprintf( "{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
}
{
if (!pt) return "(null)";
}
{
if (!size) return "(null)";
}
{
if (!rect) return "(null)";
}
{
}
#ifndef WINE_TRACE
#endif
#ifndef WINE_WARN
#endif
#ifndef WINE_FIXME
#endif
#define WINE_DECLARE_DEBUG_CHANNEL(ch) \
#define WINE_DEFAULT_DEBUG_CHANNEL(ch) \
#define WINE_DPRINTF wine_dbg_printf
#define WINE_MESSAGE wine_dbg_printf
#ifdef __WINESRC__
/* Wine uses shorter names that are very likely to conflict with other software */
static inline const char *debugstr_an( const char * s, int n ) { return wine_dbgstr_an( s, n ); }
#define TRACE WINE_TRACE
#define FIXME WINE_FIXME
#define DPRINTF WINE_DPRINTF
#define MESSAGE WINE_MESSAGE
#endif /* __WINESRC__ */
#ifdef __cplusplus
}
#endif
#ifdef DEBUG_misha
//# define VBOXWINEDBG_SHADERS
#endif
#ifdef VBOXWINEDBG_SHADERS
void vboxWDbgPrintF(char * szString, ...);
vboxWDbgPrintF _m ; \
} while (0)
#else
#endif
#endif /* __WINE_WINE_DEBUG_H */