ILE C/C++ Programmer's Guide


Stepping Over Procedures

If you specify over on the STEP debug command, calls to procedures and functions count as single statements. This is the default STEP mode. Stepping through four statements of a program could result in running 20 statements if one of the four is a call to a procedure with 16 statements. You can start the step-over function by using:

Example:

This example shows you how to use F10 (Step) to step over one statement at a time in your program.

  1. To work with a module type DSPMODSRC and press Enter. The Display Module Source display is shown.
  2. Enter display module T1520IC2.
  3. To set an unconditional breakpoint at line 50, enter Break 50 on the debug command line.
  4. To set a conditional breakpoint at line 35, enter Break 35 when i==21 on the debug command line.
  5. Press F12 (Resume) to leave the Display Module Source display.
  6. Call the program. The program stops at breakpoint 35 if i is equal to 21, or at line 50 whichever comes first.
  7. To step over a statement, press F10 (Step). One statement of the program runs, and then the Display Module Source display is shown. If the statement is a function call, the function runs to completion. If the called function has a breakpoint set, however, the breakpoint will be hit. At this point you are in the function and the next step will take you to the next statement inside the function.
    Note:
    You cannot specify the number of statements to step through when you use F10. Pressing F10 performs a single step.
    +--------------------------------------------------------------------------------+
    |                              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.                                                         |
    +--------------------------------------------------------------------------------+
  8. To step over 5 statements, enter step 5 over on the debug command line. The next five statements of your program run, and then the Display Module Source display is shown.

    If the third statement is a call to a function, the first two statements run, the function is called and returns, and the last two statements run.

  9. To step over 11 statements, enter step 11 over on the debug command liner. 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 ]