7 * Written by Keith Marshall <keithmarshall@users.sourceforge.net>
8 * Copyright (C) 2010, 2011, MinGW Project
11 * Hooks to facilitate conditional compilation of code to activate
12 * selective debugging features.
15 * This is free software. Permission is granted to copy, modify and
16 * redistribute this software, under the provisions of the GNU General
17 * Public License, Version 3, (or, at your option, any later version),
18 * as published by the Free Software Foundation; see the file COPYING
19 * for licensing details.
21 * Note, in particular, that this software is provided "as is", in the
22 * hope that it may prove useful, but WITHOUT WARRANTY OF ANY KIND; not
23 * even an implied WARRANTY OF MERCHANTABILITY, nor of FITNESS FOR ANY
24 * PARTICULAR PURPOSE. Under no circumstances will the author, or the
25 * MinGW Project, accept liability for any damages, however caused,
26 * arising from the use of this software.
31 /* To facilitate identification of code which is added to assist
32 * in debugging, we explicitly define the DEBUG_INVOKED symbol; this
33 * explicitly expands to nothing, so that it may be incorporated
34 * as a transparent marker on any line of such code.
36 # define DEBUG_INVOKED
39 /* Here, we provide definitions and declarations which allow us
40 * to selectively enable compilation of (any specific class of)
41 * debug specific code.
43 # define DEBUG_ENABLED(FEATURE) (DEBUGLEVEL & (FEATURE))
45 # define DEBUG_TRACE_DYNAMIC 0x0001
47 # if DEBUG_ENABLED( DEBUG_TRACE_DYNAMIC )
48 /* When compiled with dynamic tracing enabled, we allow the user
49 * to choose which features are to be traced, by specification of
50 * the "--trace=FEATURES" command line option; however the features
51 * which may be selected are restricted to an explicit subset which
52 * has been specified at compile time.
56 # define DEBUG_REQUEST_FLAGS pkgOptions()->GetValue( OPTION_DEBUGLEVEL )
57 # define DEBUG_REQUEST(OPTION) (DEBUG_ENABLED( OPTION ) & DEBUG_REQUEST_FLAGS)
59 # else /* ! DEBUG_TRACE_DYNAMIC */
60 /* Without dynamic tracing enabled, only those features selected
61 * at compile time may be traced, and all unconditionally.
63 # define DEBUG_REQUEST(OPTION) (DEBUGLEVEL & (OPTION))
66 # define DEBUG_TRACE_INIT 0x0010
67 # define DEBUG_TRACE_TRANSACTIONS 0x0020
68 # define DEBUG_SUPPRESS_INSTALLATION 0x0040
69 # define DEBUG_UPDATE_INVENTORY 0x0080
71 # define DEBUG_TRACE_INTERNET_REQUESTS 0x0100
73 # define DEBUG_INHIBIT_RITES_OF_PASSAGE 0x7000
74 # define DEBUG_FAIL_FILE_RENAME_RITE 0x1000
75 # define DEBUG_FAIL_FILE_UNLINK_RITE 0x2000
77 # define DEBUG_INVOKE_IF( TEST, ACTION ) if( TEST ) ACTION
79 # else /* DEBUGLEVEL == 0 */
80 /* We use this space to provide any declarations which may be
81 * necessary to disable compilation of debug specific code...
83 # define DEBUG_INVOKE_IF( TEST, ACTION ) /* DO NOTHING */
85 # endif /* DEBUGLEVEL */
87 #endif /* DEBUG_H: $RCSfile$: end of file */