You can also enable or disable the DEBUG preprocessor symbol. This is useful if you want to add code to your application to help you debug while testing the application. Although you do not typically enable the DEBUG symbol in a release build, if a problem is reported in a production application, you can redeploy the release build with the DEBUG symbol enabled to help determine the nature or location of the problem.
When the DEBUG symbol is enabled, code that is enclosed in a code block with the following format is parsed by the pb2cs code emitter:
#if defined DEBUG then /*debugging code*/ #else /* other action*/ #end if
Adding breakpoints in a DEBUG block When you use the DEBUG symbol, you can add breakpoints in the DEBUG block only for lines of code that are not in an ELSE clause that removes the DEBUG condition. If you attempt to add a breakpoint in the ELSE clause, the debugger automatically switches the breakpoint to the last line of the clause defining the DEBUG condition.
In the previous pseudocode example, if you add a breakpoint
to the comment line “/* other
action*/
”, the breakpoint
automatically switches to the “/*debugging
code*/
” comment line.
Figure 17-1 shows the pop-up menu item that you can use to paste the #If Defined DEBUG Then template statement in the Script view.
Figure 17-1: Menu cascade for pasting a template into a script
For more information about using preprocessor symbols, see “About conditional compilation”.