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];