ILE C/C++ Programmer's Guide

Displaying a Structure

The following example shows a structure with two elements being displayed. Each element of the structure is formatted according to its type and displayed.

  1. Enter DSPMODSRCr. The Display Module Source display is shown.
  2. Set a breakpoint at line 9.
  3. Press F12 (Resume) to leave the Display Module Source display.
  4. Call the program. The program stops at the breakpoint at line 9.
  5. Enter eval test on the debug command line, as shown:
    +--------------------------------------------------------------------------------+
    |                              Display Module Source                             |
    | Program:   TEST1          Library:   DEBUG          Module:   MAIN             |
    |      1  struct {                                                               |
    |      2    char charValue;                                                      |
    |      3    unsigned long intValue;                                              |
    |      4  } test;                                                                |
    |      5                                                                         |
    |      6  int main(){                                                            |
    |      7    test.intValue = 10;                                                  |
    |      8    test.charValue = 'c';                                                |
    |      9    test.charValue = 11;                                                 |
    |     10    return 0;                                                            |
    |     11  }                                                                      |
    |                                                                     Bottom     |
    | Debug . . .  eval test__________________________________________________       |
    | ________________________________________________________________________       |
    | F3=Exit program   F6=Add/Clear breakpoint   F10=Step   F11=Display variable    |
    | F12=Resume       F17=Watch variable   F18=Work with watch F24=More keys        |
    +--------------------------------------------------------------------------------+
  6. Press Enter to go to the next display. The Evaluate Expression Display shows the entire structure as shown:
    +--------------------------------------------------------------------------------+
    |                              Evaluate Expression                               |
    | Previous debug expressions                                                     |
    | > BREAK 9                                                                      |
    | > EVAL test                                                                    |
    |   test.charValue = 'c'                                                         |
    |   test.intValue = 10                                                           |
    +--------------------------------------------------------------------------------+
  7. Press Enter from the Evaluate Expression Display to return to the Display Module Source screen.


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