ILE C/C++ Programmer's Guide


Stepping into Procedures

There is an automatic feature for stepping. This feature automatically puts a service program into debug. This happens if the service program that is stepped into from another program in debug:

The service program is added to debug for the user, and the DSPMODSRC panel shows the procedure in the service program. From this point, modules in the service program can be accessed using the Work with Modules display just like modules in programs the user added to debug.

If you specify INTO on the STEP debug command, each statement in a procedure or function that is called counts as a single statement. You can start the step into function by using:

Example:

This example shows you how to use F22 (Step Into) to step into one procedure.

  1. Enter DSPMODSRC. The Display Module Source display is shown.
  2. To set an unconditional breakpoint at line 50, enter Break 50 on the debug command line.
  3. To set a conditional breakpoint at line 35, enter Break 35 when i==21 on the debug command line.
  4. Press F12 (Resume) to leave the Display Module Source display.
  5. Call the program. The program stops at breakpoint 35 if i is equal to 21 or at line 50 whichever comes first.
    +--------------------------------------------------------------------------------+
    |                              Display Module Source                             |
    | Program:   T1520PG1       Library:   MYLIB          Module:   T1520IC2         |
    |     47      if (j<0) return(0);                                                |
    |     48      if (hold_formatted_cost[i] == '$')                                 |
    |     49      {                                                                  |
    |     50        formatted_cost[j] = hold_formatted_cost[i];                      |
    |     51        break;                                                           |
    |     52      }                                                                  |
    |     53      if (i<16 &&; !((i-2)%3))                                           |
    |     54      {                                                                  |
    |     55        formatted_cost[j] = ',';                                         |
    |     56        --j;                                                             |
    |     57      }                                                                  |
    |     58      formatted_cost[j] = hold_formatted_cost[i];                        |
    |     59      --j;                                                               |
    |     60    }                                                                    |
    |     61                                                                         |
    | 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 50.                                                         |
    +--------------------------------------------------------------------------------+
  6. Press F22 (Step into). One statement of the program runs, and then the Display Module Source display is shown. If the statement is a procedure or function call, the program stops at the first statement of the procedure or function.
    Note:
    You cannot specify the number of statements to step through when you use F22. Pressing F22 performs a single step.
  7. To step into 5 statements, enter step 5 into on the debug command line.

    The next five statements of your program are run, and then the Display Module Source display is shown. If the third statement is a call to a function, the first two statements of the calling procedure run, and the first two statements of the function run.

    Note:
    The step is counted as a statement.
  8. To step into 11 statements, enter step 11 into on the debug command line. The next 11 statements of your program runs. The Display Module Source display is shown.


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