On September 18, 2002 12:08 am, Dimitrie O. Paun wrote: > A patch I promised some time ago Too fast, again. Just noticed more problems. Use this one instead. ChangeLog Update debug channel usage in DEVELOPER-HINTS Remove references to obsolete dirs Index: DEVELOPERS-HINTS =================================================================== RCS file: /var/cvs/wine/DEVELOPERS-HINTS,v retrieving revision 1.12 diff -u -r1.12 DEVELOPERS-HINTS --- DEVELOPERS-HINTS 6 May 2002 20:08:43 -0000 1.12 +++ DEVELOPERS-HINTS 18 Sep 2002 04:20:22 -0000 @@ -133,7 +133,6 @@ Binary loader specific directories: ----------------------------------- - debugger/ - built-in debugger if1632/ - relay code miscemu/ - hardware instruction emulation graphics/win16drv/ - Win16 printer driver @@ -144,7 +143,6 @@ ----------------------------- library/ - Required code for programs using Winelib - libtest/ - Small samples and tests programs/ - Extended samples / system utilities @@ -296,10 +294,8 @@ -------------- If you need to create a new debug channel, just add the -DECLARE_DEBUG_CHANNEL to your .c file(s) and rerun -tools/make_debug. When sending out your patch, you don't need to -provide neither ./configure nor the ./include/debugdefs.h diffs. Just -indicate that those files need to be regenerated. +WINE_DEFAULT_DEBUG_CHANNEL to your .c file(s), and use them. +All the housekeeping will happen automatically. Resources --------- @@ -514,36 +510,30 @@ To display a message only during debugging, you normally write something like this: - TRACE(win,"abc..."); or - FIXME(win,"abc..."); or - WARN(win,"abc..."); or - ERR(win,"abc..."); + TRACE("abc..."); or + FIXME("abc..."); or + WARN("abc..."); or + ERR("abc..."); depending on the seriousness of the problem. (documentation/degug-msgs -explains when it is appropriate to use each of them) +explains when it is appropriate to use each of them). You need to declare +the debug channel name at the top of the file (after the includes) using +the WINE_DEFAULT_DEBUG_CHANNEL macro, like so: -These macros are defined in include/debug.h. The macro-definitions are -generated by the shell-script tools/make_debug. It scans the source -code for symbols of this forms and puts the necessary macro -definitions in include/debug.h and include/debugdefs.h. These macros -test whether the debugging "channel" associated with the first -argument of these macros (win in the above example) is enabled and -thus decide whether to actually display the text. In addition you can -change the types of displayed messages by supplying the "-debugmsg" -option to Wine. If your debugging code is more complex than just -printf, you can use the symbols TRACE_ON(xxx), WARN_ON(xxx), -ERR_ON(xxx) and FIXME_ON(xxx) as well. These are true when channel xxx -is enabled, either permanent or in the command line. Thus, you can -write: + WINE_DEFAULT_DEBUG_CHANNEL(win); - if(TRACE_ON(win))DumpSomeStructure(&str); +If your debugging code is more complex than just printf, you can use +the macros: + + TRACE_ON(xxx), WARN_ON(xxx), ERR_ON(xxx) and FIXME_ON(xxx) + +to test if the given channel is enabled. Thus, you can write: + + if (TRACE_ON(win)) DumpSomeStructure(&str); Don't worry about the inefficiency of the test. If it is permanently disabled (that is TRACE_ON(win) is 0 at compile time), the compiler will eliminate the dead code. - -You have to start tools/make_debug only if you introduced a new macro, -e.g. TRACE(win32). For more info about debugging messages, read: