>>>>> "Mike" == Mike Hearn <mh(a)codeweavers.com> writes:
Mike> Here is the updated version of my debug delay patch, back by
Mike> popular request (well, ok, one person asked for it :)
Mike> Usage is simple:
Mike> WINEDELAY=1 WINEDEBUG=+relay wine foobar.exe
Mike> Hit f12 in any window to switch debug tracing on/off
Mike,
this patch comes like sent from heaven. However:
> cat ../delay_debug | patch -s -p0 --dry-run
1 out of 3 hunks FAILED -- saving rejects to file dlls/ntdll/debugtools.c.rej
2 out of 3 hunks FAILED -- saving rejects to file libs/wine/debug.c.rej
1 out of 1 hunk FAILED -- saving rejects to file include/wine/debug.h.rej
Looking at the rejects, I could see no cause for the rejection however.
Appended patch applies clean
--
Uwe Bonnes bon(a)elektron.ikp.physik.tu-darmstadt.de
Institut fuer Kernphysik Schlossgartenstrasse 9 64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------
Index: wine/dlls/ntdll/debugtools.c
===================================================================
RCS file: /home/wine/wine/dlls/ntdll/debugtools.c,v
retrieving revision 1.37
diff -u -r1.37 debugtools.c
--- wine/dlls/ntdll/debugtools.c 3 Mar 2004 21:34:13 -0000 1.37
+++ wine/dlls/ntdll/debugtools.c 14 Mar 2004 13:02:46 -0000
@@ -300,7 +300,7 @@
ret += wine_dbg_printf( "%s:%s:%s ", classes[cls], channel + 1, function );
}
if (format)
- ret += NTDLL_dbg_vprintf( format, args );
+ ret += __wine_dbg_vprintf( format, args );
return ret;
}
@@ -313,5 +313,6 @@
__wine_dbgstr_wn = NTDLL_dbgstr_wn;
__wine_dbg_vsprintf = NTDLL_dbg_vsprintf;
__wine_dbg_vprintf = NTDLL_dbg_vprintf;
+ if (getenv("WINEDELAY")) wine_dbg_toggle_block();
__wine_dbg_vlog = NTDLL_dbg_vlog;
}
Index: wine/libs/wine/debug.c
===================================================================
RCS file: /home/wine/wine/libs/wine/debug.c,v
retrieving revision 1.3
diff -u -r1.3 debug.c
--- wine/libs/wine/debug.c 5 Dec 2003 00:17:41 -0000 1.3
+++ wine/libs/wine/debug.c 14 Mar 2004 13:02:46 -0000
@@ -54,6 +54,9 @@
static const char * const debug_classes[] = { "fixme", "err", "warn", "trace" };
+static int disabled_dbg_vprintf( const char *format, va_list args );
+static void* old_vprintf = &disabled_dbg_vprintf; /* used when blocking debug output */
+
static int cmp_name( const void *p1, const void *p2 )
{
const char *name = p1;
@@ -140,6 +143,16 @@
}
}
+static int disabled_dbg_vprintf( const char *format, va_list args ) {
+ return 0;
+}
+
+/* prevents printing of debug messages temporarily */
+void wine_dbg_toggle_block() {
+ fprintf(stderr, "wine: toggling tracing\n");
+ old_vprintf = interlocked_xchg_ptr((void**)&__wine_dbg_vprintf, old_vprintf); /* fixme: is this thread safe? */
+}
+
/* parse a set of debugging option specifications and add them to the option list */
int wine_dbg_parse_options( const char *str )
{
@@ -412,3 +425,4 @@
{
return __wine_dbgstr_wn( s, -1 );
}
+
Index: wine/libs/wine/wine.def
===================================================================
RCS file: /home/wine/wine/libs/wine/wine.def,v
retrieving revision 1.10
diff -u -r1.10 wine.def
--- wine/libs/wine/wine.def 5 Feb 2004 02:01:35 -0000 1.10
+++ wine/libs/wine/wine.def 14 Mar 2004 13:02:46 -0000
@@ -9,6 +9,7 @@
__wine_dbgstr_an
__wine_dbgstr_wn
__wine_dll_register
+ wine_dbg_toggle_block
__wine_main_argc
__wine_main_argv
__wine_main_environ
Index: wine/libs/wine/wine.map
===================================================================
RCS file: /home/wine/wine/libs/wine/wine.map,v
retrieving revision 1.1
diff -u -r1.1 wine.map
--- wine/libs/wine/wine.map 12 Feb 2004 22:54:00 -0000 1.1
+++ wine/libs/wine/wine.map 14 Mar 2004 13:02:46 -0000
@@ -6,6 +6,7 @@
__wine_dbg_vlog;
__wine_dbg_vprintf;
__wine_dbg_vsprintf;
+ wine_dbg_toggle_block;
__wine_dbgstr_an;
__wine_dbgstr_wn;
__wine_dll_register;
Index: wine/dlls/x11drv/keyboard.c
===================================================================
RCS file: /home/wine/wine/dlls/x11drv/keyboard.c,v
retrieving revision 1.49
diff -u -r1.49 keyboard.c
--- wine/dlls/x11drv/keyboard.c 2 Mar 2004 20:55:57 -0000 1.49
+++ wine/dlls/x11drv/keyboard.c 14 Mar 2004 13:02:51 -0000
@@ -1171,6 +1171,11 @@
KEYBOARD_GenerateMsg( VK_CAPITAL, 0x3A, event->type, event_time );
TRACE("State after : %#.2x\n",pKeyStateTable[vkey]);
break;
+ case VK_F12:
+ if ((event->type == KeyPress) && getenv("WINEDELAY")) {
+ /* we get this event repeatedly if we hold down the key (keyboard repeat) */
+ wine_dbg_toggle_block();
+ }
default:
/* Adjust the NUMLOCK state if it has been changed outside wine */
if (!(pKeyStateTable[VK_NUMLOCK] & 0x01) != !(event->state & NumLockMask))
Index: wine/include/wine/debug.h
===================================================================
RCS file: /home/wine/wine/include/wine/debug.h,v
retrieving revision 1.12
diff -u -r1.12 debug.h
--- wine/include/wine/debug.h 18 Nov 2003 20:47:48 -0000 1.12
+++ wine/include/wine/debug.h 14 Mar 2004 13:02:52 -0000
@@ -145,6 +145,7 @@
extern int wine_dbg_printf( const char *format, ... ) __WINE_PRINTF_ATTR(1,2);
extern int wine_dbg_log( unsigned int cls, const char *ch, const char *func,
const char *format, ... ) __WINE_PRINTF_ATTR(4,5);
+extern void wine_dbg_toggle_block();
static inline const char *wine_dbgstr_guid( const GUID *id )
{