- Some small fixes on debugging macros.

- Translating of most Wine debugging macros to ReactOS ones.

svn path=/trunk/; revision=6842
This commit is contained in:
Filip Navara 2003-12-01 18:28:54 +00:00
parent e4b1dac7b7
commit 76a9aa1474
25 changed files with 117 additions and 1027 deletions

View file

@ -33,11 +33,7 @@
#endif
/* TODO: Make the output of file/line and the debug message atomic */
#ifdef __GNUC__
#define DPRINT1(args...) do { DbgPrint("(%s:%d) ",__FILE__,__LINE__); DbgPrint(args); } while(0);
#else
#define DPRINT1 DbgPrint("(%s:%d) ",__FILE__,__LINE__); DbgPrint
#endif
#define DPRINT1 DbgPrint("(%s:%d) ",__FILE__,__LINE__), DbgPrint
#define CHECKPOINT1 do { DbgPrint("%s:%d\n",__FILE__,__LINE__); } while(0);

View file

@ -1 +1,74 @@
#include "debugtools.h"
#ifndef __WINE_DEBUG_H
#define __WINE_DEBUG_H
#include "../roscfg.h"
#ifndef DBG
#define NDEBUG
#endif
#include "../debug.h"
#include <stdarg.h>
#include <wchar.h>
ULONG DbgPrint(PCH Format,...);
struct _GUID;
/* Exported definitions and macros */
/* These function 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 const char *wine_dbgstr_guid( const struct _GUID *id );
inline static const char *debugstr_an( const char * s, int n ) { return wine_dbgstr_an( s, n ); }
inline static const char *debugstr_wn( const WCHAR *s, int n ) { return wine_dbgstr_wn( s, n ); }
inline static const char *debugstr_guid( const struct _GUID *id ) { return wine_dbgstr_guid(id); }
inline static const char *debugstr_a( const char *s ) { return wine_dbgstr_an( s, 80 ); }
inline static const char *debugstr_w( const WCHAR *s ) { return wine_dbgstr_wn( s, 80 ); }
inline static const char *debugres_a( const char *s ) { return wine_dbgstr_an( s, 80 ); }
inline static const char *debugres_w( const WCHAR *s ) { return wine_dbgstr_wn( s, 80 ); }
#define TRACE DPRINT
#define TRACE_(ch) DPRINT
#ifdef NDEBUG
#define TRACE_ON(ch) 0
#else
#define TRACE_ON(ch) 1
#endif
#define WARN DPRINT
#define WARN_(ch) DPRINT
#ifdef NDEBUG
#define WARN_ON(ch) 0
#else
#define WARN_ON(ch) 1
#endif
#define FIXME DPRINT1
#define FIXME_(ch) DPRINT1
#ifdef NDEBUG
#define FIXME_ON(ch) 0
#else
#define FIXME_ON(ch) 1
#endif
#define ERR DPRINT
#define ERR_(ch) DPRINT
#ifdef NDEBUG
#define ERR_ON(ch) 0
#else
#define ERR_ON(ch) 1
#endif
#define DECLARE_DEBUG_CHANNEL(ch)
#define DEFAULT_DEBUG_CHANNEL(ch)
#define WINE_DECLARE_DEBUG_CHANNEL(ch) DECLARE_DEBUG_CHANNEL(ch)
#define WINE_DEFAULT_DEBUG_CHANNEL(ch) DEFAULT_DEBUG_CHANNEL(ch)
#define DPRINTF DPRINT
#define MESSAGE DPRINT
#endif /* __WINE_DEBUG_H */

View file

