[LIBWINE]
authorKamil Hornicek <kamil.hornicek@reactos.org>
Wed, 16 Apr 2014 22:47:40 +0000 (22:47 +0000)
committerKamil Hornicek <kamil.hornicek@reactos.org>
Wed, 16 Apr 2014 22:47:40 +0000 (22:47 +0000)
- bring back the old debug output format ie class:(file:line), Testman depends on this

svn path=/trunk/; revision=62761

reactos/include/reactos/wine/debug.h
reactos/lib/3rdparty/libwine/debug.c

index 54ac2c6..2428c89 100644 (file)
@@ -91,7 +91,7 @@ struct __wine_debug_channel
        __WINE_DBG_LOG
 
 #define __WINE_DBG_LOG(args...) \
-    wine_dbg_log( __dbcl, __dbch, __FUNCTION__, args); } } while(0)
+    ros_dbg_log( __dbcl, __dbch, __FILE__, __FUNCTION__, __LINE__, args); } } while(0)
 
 #define __WINE_PRINTF_ATTR(fmt,args) /*__attribute__((format (printf,fmt,args)))*/
 
@@ -137,7 +137,7 @@ struct __wine_debug_channel
 
 #define __WINE_DPRINTF(dbcl,dbch) \
     (!__WINE_GET_DEBUGGING(dbcl,(dbch)) || \
-     (wine_dbg_log(__WINE_DBCL##dbcl,(dbch),__FILE__,"%d: ",__LINE__) == -1)) ? \
+     (ros_dbg_log(__WINE_DBCL##dbcl,(dbch),__FILE__,"",__LINE__,"") == -1)) ? \
      (void)0 : (void)wine_dbg_printf
 
 #define __WINE_PRINTF_ATTR(fmt, args)
@@ -152,7 +152,7 @@ struct __wine_debug_functions
     const char * (*dbgstr_wn)( const WCHAR *s, int n );
     int (*dbg_vprintf)( const char *format, va_list args );
     int (*dbg_vlog)( enum __wine_debug_class cls, struct __wine_debug_channel *channel,
-                     const char *function, const char *format, va_list args );
+                     const char *file, const char *function, const int line, const char *format, va_list args );
 };
 
 extern unsigned char __wine_dbg_get_channel_flags( struct __wine_debug_channel *channel );
@@ -175,6 +175,9 @@ extern const char *wine_dbg_sprintf( const char *format, ... ) __WINE_PRINTF_ATT
 extern int wine_dbg_printf( const char *format, ... ) __WINE_PRINTF_ATTR(1,2);
 extern int wine_dbg_log( enum __wine_debug_class cls, struct __wine_debug_channel *ch, const char *func,
                          const char *format, ... ) __WINE_PRINTF_ATTR(4,5);
+/* ReactOS compliant debug format */
+extern int ros_dbg_log( enum __wine_debug_class cls, struct __wine_debug_channel *ch, const char *file,
+                         const char *func, const int line, const char *format, ... ) __WINE_PRINTF_ATTR(6,7);
 
 static __inline const char *wine_dbgstr_a( const char *s )
 {
index b95249c..1bf8dc1 100644 (file)
@@ -247,7 +247,23 @@ int wine_dbg_log( enum __wine_debug_class cls, struct __wine_debug_channel *chan
     if (!(__wine_dbg_get_channel_flags( channel ) & (1 << cls))) return -1;
 
     va_start(valist, format);
-    ret = funcs.dbg_vlog( cls, channel, func, format, valist );
+    ret = funcs.dbg_vlog( cls, channel, NULL, func, 0, format, valist );
+    va_end(valist);
+    return ret;
+}
+
+
+/* ReactOS compliant debug format wrapper for funcs.dbg_vlog */
+int ros_dbg_log( enum __wine_debug_class cls, struct __wine_debug_channel *channel,
+                  const char *file, const char *func, const int line, const char *format, ... )
+{
+    int ret;
+    va_list valist;
+
+    if (!(__wine_dbg_get_channel_flags( channel ) & (1 << cls))) return -1;
+
+    va_start(valist, format);
+    ret = funcs.dbg_vlog( cls, channel, file, func, line, format, valist );
     va_end(valist);
     return ret;
 }
@@ -396,12 +412,18 @@ static int default_dbg_vprintf( const char *format, va_list args )
 
 /* default implementation of wine_dbg_vlog */
 static int default_dbg_vlog( enum __wine_debug_class cls, struct __wine_debug_channel *channel,
-                             const char *func, const char *format, va_list args )
+                             const char *file, const char *func, const int line, 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->name, func );
+        ret += wine_dbg_printf( "%s:", debug_classes[cls] );
+
+       if (file && line)
+        ret += wine_dbg_printf ( "(%s:%d) ", file, line );
+    else
+        ret += wine_dbg_printf( "%s:%s: ", channel->name, func );
+
     if (format)
         ret += funcs.dbg_vprintf( format, args );
     return ret;