ILE C/C++ Programmer's Guide

Example of Stepping into a Program Using F22

Use F22 (Step Into) to step into program CPGM from the program DEBUGEX.

  1. Assume that the Display Module Source display shows the source for DEBUGEX.
  2. To set an unconditional breakpoint at line 92, which is the last executable statement before the call to function CalcTax() in program CPPPGM, type Break 92 and press Enter.
  3. Press F3 (End Program) to leave the Display Module Source display.
  4. Call the program. The program stops at breakpoint 92, as shown in Figure 71.

    Figure 71. Module Source Display for DEBUGEX


    DEBUGEX Before Stepping Into CPGM

    +--------------------------------------------------------------------------------+
    |                             Display Module Source                              |
    | Program:   DEBUGEX        Library:   MYLIB          Module:   DEBUGEX          |
    |     88          cout << "Please enter amount" << endl;                         |
    |     89          cin >> input;                                                  |
    |     90          if (input > MINIMUM) {                                         |
    |     91          // call function CalcTax in separate program CPPPGM            |
    |     92             retval1 = CalcTax(input);                                   |
    |     93             if (retval1 > LIMIT)                                        |
    |     94                retval2 = CalcSurtax(input)                              |
    |     95          }                                                              |
    |     96          cout << "Total tax is " << retval1 = retval2 << endl;          |
    |     97       }                                                                 |
    |     98                                                                         |
    |     99                                                                         |
    |    100                                                                         |
    |    101                                                                         |
    |    102                                                                         |
    |                                                                       More...  |
    | Debug . . .    ________________________________________________________________|
    | _______________________________________________________________________________|
    | F3=End program   F6=Add/Clear breakpoint   F10=Step   F11=Display variable     |
    | F12=Resume       F17=Watch variable    F18=Work with watch   F24=More keys     |
    | Breakpoint at line 90                                                          |
    +--------------------------------------------------------------------------------+
  5. Press F22 (Step into). One statement of the program is run, and then the Display Module Source display of CPGM is shown.

    The program stops at the first executable statement of CPGM (line 13).

    Note:
    You cannot specify the number of statements to step through when you use F22. Pressing F22 performs a single step.

Figure 72. Module Source Display After Stepping into CPGM


+--------------------------------------------------------------------------------+
|                             Display Module Source                              |
| Program:   CPGM         Library:   MYLIB                                       |
|      1        *=============================================================== |
|      2        *  CPGM - Program called by DEBUGEX to illustrate the            |
|      3        *           STEP functions of the ILE source                     |
|      4        *debugger                                                        |
|      5        *  This program receives a parameter input from DEBUGEX,         |
|      6        *  calculates a tax amount, and then returns                     |
|      7        *=============================================================== |
|      8                                                                         |
|      9        double CalcTax(double input)                                     |
|     10{                                                                        |
|     11             double tax;                                                 |
|     12                                                                         |
|     13        tax= input * TAXRATE                                             |
|                                                                                |
|     14             return taxrate;                                             |
|                                                                         Bottom |
| Debug . . .____________________________________________________________________|
| _______________________________________________________________________________|
|                                                                                |
| F3=End program   F6=Add/Clear breakpoint   F10=Step   F11=Display variable     |
| F12=Resume       F17=Watch variable   F18=Work with watch   F24=More keys      |
| Step completed at line 13.                                                     |
+--------------------------------------------------------------------------------+

If there is no debug data available, you see a blank Display Module Source display with a message indicating that the source is not available.


[ Top of Page | Previous Page | Next Page | Table of Contents ]