@ -1,109 +0,0 @@
#ifndef __WINE_DEBUGTOOLS_H
#define __WINE_DEBUGTOOLS_H
#include <stdarg.h>
#include <wchar.h>
struct _GUID;
/* Internal definitions (do not use these directly) */
enum __DEBUG_CLASS { __DBCL_FIXME, __DBCL_ERR, __DBCL_WARN, __DBCL_TRACE, __DBCL_COUNT };
#ifndef NO_TRACE_MSGS
# define __GET_DEBUGGING_TRACE(dbch) ((dbch)[0] & (1 << __DBCL_TRACE))
#else
# define __GET_DEBUGGING_TRACE(dbch) 0
#endif
#ifndef NO_DEBUG_MSGS
# define __GET_DEBUGGING_WARN(dbch) ((dbch)[0] & (1 << __DBCL_WARN))
# define __GET_DEBUGGING_FIXME(dbch) ((dbch)[0] & (1 << __DBCL_FIXME))
#else
# define __GET_DEBUGGING_WARN(dbch) 0
# define __GET_DEBUGGING_FIXME(dbch) 0
#endif
/* define error macro regardless of what is configured */
#define __GET_DEBUGGING_ERR(dbch) ((dbch)[0] & (1 << __DBCL_ERR))
#define __GET_DEBUGGING(dbcl,dbch) __GET_DEBUGGING##dbcl(dbch)
#define __SET_DEBUGGING(dbcl,dbch,on) \
((on) ? ((dbch)[0] |= 1 << (dbcl)) : ((dbch)[0] &= ~(1 << (dbcl))))
#ifdef __GNUC__
#define __DPRINTF(dbcl,dbch) \
do { if(__GET_DEBUGGING(dbcl,(dbch))) { \
const char * const __dbch = (dbch); \
const enum __DEBUG_CLASS __dbcl = __DBCL##dbcl; \
__WINE_DBG_LOG
#define __WINE_DBG_LOG(args...) \
wine_dbg_log( __dbcl, __dbch, __FUNCTION__, args); } } while(0)
#define __PRINTF_ATTR(fmt,args) __attribute__((format (printf,fmt,args)))
#else /* __GNUC__ */
#define __DPRINTF(dbcl,dbch) \
(!__GET_DEBUGGING(dbcl,(dbch)) || \
(wine_dbg_log(__DBCL##dbcl,(dbch),__FILE__,"%d: ",__LINE__),0)) ? \
(void)0 : (void)wine_dbg_printf
#define __PRINTF_ATTR(fmt, args)
#endif /* __GNUC__ */
/* Exported definitions and macros */
/* These function 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 const char *wine_dbgstr_guid( const struct _GUID *id );
extern int wine_dbg_vprintf( const char *format, va_list args ) __PRINTF_ATTR(1,0);
extern int wine_dbg_printf( const char *format, ... ) __PRINTF_ATTR(1,2);
extern int wine_dbg_log( enum __DEBUG_CLASS cls, const char *ch,
const char *func, const char *format, ... ) __PRINTF_ATTR(4,5);
inline static const char *debugstr_an( const char * s, int n ) { return wine_dbgstr_an( s, n ); }
inline static const char *debugstr_wn( const WCHAR *s, int n ) { return wine_dbgstr_wn( s, n ); }
inline static const char *debugstr_guid( const struct _GUID *id ) { return wine_dbgstr_guid(id); }
inline static const char *debugstr_a( const char *s ) { return wine_dbgstr_an( s, 80 ); }
inline static const char *debugstr_w( const WCHAR *s ) { return wine_dbgstr_wn( s, 80 ); }
inline static const char *debugres_a( const char *s ) { return wine_dbgstr_an( s, 80 ); }
inline static const char *debugres_w( const WCHAR *s ) { return wine_dbgstr_wn( s, 80 ); }
#define TRACE __DPRINTF(_TRACE,__wine_dbch___default)
#define TRACE_(ch) __DPRINTF(_TRACE,__wine_dbch_##ch)
#define TRACE_ON(ch) __GET_DEBUGGING(_TRACE,__wine_dbch_##ch)
#define WARN __DPRINTF(_WARN,__wine_dbch___default)
#define WARN_(ch) __DPRINTF(_WARN,__wine_dbch_##ch)
#define WARN_ON(ch) __GET_DEBUGGING(_WARN,__wine_dbch_##ch)
#define FIXME __DPRINTF(_FIXME,__wine_dbch___default)
#define FIXME_(ch) __DPRINTF(_FIXME,__wine_dbch_##ch)
#define FIXME_ON(ch) __GET_DEBUGGING(_FIXME,__wine_dbch_##ch)
#undef ERR /* Solaris got an 'ERR' define in <sys/reg.h> */
#define ERR __DPRINTF(_ERR,__wine_dbch___default)
#define ERR_(ch) __DPRINTF(_ERR,__wine_dbch_##ch)
#define ERR_ON(ch) __GET_DEBUGGING(_ERR,__wine_dbch_##ch)
#define DECLARE_DEBUG_CHANNEL(ch) \
char __wine_dbch_##ch[1];
#define DEFAULT_DEBUG_CHANNEL(ch) \
char __wine_dbch_##ch[1]; static char * const __wine_dbch___default = __wine_dbch_##ch
#define WINE_DECLARE_DEBUG_CHANNEL(ch) DECLARE_DEBUG_CHANNEL(ch)
#define WINE_DEFAULT_DEBUG_CHANNEL(ch) DEFAULT_DEBUG_CHANNEL(ch)
#define DPRINTF wine_dbg_printf
#define MESSAGE wine_dbg_printf
#endif /* __WINE_DEBUGTOOLS_H */

View file

@ -34,9 +34,10 @@ TARGET_RCFLAGS += -D__REACTOS__ -D_WIN32_IE=0x600 -D_WIN32_WINNT=0x501
TARGET_LFLAGS = -nostartfiles -nostdlib
TARGET_DDKLIBS = ntdll.a
TARGET_SDKLIBS = gdi32.a msvcrt.a kernel32.a user32.a advapi32.a winmm.a ole32.a
TARGET_SDKLIBS = gdi32.a msvcrt.a kernel32.a user32.a advapi32.a winmm.a ole32.a winedbgc.a
# For debugging
TARGET_SDKLIBS += ntdll.a winedbgc.a
TARGET_BASE = 0x76160000
@ -74,4 +75,6 @@ include $(PATH_TO_TOP)/rules.mak
include $(TOOLS_PATH)/helper.mk
include $(TOOLS_PATH)/config.mk
# include $(TOOLS_PATH)/depend.mk

View file

@ -16,3 +16,5 @@ TARGET_OBJECTS = charlist.o reader.o richedit.o text-writer.o
include $(PATH_TO_TOP)/rules.mak
include $(TOOLS_PATH)/helper.mk
include $(TOOLS_PATH)/config.mk

View file

@ -43,3 +43,5 @@ rpcrt4_main.o
include $(PATH_TO_TOP)/rules.mak
include $(TOOLS_PATH)/helper.mk
include $(TOOLS_PATH)/config.mk

View file

@ -1,4 +1,4 @@
# $Id: Makefile,v 1.4 2003/09/12 17:51:48 vizzini Exp $
# $Id: Makefile,v 1.5 2003/12/01 18:28:54 navaraf Exp $
PATH_TO_TOP = ../..
@ -24,3 +24,5 @@ TARGET_OBJECTS = \
include $(PATH_TO_TOP)/rules.mak
include $(TOOLS_PATH)/helper.mk
include $(TOOLS_PATH)/config.mk

View file

@ -1,4 +1,4 @@
# $Id: Makefile,v 1.30 2003/11/19 12:25:03 weiden Exp $
# $Id: Makefile,v 1.31 2003/12/01 18:28:54 navaraf Exp $
PATH_TO_TOP = ../..
@ -95,4 +95,6 @@ include $(TOOLS_PATH)/helper.mk
include $(TOOLS_PATH)/depend.mk
include $(TOOLS_PATH)/config.mk
# EOF

View file

@ -1,4 +1,4 @@
# $Id: Makefile,v 1.5 2003/11/14 17:13:32 weiden Exp $
# $Id: Makefile,v 1.6 2003/12/01 18:28:54 navaraf Exp $
PATH_TO_TOP = ../..
@ -25,12 +25,7 @@ TARGET_BASE = 0x77a90000
TARGET_SDKLIBS = ntdll.a kernel32.a
TARGET_OBJECTS = \
debug.o \
libmain.o \
porting.o \
trace.o \
winedbgc.o \
winedbgc.dll.dbg.o
winedbgc.o
include $(PATH_TO_TOP)/rules.mak

View file

@ -1,437 +0,0 @@
/*
* Management of the debugging channels
*
* Copyright 2000 Alexandre Julliard
*
* This library is free software; you can redistribute it and/or
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/*
#include <ntddk.h>
#include <wine/debugtools.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include <ctype.h>
*/
#include <windows.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "porting.h"
#include "wine/debug.h"
/*
#include "config.h"
#include "wine/port.h"
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include <ctype.h>
#include "wine/library.h"
#include "wine/unicode.h"
*/
struct dll
{
struct dll *next; /* linked list of dlls */
struct dll *prev;
char * const *channels; /* array of channels */
int nb_channels; /* number of channels in array */
};
static struct dll *first_dll;
struct debug_option
{
struct debug_option *next; /* next option in list */
unsigned char set; /* bits to set */
unsigned char clear; /* bits to clear */
char name[14]; /* channel name, or empty for "all" */
};
static struct debug_option *first_option;
static struct debug_option *last_option;
static const char * const debug_classes[] = { "fixme", "err", "warn", "trace" };
static int cmp_name( const void *p1, const void *p2 )
{
const char *name = p1;
const char * const *chan = p2;
return strcmp( name, *chan + 1 );
}
/* apply a debug option to the channels of a given dll */
static void apply_option( struct dll *dll, const struct debug_option *opt )
{
if (opt->name[0])
{
char **dbch = bsearch( opt->name, dll->channels, dll->nb_channels,
sizeof(*dll->channels), cmp_name );
if (dbch) **dbch = (**dbch & ~opt->clear) | opt->set;
}
else /* all */
{
int i;
for (i = 0; i < dll->nb_channels; i++)
dll->channels[i][0] = (dll->channels[i][0] & ~opt->clear) | opt->set;
}
}
/* register a new set of channels for a dll */
void *__wine_dbg_register( char * const *channels, int nb )
{
struct debug_option *opt = first_option;
struct dll *dll = malloc( sizeof(*dll) );
if (dll)
{
dll->channels = channels;
dll->nb_channels = nb;
dll->prev = NULL;
if ((dll->next = first_dll)) dll->next->prev = dll;
first_dll = dll;
/* apply existing options to this dll */
while (opt)
{
apply_option( dll, opt );
opt = opt->next;
}
}
return dll;
}
/* unregister a set of channels; must pass the pointer obtained from wine_dbg_register */
void __wine_dbg_unregister( void *channel )
{
struct dll *dll = channel;
if (dll)
{
if (dll->next) dll->next->prev = dll->prev;
if (dll->prev) dll->prev->next = dll->next;
else first_dll = dll->next;
free( dll );
}
}
/* add a new debug option at the end of the option list */
void wine_dbg_add_option( const char *name, unsigned char set, unsigned char clear )
{
struct dll *dll = first_dll;
struct debug_option *opt;
if (!(opt = malloc( sizeof(*opt) ))) return;
opt->next = NULL;
opt->set = set;
opt->clear = clear;
strncpy( opt->name, name, sizeof(opt->name) );
opt->name[sizeof(opt->name)-1] = 0;
if (last_option) last_option->next = opt;
else first_option = opt;
last_option = opt;
/* apply option to all existing dlls */
while (dll)
{
apply_option( dll, opt );
dll = dll->next;
}
}
/* parse a set of debugging option specifications and add them to the option list */
int wine_dbg_parse_options( const char *str )
{
char *p, *opt, *next, *options;
int i, errors = 0;
if (!(options = strdup(str))) return -1;
for (opt = options; opt; opt = next)
{
unsigned char set = 0, clear = 0;
if ((next = strchr( opt, ',' ))) *next++ = 0;
p = opt + strcspn( opt, "+-" );
if (!p[0] || !p[1]) /* bad option, skip it */
{
errors++;
continue;
}
if (p > opt)
{
for (i = 0; i < sizeof(debug_classes)/sizeof(debug_classes[0]); i++)
{
int len = strlen(debug_classes[i]);
if (len != (p - opt)) continue;
if (!memcmp( opt, debug_classes[i], len )) /* found it */
{
if (*p == '+') set |= 1 << i;
else clear |= 1 << i;
break;
}
}
if (i == sizeof(debug_classes)/sizeof(debug_classes[0])) /* bad class name, skip it */
{
errors++;
continue;
}
}
else
{
if (*p == '+') set = ~0;
else clear = ~0;
}
p++;
if (!strcmp( p, "all" )) p = ""; /* empty string means all */
wine_dbg_add_option( p, set, clear );
}
free( options );
return errors;
}
#ifdef __WINE__
/* varargs wrapper for __wine_dbg_vprintf */
int wine_dbg_printf( const char *format, ... )
{
int ret;
va_list valist;
va_start(valist, format);
ret = __wine_dbg_vprintf( format, valist );
va_end(valist);
return ret;
}
/* varargs wrapper for __wine_dbg_vlog */
int wine_dbg_log( int cls, const char *channel, const char *func, const char *format, ... )
{
int ret;
va_list valist;
va_start(valist, format);
ret = __wine_dbg_vlog( cls, channel, func, format, valist );
va_end(valist);
return ret;
}
#endif /*__WINE__*/
/* allocate some tmp string space */
/* FIXME: this is not 100% thread-safe */
static char *get_tmp_space( int size )
{
static char *list[32];
static long pos;
char *ret;
int idx;
idx = interlocked_xchg_add( &pos, 1 ) % (sizeof(list)/sizeof(list[0]));
if ((ret = realloc( list[idx], size ))) list[idx] = ret;
return ret;
}
/* default implementation of wine_dbgstr_an */
static const char *default_dbgstr_an( const char *str, int n )
{
char *dst, *res;
if (!HIWORD(str))
{
if (!str) return "(null)";
res = get_tmp_space( 6 );
sprintf( res, "#%04x", LOWORD((DWORD)str) );
return res;
}
if (n == -1) n = strlen(str);
if (n < 0) n = 0;
else if (n > 200) n = 200;
dst = res = get_tmp_space( n * 4 + 6 );
*dst++ = '"';
while (n-- > 0)
{
unsigned char c = *str++;
switch (c)
{
case '\n': *dst++ = '\\'; *dst++ = 'n'; break;
case '\r': *dst++ = '\\'; *dst++ = 'r'; break;
case '\t': *dst++ = '\\'; *dst++ = 't'; break;
case '"': *dst++ = '\\'; *dst++ = '"'; break;
case '\\': *dst++ = '\\'; *dst++ = '\\'; break;
default:
if (c >= ' ' && c <= 126)
*dst++ = c;
else
{
*dst++ = '\\';
*dst++ = '0' + ((c >> 6) & 7);
*dst++ = '0' + ((c >> 3) & 7);
*dst++ = '0' + ((c >> 0) & 7);
}
}
}
*dst++ = '"';
if (*str)
{
*dst++ = '.';
*dst++ = '.';
*dst++ = '.';
}
*dst = 0;
return res;
}
/* default implementation of wine_dbgstr_wn */
static const char *default_dbgstr_wn( const WCHAR *str, int n )
{
char *dst, *res;
if (!HIWORD(str))
{
if (!str) return "(null)";
res = get_tmp_space( 6 );
sprintf( res, "#%04x", LOWORD((DWORD)str) );
return res;
}
if (n == -1) n = strlenW(str);
if (n < 0) n = 0;
else if (n > 200) n = 200;
dst = res = get_tmp_space( n * 5 + 7 );
*dst++ = 'L';
*dst++ = '"';
while (n-- > 0)
{
WCHAR c = *str++;
switch (c)
{
case '\n': *dst++ = '\\'; *dst++ = 'n'; break;
case '\r': *dst++ = '\\'; *dst++ = 'r'; break;
case '\t': *dst++ = '\\'; *dst++ = 't'; break;
case '"': *dst++ = '\\'; *dst++ = '"'; break;
case '\\': *dst++ = '\\'; *dst++ = '\\'; break;
default:
if (c >= ' ' && c <= 126)
*dst++ = c;
else
{
*dst++ = '\\';
sprintf(dst,"%04x",c);
dst+=4;
}
}
}
*dst++ = '"';
if (*str)
{
*dst++ = '.';
*dst++ = '.';
*dst++ = '.';
}
*dst = 0;
return res;
}
/* default implementation of wine_dbgstr_guid */
static const char *default_dbgstr_guid( const struct _GUID *id )
{
char *str;
if (!id) return "(null)";
if (!((int)id >> 16))
{
str = get_tmp_space( 12 );
sprintf( str, "<guid-0x%04x>", (int)id & 0xffff );
}
else
{
str = get_tmp_space( 40 );
sprintf( str, "{%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
id->Data1, id->Data2, id->Data3,
id->Data4[0], id->Data4[1], id->Data4[2], id->Data4[3],
id->Data4[4], id->Data4[5], id->Data4[6], id->Data4[7] );
}
return str;
}
/* default implementation of wine_dbg_vprintf */
static int default_dbg_vprintf( const char *format, va_list args )
{
return vfprintf( stderr, format, args );
}
/* default implementation of wine_dbg_vlog */
static int default_dbg_vlog( int cls, const char *channel, const char *func,
const char *format, va_list args )
{
int ret = 0;
if (cls < sizeof(debug_classes)/sizeof(debug_classes[0]))
ret += wine_dbg_printf( "%s:%s:%s ", debug_classes[cls], channel + 1, func );
if (format)
ret += wine_dbg_vprintf( format, args );
return ret;
}
/* exported function pointers so that debugging functions can be redirected at run-time */
const char * (*__wine_dbgstr_an)( const char * s, int n ) = default_dbgstr_an;
const char * (*__wine_dbgstr_wn)( const WCHAR *s, int n ) = default_dbgstr_wn;
const char * (*__wine_dbgstr_guid)( const struct _GUID *id ) = default_dbgstr_guid;
int (*__wine_dbg_vprintf)( const char *format, va_list args ) = default_dbg_vprintf;
int (*__wine_dbg_vlog)( int cls, const char *channel, const char *function,
const char *format, va_list args ) = default_dbg_vlog;
/* wrappers to use the function pointers */
#ifdef __WINE__
const char *wine_dbgstr_guid( const struct _GUID *id )
{
return __wine_dbgstr_guid(id);
}
const char *wine_dbgstr_an( const char * s, int n )
{
return __wine_dbgstr_an(s, n);
}
const char *wine_dbgstr_wn( const WCHAR *s, int n )
{
return __wine_dbgstr_wn(s, n);
}
const char *wine_dbgstr_a( const char *s )
{
return __wine_dbgstr_an( s, -1 );
}
const char *wine_dbgstr_w( const WCHAR *s )
{
return __wine_dbgstr_wn( s, -1 );
}
#endif /*__WINE__*/

View file

@ -1,97 +0,0 @@
/*
* Win32 winedbgc functions
*
*
* This library is free software; you can redistribute it and/or
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <windows.h>
//#include <ntddk.h>
//#include <wine/debugtools.h>
//#include <stdlib.h>
//#include <stdio.h>
//#include <stdarg.h>
//#include <string.h>
//#include <ctype.h>
/*
#include "config.h"
#include "wine/port.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include "winbase.h"
#include "wine/debug.h"
#include "wine/library.h"
#include "proxywinedbgc.h"
WINE_DEFAULT_DEBUG_CHANNEL(winedbgc);
*/
/***********************************************************************
* DllMain [Internal] Initializes the internal 'winedbgc32.DLL'.
*
* PARAMS
* hinstDLL [I] handle to the DLL's instance
* fdwReason [I]
* lpvReserved [I] reserved, must be NULL
*
* RETURNS
* Success: TRUE
* Failure: FALSE
*/
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
// TRACE("Initializing or Finalizing winedbgc: %p,%lx,%p\n", hinstDLL, fdwReason, lpvReserved);
if (fdwReason == DLL_PROCESS_ATTACH)
{
// TRACE("Loading winedbgc...\n");
/*
#ifndef __REACTOS__
if (winedbgc_LoadDriverManager())
winedbgc_LoadDMFunctions();
#endif
*/
}
else if (fdwReason == DLL_PROCESS_DETACH)
{
// TRACE("Unloading winedbgc...\n");
/*
#ifndef __REACTOS__
if (gProxyHandle.bFunctionReady)
{
int i;
for ( i = 0; i < NUM_SQLFUNC; i ++ )
{
gProxyHandle.functions[i].func = SQLDummyFunc;
}
}
if (gProxyHandle.dmHandle)
{
wine_dlclose(gProxyHandle.dmHandle,NULL,0);
gProxyHandle.dmHandle = NULL;
}
#endif
*/
}
return TRUE;
}
/* EOF */

View file

@ -1,38 +0,0 @@
/*
* Porting wine comtrl32 to ReactOS comctrl32 support functions
*
* Copyright 2002 Robert Dickenson
*
* This library is free software; you can redistribute it and/or
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <windows.h>
#include "porting.h"
static int interlocked_mutex;
void _lwp_mutex_lock(int* interlocked_mutex) {}
void _lwp_mutex_unlock(int* interlocked_mutex) {}
long interlocked_xchg_add( long *dest, long incr )
{
long retv;
_lwp_mutex_lock( &interlocked_mutex );
retv = *dest;
*dest += incr;
_lwp_mutex_unlock( &interlocked_mutex );
return retv;
}

View file

@ -1,83 +0,0 @@
/////////////////////////////////////////////////////////////////////////////
// Diagnostic Trace
//
#include <stdio.h>
#include <stdarg.h>
#include <tchar.h>
#define WIN32_LEAN_AND_MEAN
#include "windows.h"
#include "trace.h"
#ifdef _DEBUG
#ifdef WIN32
//#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
//#include <windows.h>
//#include <assert.h>
//WINBASEAPI VOID WINAPI DebugBreak(VOID);
//WINBASEAPI VOID WINAPI OutputDebugStringA(LPCSTR lpOutputString);
//WINBASEAPI VOID WINAPI OutputDebugStringW(LPCWSTR lpOutputString);
//void __stdcall DebugBreak(void);
//void __stdcall OutputDebugStringA(char* lpOutputString);
//void __stdcall OutputDebugStringW(wchar_t* lpOutputString);
#ifdef UNICODE
#define OutputDebugString OutputDebugStringW
#else
#define OutputDebugString OutputDebugStringA
#endif // !UNICODE
#else
#include "hardware.h"
#endif // WIN32
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
void _DebugBreak(void)
{
DebugBreak();
}
void Trace(const TCHAR* lpszFormat, ...)
{
va_list args;
int nBuf;
TCHAR szBuffer[512];
va_start(args, lpszFormat);
// nBuf = vsprintf(szBuffer, lpszFormat, args);
// nBuf = _vsntprintf(szBuffer, _countof(szBuffer), lpszFormat, args);
#ifdef _UNICODE
nBuf = _vsnwprintf(szBuffer, sizeof(szBuffer)/sizeof(TCHAR), lpszFormat, args);
#else
nBuf = _vsnprintf(szBuffer, sizeof(szBuffer)/sizeof(TCHAR), lpszFormat, args);
#endif
OutputDebugString(szBuffer);
// was there an error? was the expanded string too long?
// ASSERT(nBuf >= 0);
va_end(args);
}
void Assert(void* assert, TCHAR* file, int line, void* msg)
{
if (msg == NULL) {
printf("ASSERT -- %s occured on line %u of file %s.\n",
assert, line, file);
} else {
printf("ASSERT -- %s occured on line %u of file %s: Message = %s.\n",
assert, line, file, msg);
}
}
#else
//inline void Trace(TCHAR* lpszFormat, ...) { };
//inline void Assert(void* assert, TCHAR* file, int line, void* msg) { };
void Trace(const TCHAR* lpszFormat, ...) { };
void Assert(void* assert, TCHAR* file, int line, void* msg) { };
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////

View file

@ -1,63 +0,0 @@
/////////////////////////////////////////////////////////////////////////////
//
#ifndef __TRACE_H__
#define __TRACE_H__
#ifdef _DEBUG
//=============================================================================
// BreakPoint() macro.
//=============================================================================
#ifdef _X86_
#define BreakPoint() _asm { int 3h }
#else
#define BreakPoint() _DebugBreak()
#endif
//=============================================================================
// MACRO: ASSERT()
//=============================================================================
#ifndef ASSERT
#define ASSERT(exp) \
{ \
if ( !(exp) ) \
{ \
Assert(#exp, __FILE__, __LINE__, NULL); \
BreakPoint(); \
} \
} \
#define ASSERTMSG(exp, msg) \
{ \
if ( !(exp) ) \
{ \
Assert(#exp, __FILE__, __LINE__, msg); \
BreakPoint(); \
} \
}
#endif
//=============================================================================
// MACRO: TRACE()
//=============================================================================
void Assert(void* assert, TCHAR* file, int line, void* msg);
void Trace(const TCHAR* lpszFormat, ...);
void Trace1(int code, TCHAR* lpszFormat, ...);
#else // _DEBUG
#ifndef ASSERT
#define ASSERT(exp)
#define ASSERTMSG(exp, msg)
#endif
void Assert(void* assert, TCHAR* file, int line, void* msg);
void Trace(const TCHAR* lpszFormat, ...);
#endif // !_DEBUG
#endif // __TRACE_H__
/////////////////////////////////////////////////////////////////////////////

View file

@ -1,6 +1,7 @@
/*
* Debugging channels functions for WINE support on ROS.
*/
#include <windows.h>
#include <stdlib.h>
#include <stdio.h>
@ -8,12 +9,6 @@
#include "porting.h"
#include "trace.h"
//#include <ntddk.h>
#include <wine/debugtools.h>
DECLARE_DEBUG_CHANNEL(winedbgc);
/* ---------------------------------------------------------------------- */
struct debug_info
@ -191,69 +186,7 @@ const char *wine_dbgstr_guid(const GUID *id)
return str;
}
/***********************************************************************
* wine_dbg_vprintf (NTDLL.@)
*/
int wine_dbg_vprintf(const char *format, va_list args)
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
struct debug_info *info = get_info();
char *p;
int ret = _vsnprintf(info->out_pos, sizeof(info->output) - (info->out_pos - info->output),
format, args);
p = strrchr(info->out_pos, '\n');
if (!p) {
info->out_pos += ret;
} else {
char *pos = info->output;
char saved_ch;
p++;
saved_ch = *p;
*p = 0;
DbgPrint(pos);
*p = saved_ch;
/* move beginning of next line to start of buffer */
while ((*pos = *p++)) pos++;
info->out_pos = pos;
}
return ret;
}
/***********************************************************************
* wine_dbg_printf (NTDLL.@)
*/
int wine_dbg_printf(const char *format, ...)
{
int ret;
va_list valist;
va_start(valist, format);
//
Trace(format, valist);
//
ret = wine_dbg_vprintf(format, valist);
va_end(valist);
return ret;
}
/***********************************************************************
* wine_dbg_log (NTDLL.@)
*/
int wine_dbg_log(enum __DEBUG_CLASS cls, const char *channel,
const char *function, const char *format, ...)
{
static const char *classes[__DBCL_COUNT] = { "fixme", "err", "warn", "trace" };
va_list valist;
int ret = 0;
va_start(valist, format);
if (TRACE_ON(winedbgc))
ret = wine_dbg_printf("%08lx:", (DWORD)NtCurrentTeb()->Cid.UniqueThread);
if (cls < __DBCL_COUNT)
ret += wine_dbg_printf("%s:%s:%s ", classes[cls], channel + 1, function);
if (format)
ret += wine_dbg_vprintf(format, valist);
va_end(valist);
return ret;
return TRUE;
}

