From d95ce8ce5d86ebc2cad759c527473cbaff0ca25e Mon Sep 17 00:00:00 2001 From: "Dimitrie O. Paun" Date: Wed, 18 Sep 2002 18:29:59 +0000 Subject: [PATCH] Update debug channel usage in DEVELOPER-HINTS. Remove references to obsolete dirs. --- DEVELOPERS-HINTS | 47 ++++++++++++++++++----------------------------- 1 file changed, 18 insertions(+), 29 deletions(-) diff --git a/DEVELOPERS-HINTS b/DEVELOPERS-HINTS index be0fc3c531c..95bf84fb403 100644 --- a/DEVELOPERS-HINTS +++ b/DEVELOPERS-HINTS @@ -133,7 +133,6 @@ Tools: Binary loader specific directories: ----------------------------------- - debugger/ - built-in debugger if1632/ - relay code miscemu/ - hardware instruction emulation graphics/win16drv/ - Win16 printer driver @@ -144,7 +143,6 @@ Winelib specific directories: ----------------------------- library/ - Required code for programs using Winelib - libtest/ - Small samples and tests programs/ - Extended samples / system utilities @@ -296,10 +294,8 @@ Debug channels -------------- 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,37 +510,31 @@ DEBUG MESSAGES 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: documentation/debug-msgs @@ -561,4 +551,3 @@ MORE INFO 3. In 1993 Dr. Dobbs Journal published a column called "Undocumented Corner". 4. You might want to check out BYTE from December 1983 as well :-) -