374 Supporting On Demand Business Applications with the IBM Problem Determination Tools
The last part is a log window, as shown in Figure 14-34.
Figure 14-34 Debug Tool -PLI - Remote debugger - Log window
7. The land array is the array that will hold the results (the final path across the chess board),
and you would like to monitor the changes in the land array. Right-click in the Breakpoints
window and select Add Breakpoint followed by the Watch entry to bring up the panel
shown in Figure 14-35. We selected the first 128 bytes to be monitored.
Figure 14-35 Debug Tool - PLI - Remote debugger - setting a storage change breakpoint (part 1)
Chapter 14. Debugging programs using Debug Tool 375
8. Click Next to complete the expression for the monitoring of land, shown in Figure 14-36.
Figure 14-36 Debug Tool - PLI - Remote debugger - setting a storage change breakpoint (part 2)
9. Click the green play arrow to see what is going to happen, as shown in Figure 14-37.
Figure 14-37 Debug Tool - PLI - Remote debugger - first storage change stop after the allocation
The breakpoint window shows your two breakpoints. The log window indicates that the
program was stopped due to a storage change/watch breakpoint on land for 128 bytes.
10.Click play again. This results in the panel shown in Figure 14-38 on page 376.
376 Supporting On Demand Business Applications with the IBM Problem Determination Tools
Figure 14-38 Debug Tool - PLI - Remote debugger - at the second storage change breakpoint
11.The program stops when land(1,1) is modified and set to 1.
Click play again and see that land(2,3) has been set to 2.
Chapter 14. Debugging programs using Debug Tool 377
Click play a third time. The result is shown in Figure 14-39.
Figure 14-39 Debug Tool - PLI - Remote debugger - at the third storage overwrite
378 Supporting On Demand Business Applications with the IBM Problem Determination Tools
Note that the land(1,1) entry has been rewritten. Obviously there must be something
wrong with rank(1,1). Take a look by compressing land in the locals window and selecting
rank, as shown in Figure 14-40.
Figure 14-40 Debug Tool - PLI - Remote debugger - looking at the value of rank(1,1)
12.Remember that a 0 value at a rank position indicates a position to which the knight should
not go. However, rank(1,1) has a value of 1. The problem is that the value of rank is not
being set to 0 once it has been used as a landing point in the path. Modify the code to add
the following statement at line 169:
rank(r,c) = 0;
This means that used squares are marked out of bounds and will not be selected, as
shown in Example 14-6.
Example 14-6 Final code change to fix the knight code
else;
end;
/********************************************************/
/* make the move */
/* */
/********************************************************/
rank(r,c) = 0;
r = r + rowjump(minmove);
c = c + coljump(minmove);
m = m + 1;
land(r,c) = m;
end;

Get Supporting On Demand Business Applications with the IBM Problem Determination Tools (APA, DT, DT with Advanced Facilities, FA, File Export, FM, WS) now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.