View file

@ -1,37 +1,10 @@
; $Id: winedbgc.def,v 1.2 2003/01/12 01:54:39 robd Exp $
; $Id: winedbgc.def,v 1.3 2003/12/01 18:28:54 navaraf Exp $
;
; ReactOS Operating System
;
LIBRARY winedbgc.dll
EXPORTS
wine_dbg_log
wine_dbg_printf
wine_dbgstr_an
wine_dbgstr_guid
wine_dbgstr_wn
__wine_dbg_register
__wine_dbg_unregister
__wine_dbg_vlog DATA
__wine_dbg_vprintf DATA
__wine_dbgstr_an DATA
__wine_dbgstr_guid DATA
__wine_dbgstr_wn DATA
;
;wine_dbg_log @1
;__wine_dbg_register @2
;__wine_dbg_unregister @3
;__wine_dbg_vlog @4 DATA
;__wine_dbg_vprintf @5 DATA
;__wine_dbgstr_an @6 DATA
;__wine_dbgstr_guid @7 DATA
;__wine_dbgstr_wn @8 DATA
;
;wine_dbg_printf @34
;wine_dbgstr_an @36
;wine_dbgstr_guid @37
;wine_dbgstr_wn @39
;

View file

@ -1,81 +1,10 @@
; $Id: winedbgc.edf,v 1.2 2003/01/12 01:54:39 robd Exp $
; $Id: winedbgc.edf,v 1.3 2003/12/01 18:28:54 navaraf Exp $
;
; ReactOS Operating System
;
LIBRARY winedbgc.dll
EXPORTS
wine_dbg_log
wine_dbg_printf
wine_dbgstr_an
wine_dbgstr_guid
wine_dbgstr_wn
__wine_dbg_register
__wine_dbg_unregister
__wine_dbg_vlog DATA
__wine_dbg_vprintf DATA
__wine_dbgstr_an DATA
__wine_dbgstr_guid DATA
__wine_dbgstr_wn DATA
;wine_dbgstr_an
;wine_dbgstr_wn
;wine_dbgstr_guid
;wine_dbg_vprintf
;wine_dbg_printf
;wine_dbg_log
; wine_dbg_log @1
; __wine_dbg_register @2
; __wine_dbg_unregister @3
; __wine_dbg_vlog @4 DATA
; __wine_dbg_vprintf @5 DATA
; __wine_dbgstr_an @6 DATA
; __wine_dbgstr_guid @7 DATA
; __wine_dbgstr_wn @8 DATA
;__wine_dll_register @9
;__wine_main_argc @10 DATA
;__wine_main_argv @11 DATA
;__wine_main_wargv @12 DATA
;interlocked_cmpxchg @20
;interlocked_cmpxchg_ptr @21
;interlocked_xchg @22
;interlocked_xchg_add @23
;interlocked_xchg_ptr @24
;wine_anon_mmap @30
;wine_dbg_add_option @31
;wine_dbg_parse_options @33
; wine_dbg_printf @34
;wine_dbgstr_a @35
; wine_dbgstr_an @36
; wine_dbgstr_guid @37
;wine_dbgstr_w @38
; wine_dbgstr_wn @39
;wine_dlclose @40
;wine_dll_load @41
;wine_dll_load_main_exe @42
;wine_dll_set_callback @43
;wine_dll_unload @44
;wine_dlopen @45
;wine_dlsym @46
;wine_errno_location @47 DATA
;wine_get_config_dir @48
;wine_get_cs @49
;wine_get_ds @50
;wine_get_es @51
;wine_get_fs @52
;wine_get_gs @53
;wine_get_server_dir @54
;wine_get_ss @55
;wine_h_errno_location @56 DATA
;wine_ldt_copy @57 DATA
;wine_ldt_get_entry @58
;wine_ldt_set_entry @59
;wine_rewrite_s4tos2 @60
;wine_set_fs @61
;wine_set_gs @62

