Code Example –
Setting a conditional breakpoint
In this example, we are going to set a breakpoint when a condition has been met within the aArray variable. The condition which we would like to set the breakpoint is when:
Setting this in the Edit Breakpoint form, will look like this.
|Breakpoint Trigger||Source File/Line Number||We are selecting to set a breakpoint within a specific source file and a specific line number|
|Source Code Filename||pdloop.cfm||Name / location of the file where the code is stored|
|Source Line Number||3||This is important. If we are checking the value of a variable, then this variable must have been set before this line number has been reached in order for the breakpoint to fire.|
||This is the example condition which will cause the breakpoint to fire and execution of the page to halt|
|Fire Count||Always||This indicates that the breakpoint will ALWAYS fire. If we set the Fire Count to a numeric value, e.g. 3 – then the breakpoint would fire 3 times.
|Trigger Handler||Pause Thread||Will tell FusionReactor to pause the currently executing thread when the condition has been met|
|Pause Time||60||The thread will be paused for 60 seconds. During this time, the breakpoint can be intercepted by clicking on the Production Debugger icon – or from within the Paused Threads menu item|
|Pause Execution||On every thread that fires the breakpoint||Will cause the engine to halt for every single thread in which the breakpoint condition fires.|
When the breakpoint has been setup, you will see the following when you click on the Breakpoints menu item – If the page has not yet been executed – then we will see the State as being Pending
Seeing when a breakpoint fires
When the page
pdloop.cfm is executed, the condition will fire and the page will halt execution.
In the Breakpoints menu, the breakpoint will be shown as follows – NOTE – the State now shows the ClassLoader information, as the page has actually been loaded and executed.
When the breakpoint fires, then the Debugger icon will appear in the top banner –
You can either click on the Debugger icon or click the Paused Threads link in the Debug Menu, you will then see the Paused Thread – together with the Timeout Countdown
To start the Production Debugger session, you need to click on the Debug Icon –
Working with the a debugger in the Thread View Page
The Thread View page shows the details of a specific thread once the thread has been paused in the interactive debugger.
Source Code Viewer
The source code viewer will show the source code for the location where the interactive debugger is currently paused – line 3 in our example.
The variables viewer shows the variables currently available on the thread at the specific location that the interactive debugger has paused.
As we have set the breakpoint to fire when
aArray[i] EQ "March" – we would expect
We can also see the Variable values in the
Modifying a variable value
We can now modify the value of a variable. In this example, let us change the value of
May in the Spring
You should now see the following when you expand
Once you have changed the variable value, hit the Resume icon to continue execution of the program.
The page results will then look like.