I find tracing a wine problem with wine --debugmsg for large programs unpractical. Usually you can know about exactly when a program hangs or behaves badly, but there's no way to activate/deactivate tracing after program start (afaik...) Being also a windoze (sigh) programmer, I find very useful some utilities like winspy that presents a window log in which you can start/stop tracing or logging of wine messages, system calls and so on, and activate/deactivate filters on the fly. This would allow spotting the bug when it arises instead of having tenths or hundreds of mbyte of logs. I could implement it as a filter taking input from wine, but I guess it'll slow downn much apps, having to parse wine output on the fly. Much better would be an internal implementation.... Some comments about ?
Regards
Max
Much better would be an internal implementation.... Some comments about ?
this has already been discussed. there should be a patch floating around (but never committed to Wine because ugly, code bloat, intrusive...) to turn all debug channels on or off using a simple key stroke
I've quickly hacked a solution based on winedbg by extending some existing commands:
set + warn win => turn on warn on 'win' channel set + win => turn on warn/fixme/err/trace on 'win' channel
(same with - to turn off)
(form of command should still be improved..., but core of functionality is there)
HTH
A+
Name: dbg_chn ChangeLog: added ability to turn on/off debug channels License: X11 GenDate: 2002/05/30 18:01:13 UTC ModifiedFiles: debugger/dbg.y debugger/debugger.h debugger/info.c AddedFiles: =================================================================== RCS file: /home/cvs/cvsroot/wine/wine/debugger/dbg.y,v retrieving revision 1.55 diff -u -u -r1.55 dbg.y --- debugger/dbg.y 25 May 2002 21:18:34 -0000 1.55 +++ debugger/dbg.y 30 May 2002 17:57:11 -0000 @@ -173,7 +173,12 @@ | noprocess_state ;
-set_command: tSET lval_addr '=' expr_value tEOL { DEBUG_WriteMemory(&$2,$4); DEBUG_FreeExprMem(); } +set_command: + tSET lval_addr '=' expr_value tEOL { DEBUG_WriteMemory(&$2,$4); DEBUG_FreeExprMem(); } + | tSET '+' tIDENTIFIER tEOL {DEBUG_DbgChannel(TRUE, NULL, $3);} + | tSET '-' tIDENTIFIER tEOL {DEBUG_DbgChannel(FALSE, NULL, $3);} + | tSET '+' tIDENTIFIER tIDENTIFIER tEOL {DEBUG_DbgChannel(TRUE, $3, $4);} + | tSET '-' tIDENTIFIER tIDENTIFIER tEOL {DEBUG_DbgChannel(FALSE, $3, $4);} ;
pathname: Index: debugger/debugger.h =================================================================== RCS file: /home/cvs/cvsroot/wine/wine/debugger/debugger.h,v retrieving revision 1.32 diff -u -u -r1.32 debugger.h --- debugger/debugger.h 25 May 2002 21:18:34 -0000 1.32 +++ debugger/debugger.h 30 May 2002 17:53:16 -0000 @@ -404,6 +404,7 @@ extern void DEBUG_InfoVirtual(void); extern void DEBUG_InfoWindow(HWND hWnd); extern void DEBUG_WalkWindows(HWND hWnd, int indent); +extern void DEBUG_DbgChannel(BOOL add, const char* chnl, const char* name);
/* debugger/memory.c */ extern int DEBUG_ReadMemory( const DBG_VALUE* value ); Index: debugger/info.c =================================================================== RCS file: /home/cvs/cvsroot/wine/wine/debugger/info.c,v retrieving revision 1.24 diff -u -u -r1.24 info.c --- debugger/info.c 25 May 2002 21:18:34 -0000 1.24 +++ debugger/info.c 30 May 2002 18:01:08 -0000 @@ -536,6 +536,63 @@ DEBUG_Printf(DBG_CHN_MESG, "No longer walking module references list\n"); }
+struct dll_option_layout +{ + void* next; + void* prev; + char* const* channels; + int nb_channels; +}; + +void DEBUG_DbgChannel(BOOL add, const char* chnl, const char* name) +{ + DBG_VALUE dv; + DBG_ADDR ad; + struct dll_option_layout dol; + int i; + char* str; + unsigned char buffer[32]; + unsigned char mask; + int done = 0; + + if (!chnl) mask = 15; + else if (!strcmp(chnl, "fixme")) mask = 1; + else if (!strcmp(chnl, "err")) mask = 2; + else if (!strcmp(chnl, "warn")) mask = 4; + else if (!strcmp(chnl, "trace")) mask = 8; + else { DEBUG_Printf(DBG_CHN_MESG, "Unknown channel %s\n", chnl); return; } + + if (!DEBUG_GetSymbolValue("first_dll", -1, &dv, FALSE)) + { + DEBUG_Printf(DBG_CHN_MESG, "Can't get first_option symbol"); + return; + } + while (DEBUG_ToLinear(&dv.addr) && DEBUG_READ_MEM((void*)DEBUG_ToLinear(&dv.addr), &dol, sizeof(dol))) + { + for (i = 0; i < dol.nb_channels; i++) + { + ad.seg = 0; + ad.off = (unsigned long)(dol.channels + i); + if (DEBUG_READ_MEM((void*)DEBUG_ToLinear(&ad), &str, sizeof(str))) + { + ad.off = (unsigned long)str; + if (DEBUG_READ_MEM((void*)DEBUG_ToLinear(&ad), buffer, sizeof(buffer))) + { + if (!strcmp(buffer + 1, name)) + { + if (add) buffer[0] |= mask; else buffer[0] &= ~mask; + if (DEBUG_WRITE_MEM((void*)DEBUG_ToLinear(&ad), buffer, 1)) + done++; + } + } + } + } + dv.addr.off = (unsigned long)dol.next; + } + if (!done) DEBUG_Printf(DBG_CHN_MESG, "Unable to find debug channel %s\n", name); + else DEBUG_Printf(DBG_CHN_MESG, "Changed %d channel instances\n", done); +} + void DEBUG_InfoSegments(DWORD start, int length) { char flags[3];
I'd love to see that patch! Can anybody dig it up?
On Thu, May 30, 2002 at 08:05:10PM +0200, Eric Pouech wrote:
Much better would be an internal implementation.... Some comments about ?
this has already been discussed. there should be a patch floating around (but never committed to Wine because ugly, code bloat, intrusive...) to turn all debug channels on or off using a simple key stroke
Jeremy Shaw and another engineer here, David Fox, have been working for some time on a tool, aptly called winelog, that's written in ocamel and that takes the output of wine and does something pretty with it.
We could share this with you guys if you're interested.
What I'd really like to do is to make something like winelog, but graphical, that would let you process the logs on the fly. Ideally you would be able to do something like turn logging on or off, switch between threads, turn channels on and off. Jeremy and I were planning on using winelog as the backend for this and writing a graphical frontend, but we haven't had much time to work on it.