View file

@ -31,6 +31,8 @@
#include "inicache.h"
#include "bootsup.h"
#define NDEBUG
#include <debug.h>
#define SECTORSIZE 512

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: filequeue.c,v 1.2 2003/08/24 10:36:06 chorns Exp $
/* $Id: filequeue.c,v 1.3 2003/12/01 18:28:54 navaraf Exp $
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS text-mode setup
* FILE: subsys/system/usetup/filequeue.c
@ -34,6 +34,8 @@
#include "filesup.h"
#include "filequeue.h"
#define NDEBUG
#include <debug.h>
/* INCLUDES *****************************************************************/

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: filesup.c,v 1.8 2003/11/08 09:13:46 ekohl Exp $
/* $Id: filesup.c,v 1.9 2003/12/01 18:28:54 navaraf Exp $
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS text-mode setup
* FILE: subsys/system/usetup/filesup.c
@ -34,6 +34,8 @@
#include "filesup.h"
#include "cabinet.h"
#define NDEBUG
#include <debug.h>
/* FUNCTIONS ****************************************************************/

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: infcache.c,v 1.9 2003/11/14 17:13:33 weiden Exp $
/* $Id: infcache.c,v 1.10 2003/12/01 18:28:54 navaraf Exp $
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS text-mode setup
* FILE: subsys/system/usetup/infcache.c
@ -31,6 +31,8 @@
#include "usetup.h"
#include "infcache.h"
#define NDEBUG
#include <debug.h>
#define CONTROL_Z '\x1a'
#define MAX_SECTION_NAME_LEN 255

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: inicache.c,v 1.7 2003/11/14 17:13:33 weiden Exp $
/* $Id: inicache.c,v 1.8 2003/12/01 18:28:54 navaraf Exp $
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS text-mode setup
* FILE: subsys/system/usetup/inicache.c
@ -31,6 +31,8 @@
#include "usetup.h"
#include "inicache.h"
#define NDEBUG
#include <debug.h>
/* PRIVATE FUNCTIONS ********************************************************/

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: partlist.c,v 1.25 2003/11/14 17:13:34 weiden Exp $
/* $Id: partlist.c,v 1.26 2003/12/01 18:28:54 navaraf Exp $
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS text-mode setup
* FILE: subsys/system/usetup/partlist.c
@ -38,6 +38,9 @@
#include "drivesup.h"
#include "bootsup.h"
#define NDEBUG
#include <debug.h>
/* FUNCTIONS ****************************************************************/
static VOID

View file

@ -34,6 +34,8 @@
#include "registry.h"
#include "infcache.h"
#define NDEBUG
#include <debug.h>
#define FLG_ADDREG_BINVALUETYPE 0x00000001

View file

@ -32,17 +32,9 @@
#endif
#define assert(x)
#define DPRINT1(args...) do { DbgPrint("(%s:%d) ",__FILE__,__LINE__); DbgPrint(args); } while(0);
#define CHECKPOINT1 do { DbgPrint("%s:%d\n",__FILE__,__LINE__); } while(0);
#define DPRINT(args...)
#define CHECKPOINT
#define ROUND_DOWN(N, S) (((N) / (S)) * (S))
#define ROUND_UP(N, S) ((((N) + (S) - 1) / (S)) * (S))
extern HANDLE ProcessHeap;
extern UNICODE_STRING SourceRootPath;