Explore the Debugger
Follow these steps to explore Debugger features.
Before you begin: You must have opened and built the OfficeStore project.
-
Expand the Intermediate Files folder in the
Account_prg node and doubleclick
Account_prg.4gl to open the source in Code
Editor.
-
Right-click on the function call to
Account_openFirstForm()
(approximately line 50) and select Add/Delete Breakpoint.A red dot, the breakpoint icon, appears in the gutter adjacent to the line of code. -
In the Code Structure view, expand the
MODULE AccountForm_ui
node and locate theAccountForm_ui_uiOpenForm()
function. -
Click on the function in the Code Structure view to locate it in the source
code.
The module (AccountForm_ui.4gl) opens in the Code Editor.
-
Set a breakpoint at the
AccountForm_ui_uiOpenForm()
function header.The Code Structure view is updated to display variables, additional functions, and imported source modules of the AccountForm_ui.4gl module. -
Close the AccountForm_ui.4gl source module, right-click
the Accounts_prg configuration node, and select
Debug.
The application runs in debug mode and stops at the first breakpoint.
-
Select Debug > Continue to continue program execution.
The program opens the AccountForm_ui.4gl source module and stops at the breakpoint on
AccountForm_ui_uiOpenForm()
. -
Select Debug > Next to step through the program until you reach the function call to
AccountForm_ui_uiOpenFormByKey()
. -
Select Debug > Step in to execute the function call and scroll to the function source in
Code Editor.
The program stops at the first line of executable code in the function and waits.
-
Set breakpoints for the following two functions (use the Code Structure view to
locate them) in AccountForm_ui.4gl.
AccountForm_ui_uiDisplay()
AccountForm_ui_uiInput()
-
In the Data view, locate the Module variables for the
AccountForm_uidialog
module. Expand them_uiSettings
record to view the record members, then right-click onopenMode
and select Add to watch.Program execution will stop each time them_uiSettings.openMode
variable changes.Tip:Increase the visibility of
m_uiSettings.openMode
by adding it to the user variables. Right-click onopenMode
and select Copy to User variable. Now you can monitor the variable at the top of the Data view in User variables. -
In the Command view, type continue and press the Enter
key.
Entering the
continue
command resumes program execution until the watchpoint onm_uiSettings.openMode
triggers. -
Select Debug > Continue twice.
An application screen displays and program execution stops.
- Select Debug > Interrupt to temporarily return control to the Debugger and scroll to the current line of code, a dialog statement.
-
Use the Backtrace view to see which functions in the
program have been called.
-
Select Debug > Continue.
Program execution switches control back to the application screen, which appears the same as if it were running outside the Debugger.
-
Interact with the program:
- Select Search in the Accounts window
-
Type miller into the Last
Name field and click
Accept.
Control switches back to the Debugger and program execution continues until it reaches the breakpoint at function
AccountForm_ui_uiDisplay()
. - Select Debug > Continue to continue program execution until the record for user Miller displays and control switches back to the application screen
-
Select File > Exit to close the application screen and terminate the
application.
Terminating the application also terminates the Debugger session.