058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync/*
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync * Wine debugging interface
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync *
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync * Copyright 1999 Patrik Stridvall
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync *
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync * This library is free software; you can redistribute it and/or
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync * modify it under the terms of the GNU Lesser General Public
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync * License as published by the Free Software Foundation; either
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync * version 2.1 of the License, or (at your option) any later version.
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync *
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync * This library is distributed in the hope that it will be useful,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync * but WITHOUT ANY WARRANTY; without even the implied warranty of
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync * Lesser General Public License for more details.
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync *
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync * You should have received a copy of the GNU Lesser General Public
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync * License along with this library; if not, write to the Free Software
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync */
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
4237d5a79f48789aacc67dc43378d2d7813a39f4vboxsync/*
4237d5a79f48789aacc67dc43378d2d7813a39f4vboxsync * Oracle LGPL Disclaimer: For the avoidance of doubt, except that if any license choice
4237d5a79f48789aacc67dc43378d2d7813a39f4vboxsync * other than GPL or LGPL is available it will apply instead, Oracle elects to use only
4237d5a79f48789aacc67dc43378d2d7813a39f4vboxsync * the Lesser General Public License version 2.1 (LGPLv2) at this time for any software where
4237d5a79f48789aacc67dc43378d2d7813a39f4vboxsync * a choice of LGPL license versions is made available with the language indicating
4237d5a79f48789aacc67dc43378d2d7813a39f4vboxsync * that LGPLv2 or any later version may be used, or where a choice of which version
4237d5a79f48789aacc67dc43378d2d7813a39f4vboxsync * of the LGPL is applied is otherwise unspecified.
4237d5a79f48789aacc67dc43378d2d7813a39f4vboxsync */
4237d5a79f48789aacc67dc43378d2d7813a39f4vboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#ifndef __WINE_WINE_DEBUG_H
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#define __WINE_WINE_DEBUG_H
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#include <stdarg.h>
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#include <windef.h>
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#ifndef GUID_DEFINED
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#include <guiddef.h>
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#endif
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#ifdef __WINE_WINE_TEST_H
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#error This file should not be used in Wine tests
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#endif
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync//#ifdef VBOX_WINE_WITH_IPRT
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync# include <iprt/assert.h>
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync//#else
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync//# define AssertBreakpoint() do { } while (0)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync//# define Assert(_expr) do { } while (0)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync//# ifdef DEBUG_misha
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync//# include <iprt/cdefs.h>
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync//# endif
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync//#endif
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#ifdef __cplusplus
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncextern "C" {
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#endif
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstruct _GUID;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#if !defined(__cplusplus) && !defined(inline)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync# define inline _inline
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#endif
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync/*
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync * Internal definitions (do not use these directly)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync */
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncenum __wine_debug_class
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync __WINE_DBCL_FIXME,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync __WINE_DBCL_ERR,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync __WINE_DBCL_WARN,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync __WINE_DBCL_TRACE,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync __WINE_DBCL_INIT = 7 /* lazy init flag */
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync};
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstruct __wine_debug_channel
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync unsigned char flags;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync char name[15];
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync};
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#ifdef VBOX_WINE_BEAK_ON_TRACE
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncextern DWORD g_VDbgBreakOnTrace;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#endif
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#ifndef WINE_NO_TRACE_MSGS
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync# ifdef VBOX_WINE_BEAK_ON_TRACE
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync# define __WINE_GET_DEBUGGING_TRACE(dbch) ((g_VDbgBreakOnTrace ? (RT_BREAKPOINT(),NULL) : NULL), ((dbch)->flags & (1 << __WINE_DBCL_TRACE)))
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync# else
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync# define __WINE_GET_DEBUGGING_TRACE(dbch) ((dbch)->flags & (1 << __WINE_DBCL_TRACE))
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync# endif
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#else
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync# define __WINE_GET_DEBUGGING_TRACE(dbch) 0
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#endif
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#ifndef WINE_NO_DEBUG_MSGS
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync# define __WINE_GET_DEBUGGING_WARN(dbch) ((dbch)->flags & (1 << __WINE_DBCL_WARN))
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync# define __WINE_GET_DEBUGGING_FIXME(dbch) ((dbch)->flags & (1 << __WINE_DBCL_FIXME))
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#else
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync# define __WINE_GET_DEBUGGING_WARN(dbch) 0
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync# define __WINE_GET_DEBUGGING_FIXME(dbch) 0
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#endif
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync/* define error macro regardless of what is configured */
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#ifdef DEBUG_misha
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#define __WINE_GET_DEBUGGING_ERR(dbch) (RT_BREAKPOINT(), ((dbch)->flags & (1 << __WINE_DBCL_ERR)))
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#else
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#define __WINE_GET_DEBUGGING_ERR(dbch) ((dbch)->flags & (1 << __WINE_DBCL_ERR))
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#endif
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#define __WINE_GET_DEBUGGING(dbcl,dbch) __WINE_GET_DEBUGGING##dbcl(dbch)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#define __WINE_IS_DEBUG_ON(dbcl,dbch) \
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync (__WINE_GET_DEBUGGING##dbcl(dbch) && (__wine_dbg_get_channel_flags(dbch) & (1 << __WINE_DBCL##dbcl)))
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#ifdef __GNUC__
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#define __WINE_DPRINTF(dbcl,dbch) \
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync do { if(__WINE_GET_DEBUGGING(dbcl,(dbch))) { \
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct __wine_debug_channel * const __dbch = (dbch); \
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync const enum __wine_debug_class __dbcl = __WINE_DBCL##dbcl; \
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync __WINE_DBG_LOG
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#define __WINE_DBG_LOG(args...) \
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wine_dbg_log( __dbcl, __dbch, __FUNCTION__, args); } } while(0)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#define __WINE_PRINTF_ATTR(fmt,args) __attribute__((format (printf,fmt,args)))
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#ifdef WINE_NO_TRACE_MSGS
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#define WINE_TRACE(args...) do { } while(0)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#define WINE_TRACE_(ch) WINE_TRACE
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#endif
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#ifdef WINE_NO_DEBUG_MSGS
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#define WINE_WARN(args...) do { } while(0)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#define WINE_WARN_(ch) WINE_WARN
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#define WINE_FIXME(args...) do { } while(0)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#define WINE_FIXME_(ch) WINE_FIXME
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#endif
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#elif defined(__SUNPRO_C)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#define __WINE_DPRINTF(dbcl,dbch) \
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync do { if(__WINE_GET_DEBUGGING(dbcl,(dbch))) { \
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct __wine_debug_channel * const __dbch = (dbch); \
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync const enum __WINE_DEBUG_CLASS __dbcl = __WINE_DBCL##dbcl; \
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync __WINE_DBG_LOG
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#define __WINE_DBG_LOG(...) \
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wine_dbg_log( __dbcl, __dbch, __func__, __VA_ARGS__); } } while(0)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#define __WINE_PRINTF_ATTR(fmt,args)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#ifdef WINE_NO_TRACE_MSGS
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#define WINE_TRACE(...) do { } while(0)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#define WINE_TRACE_(ch) WINE_TRACE
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#endif
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#ifdef WINE_NO_DEBUG_MSGS
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#define WINE_WARN(...) do { } while(0)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#define WINE_WARN_(ch) WINE_WARN
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#define WINE_FIXME(...) do { } while(0)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#define WINE_FIXME_(ch) WINE_FIXME
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#endif
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#else /* !__GNUC__ && !__SUNPRO_C */
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#define __WINE_DPRINTF(dbcl,dbch) \
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync (!__WINE_GET_DEBUGGING(dbcl,(dbch)) || \
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync (wine_dbg_log(__WINE_DBCL##dbcl,(dbch),__FILE__,"%d: ",__LINE__) == -1)) ? \
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync (void)0 : (void)wine_dbg_printf
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#define __WINE_PRINTF_ATTR(fmt, args)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#endif /* !__GNUC__ && !__SUNPRO_C */
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstruct __wine_debug_functions
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync char * (*get_temp_buffer)( size_t n );
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync void (*release_temp_buffer)( char *buffer, size_t n );
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync const char * (*dbgstr_an)( const char * s, int n );
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync const char * (*dbgstr_wn)( const WCHAR *s, int n );
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync int (*dbg_vprintf)( const char *format, va_list args );
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync int (*dbg_vlog)( enum __wine_debug_class cls, struct __wine_debug_channel *channel,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync const char *function, const char *format, va_list args );
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync};
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncextern unsigned char __wine_dbg_get_channel_flags( struct __wine_debug_channel *channel );
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncextern int __wine_dbg_set_channel_flags( struct __wine_debug_channel *channel,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync unsigned char set, unsigned char clear );
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncextern void __wine_dbg_set_functions( const struct __wine_debug_functions *new_funcs,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct __wine_debug_functions *old_funcs, size_t size );
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync/*
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync * Exported definitions and macros
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync */
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync/* These functions return a printable version of a string, including
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync quotes. The string will be valid for some time, but not indefinitely
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync as strings are re-used. */
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncextern const char *wine_dbgstr_an( const char * s, int n );
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncextern const char *wine_dbgstr_wn( const WCHAR *s, int n );
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncextern const char *wine_dbg_sprintf( const char *format, ... ) __WINE_PRINTF_ATTR(1,2);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncextern int wine_dbg_printf( const char *format, ... ) __WINE_PRINTF_ATTR(1,2);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncextern int wine_dbg_log( enum __wine_debug_class cls, struct __wine_debug_channel *ch, const char *func,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync const char *format, ... ) __WINE_PRINTF_ATTR(4,5);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic inline const char *wine_dbgstr_a( const char *s )
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return wine_dbgstr_an( s, -1 );
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic inline const char *wine_dbgstr_w( const WCHAR *s )
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return wine_dbgstr_wn( s, -1 );
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic inline const char *wine_dbgstr_guid( const GUID *id )
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync if (!id) return "(null)";
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync if (!((ULONG_PTR)id >> 16)) return wine_dbg_sprintf( "<guid-0x%04hx>", (WORD)(ULONG_PTR)id );
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return wine_dbg_sprintf( "{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync id->Data1, id->Data2, id->Data3,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync id->Data4[0], id->Data4[1], id->Data4[2], id->Data4[3],
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync id->Data4[4], id->Data4[5], id->Data4[6], id->Data4[7] );
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic inline const char *wine_dbgstr_point( const POINT *pt )
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync if (!pt) return "(null)";
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return wine_dbg_sprintf( "(%d,%d)", pt->x, pt->y );
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic inline const char *wine_dbgstr_size( const SIZE *size )
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync if (!size) return "(null)";
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return wine_dbg_sprintf( "(%d,%d)", size->cx, size->cy );
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic inline const char *wine_dbgstr_rect( const RECT *rect )
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync if (!rect) return "(null)";
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return wine_dbg_sprintf( "(%d,%d)-(%d,%d)", rect->left, rect->top,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync rect->right, rect->bottom );
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic inline const char *wine_dbgstr_longlong( ULONGLONG ll )
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync if (sizeof(ll) > sizeof(unsigned long) && ll >> 32)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return wine_dbg_sprintf( "%lx%08lx", (unsigned long)(ll >> 32), (unsigned long)ll );
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync else return wine_dbg_sprintf( "%lx", (unsigned long)ll );
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#ifndef WINE_TRACE
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#define WINE_TRACE __WINE_DPRINTF(_TRACE,__wine_dbch___default)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#define WINE_TRACE_(ch) __WINE_DPRINTF(_TRACE,&__wine_dbch_##ch)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#endif
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#define WINE_TRACE_ON(ch) __WINE_IS_DEBUG_ON(_TRACE,&__wine_dbch_##ch)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#ifndef WINE_WARN
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#define WINE_WARN __WINE_DPRINTF(_WARN,__wine_dbch___default)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#define WINE_WARN_(ch) __WINE_DPRINTF(_WARN,&__wine_dbch_##ch)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#endif
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#define WINE_WARN_ON(ch) __WINE_IS_DEBUG_ON(_WARN,&__wine_dbch_##ch)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#ifndef WINE_FIXME
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#define WINE_FIXME __WINE_DPRINTF(_FIXME,__wine_dbch___default)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#define WINE_FIXME_(ch) __WINE_DPRINTF(_FIXME,&__wine_dbch_##ch)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#endif
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#define WINE_FIXME_ON(ch) __WINE_IS_DEBUG_ON(_FIXME,&__wine_dbch_##ch)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#define WINE_ERR __WINE_DPRINTF(_ERR,__wine_dbch___default)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#define WINE_ERR_(ch) __WINE_DPRINTF(_ERR,&__wine_dbch_##ch)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#define WINE_ERR_ON(ch) __WINE_IS_DEBUG_ON(_ERR,&__wine_dbch_##ch)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#define WINE_DECLARE_DEBUG_CHANNEL(ch) \
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync static struct __wine_debug_channel __wine_dbch_##ch = { ~0, #ch }
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#define WINE_DEFAULT_DEBUG_CHANNEL(ch) \
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync static struct __wine_debug_channel __wine_dbch_##ch = { ~0, #ch }; \
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync static struct __wine_debug_channel * const __wine_dbch___default = &__wine_dbch_##ch
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#define WINE_DPRINTF wine_dbg_printf
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#define WINE_MESSAGE wine_dbg_printf
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#ifdef __WINESRC__
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync/* Wine uses shorter names that are very likely to conflict with other software */
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic inline const char *debugstr_an( const char * s, int n ) { return wine_dbgstr_an( s, n ); }
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic inline const char *debugstr_wn( const WCHAR *s, int n ) { return wine_dbgstr_wn( s, n ); }
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic inline const char *debugstr_guid( const struct _GUID *id ) { return wine_dbgstr_guid(id); }
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic inline const char *debugstr_a( const char *s ) { return wine_dbgstr_an( s, -1 ); }
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic inline const char *debugstr_w( const WCHAR *s ) { return wine_dbgstr_wn( s, -1 ); }
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#define TRACE WINE_TRACE
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#define TRACE_(ch) WINE_TRACE_(ch)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#define TRACE_ON(ch) WINE_TRACE_ON(ch)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#define WARN WINE_WARN
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#define WARN_(ch) WINE_WARN_(ch)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#define WARN_ON(ch) WINE_WARN_ON(ch)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#define FIXME WINE_FIXME
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#define FIXME_(ch) WINE_FIXME_(ch)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#define FIXME_ON(ch) WINE_FIXME_ON(ch)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#undef ERR /* Solaris got an 'ERR' define in <sys/reg.h> */
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#define ERR WINE_ERR
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#define ERR_(ch) WINE_ERR_(ch)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#define ERR_ON(ch) WINE_ERR_ON(ch)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#define DPRINTF WINE_DPRINTF
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#define MESSAGE WINE_MESSAGE
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#endif /* __WINESRC__ */
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#ifdef __cplusplus
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#endif
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#endif /* __WINE_WINE_DEBUG_H */