Chapter 17. Debug Tool and debugging C/C++ 361
17.2 Using the MFI debugger
Next we present the steps to using the MFI debugger:
1. The first step for using the main frame interface (MFI) is to invoke the program from batch
using the appropriate test runtime option. We will be debugging the C IVP that was
already compiled. The C IVP program can run with any number of command line
parameters. For our initial run, we will go with no parameters.
It may be to your advantage to allocate an INSPLOG data set. This will allow the setup
commands from this run to be captured, edited, and used as a preferences file for the next
run of this program. Remember that log data sets must be sequential and FB 72. We also
have had success with using the PC’s cut and paste feature to cut the commands we like
from the log screen of the debugger in order to create a preferences file.
For our purposes, the default LE values for the first three parameters are sufficient. But we
will not be using an INSPPREF file. Figure 17-1 shows the resultant command.
Figure 17-1 Invoking Debug Tool for the C IVP program
2. On entry to Debug Tool, the MFI screen looks as shown in Figure 17-2.
Figure 17-2 The MFI Screen on entry to C IVP
3. Now, we want to stop at the call to printf and at the exit. So we issue the commands:
AT CALL printf;
AT EXIT main;
362 Using IBM Application Development Tools for z/OS and OS/390
And we want to monitor i from the beginning and stop at main so we can monitor the
parameters to main:
MONITOR LIST i;
AT ENTRY main;
Pressing Enter produces the panel shown in Figure 17-3.
Figure 17-3 Debug Tool MFI screen after initial commands
4. If we press PF 11 to zoom to the log file, the panel in Figure 17-4 is displayed.
Figure 17-4 A zoom look at the log file after our initial commands
Chapter 17. Debug Tool and debugging C/C++ 363
5. Pressing PF11 gets us back to the original view. At this point we run the program and wait
for the first breakpoint to be reached, as shown in Figure 17-5.
Figure 17-5 At the first breakpoint
In Figure 17-5, note that the location where Debug Tool has stopped appears at the top
line of the screen.
6. At this point we want to add additional monitor statements for ac, av, and *av. Ideally one
should be able to put these monitor statements in one entry, but some experimentation
has found that they are not always accepted when the variable is out of scope. For this
reason we recommend putting a breakpoint at the appropriate scope and turning on the
monitoring at that point. The new monitor commands are:
MONITOR LIST ac;
MONITOR LIST av;
MONITOR LIST *av;
The monitor section at the top of Figure 17-6 now has entries for i, ac, av, and *av.
364 Using IBM Application Development Tools for z/OS and OS/390
Figure 17-6 At entry of main monitors showing initial values
7. Zooming to the log, we now find a summary of all our setup commands as shown in
Figure 17-7.
Figure 17-7 Current log file after all commands are set up
If you did not set up an INSPLOG this would be a good time to cut the commands from the
log file to later create a preference file.
Chapter 17. Debug Tool and debugging C/C++ 365
8. Press PF 11 to get back to the original view.
9. At this point we run again and the panel in Figure 17-8 is displayed.
Figure 17-8 At the exit of the program
Note that the printf breakpoint was never triggered because the printf was never executed.
Typ e qq to quit this session.
10.Edit your INSPLOG to create a preference file or paste the value cut from the log above.
Remember that a preference file should be FB 80
without sequence numbers. Our
preference file looks as shown in Figure 17-9.
Figure 17-9 Our new preferences file
Get Using IBM Application Development Tools for z/OS and OS/390 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.