News:

Building a 3D Ray Tracer  By stevmjon

Main Menu

Managing the PlayBASIC Debugger's Trace Mode

Started by kevin, June 05, 2005, 10:38:29 AM

Previous topic - Next topic

kevin

This tiny example shows how you can ensure that a section of code will be compiled with a specified debugger trace mode enabled, regardless of the current state of trace.  At the end of the code section the previous trace mode is restored.

 You can use this for your own code/function libraries.  This will make sure that the debugger won't trace into your functions for example.  This not makes larger program perform better while compiled in debug mode, it will also make debugging larger programs much easier too. As the debugger won't trace into/through what could be pages of not relevant code (relevant to your debugging that is)      

Of course each section you wish to protect, requires it's own unique constant.  This constant stores the debugger trace state at the start of this section.  Thus it's used to restore the trace state  at the bottom of this section of code.




For PlayBASIC V1.074 and above    (compile in Debug mode (F6 or F7) to see the affect from the ide)



PlayBASIC Code: [Select]
print PBDebugMode
print PBCompileMode


#if PBDebug=true
#if PBDebugMode=2
constant PreviousTraceState=PBTraceState
#trace off
#endif
#endif

; My Code library here

print "Previous trace state:"+str$(PreviousTraceState)
print "trace mode current status:"+str$(PBTraceState)



#if PBDebug=true
#if PBDebugMode=2
#trace PreviousTraceState
#endif
#endif


Sync
waitkey