Explore the Debugger

Follow these steps to explore Debugger features.

  1. Expand the Intermediate Files folder in the Accounts node and double-click Account.4gl to open the source in Code Editor.

    This figure shows the open Account.4gl application.

    Figure 1. The Account application open in Code Editor

  2. Right-click on line 33, a function call to AccountForm_ui_uiOpenForm() and select Add/Delete Breakpoint. A red dot, the breakpoint icon, appears in the gutter adjacent to line 33.

    This figure shows a breakpoint at line 33 of the Account.4gl application.

    Figure 2. Adding a breakpoint

  3. Right-click the Accounts application node and select Debug to start the application in Debug mode. When the application runs, it stops at the breakpoint, and waits.

    Figure 3. Waiting at a breakpoint


    This figure shows the Accounts application in Debug mode, waiting at a breakpoint.
  4. Select Debug >> Step in to execute the function call and open the function module, AccountForm_ui.4gl, in Code Editor. Execution stops inside the called function, waiting for the next Debugger instruction.

    This figure shows the results of the Step in instruction - program execution waiting inside the called function.

    Figure 4. Stepping into an external function

  5. Use the Code Structure view to quickly locate functions in AccountForm_ui.4gl for additional breakpoints:
    1. In the Code Structure view, select the AccountForm_ui_uiDisplay() function to display the function source in Code Editor.
    2. In Code Editor, right-click on the line containing the function header and select Add/Delete Breakpoint.
    3. Repeat Sub-steps a and b to create a breakpoint for the AccountForm_ui_uiInput() function.
    This figure shows a breakpoint created on the AccountForm_ui_uiDisplay() function after using the Code Structure view for navigation.

    Figure 5. Navigating functions using the Code Structure view

  6. In the Data view examine the values of local, module and global variables.
  7. In the Data view, expand the Local variables folder, right-click on the variable p_openMode, and select Add to watch. Setting a watchpoint on the p_openMode variable will stop program execution each time the variable value changes.

    This figure shows creating a watchpoint on the p_openMode variable in the Data view.

    Figure 6. Adding a Watchpoint

  8. In the command line area of the Command view, type continue to resume program execution until the p_openMode watchpoint is triggered. Entering the continue command resumes program execution until a breakpoint is reached, a watchpoint is triggered, or the program terminates. The continue command is also available in the Debug menu and toolbar.

    This figure shows the results of the continue command typed in manually using the Command view. Program execution continued until the p_openMode watchpoint was triggered by a change in value to "DISPLAY".

    Figure 7. Command view showing the results of the continue command

  9. Select Debug >> Continue. An application screen displays and program execution stops at the breakpoint on function AccountForm_ui_uiDisplay().
  10. Use the Backtrace view to see which functions in the program have been called.

    The Backtrace view in this figure shows that the current function is AccountForm_ui_uiDisplay() which was called from AccountForm_ui_uiAutomaton() in AccountForm_ui.4gl.

    Figure 8. The Backtrace view

  11. Select Debug >> Continue. Program execution continues until an interactive Dialog statement (DISPLAY ARRAY) switches control to the application screen, which appears exactly as if it were running outside the Debugger.

    This figure shows the application screen displayed during the debugger session.

    Figure 9. The application screen

  12. Interact with the program:
    1. Select Search in the Accounts window
    2. Type miller into the User Id field and select Accept. Control switches back to the Debugger and program execution continues until it reaches the breakpoint at function AccountForm_ui_uiDisplay().
    3. Select Debug >> Next to step through the application one instruction at a time until the record for userid miller displays and control is switched back to the application screen.
    4. Select File >> Exit to close the application screen and return control back to the Debugger.
  13. Select Debug >> Continue to terminate the application and complete the tour. Terminating the application also terminates the Debugger session.