Try OpenEdge Now
skip to main content
Debugging and Troubleshooting
OpenEdge Debugger : Using System Handles for Debugging : Using the DEBUGGER system handle to start and control the Debugger : Using the DEBUGGER system handle in application mode : Debugging by controlling breakpoints from an ABL procedure
 
Debugging by controlling breakpoints from an ABL procedure
To start the Debugger and control breakpoints from an ABL procedure:
1. Optionally, add a DEFINE VARIABLE statement that defines a logical variable you can use to assign the return value for DEBUGGER system handle methods.
2. Add a DEBUGGER system handle statement that invokes the INITIATE( ) method before the point where you want to begin debugging. This initializes the Debugger but does not immediately make it visible.
3. Add one or more DEBUGGER system handle statements that invoke the SET-BREAK( ) method to set at least one breakpoint that occurs after the statement where you set it. The SET-BREAK( ) method that sets the breakpoint must also execute after the statement that invokes the INITIATE( ) method in the previous step.
4. Run the invoking procedure.
For example, in the following listing fragment, the Debugger is initialized on line 6, and the procedure stops at a breakpoint on line 15. The Debugger takes control at this point. From here, you can continue executing the invoking procedure under Debugger control, stopping at and continuing from all breakpoints, as shown:
        1   DEFINE VARIABLE procname
2     AS CHARACTER NO-UNDO EXTENT 6.
3   DEFINE VARIABLE Selection
4     AS INTEGER   NO-UNDO FORMAT "9".
5   DEFINE VARIABLE debug AS LOGICAL NO-UNDO.
6   debug=DEBUGGER:INITIATE().
7   /* Initialize the list of procedure names to be run */
8   procname[1] = "custedit.p".
9   procname[2] = "custrpt.p".
10   procname[3] = "ordedit.p".
11   procname[4] = "ordrpt.p".
12   procname[5] = "itemedit.p".
13   procname[6] = "itemrpt.p".
14   debug=DEBUGGER:SET-BREAK().
* => 15   DISPLAY "S A L E S O R D E R S Y S T E M" SKIP(1)
16     WITH COLUMN 18 NO-BOX.
17   . . .
When you exit the Debugger, the AVM instance continues execution from its current stopping (or breaking) point. If you exit the procedure before exiting the Debugger, the Debugger window closes and control returns to the startup environment (such as the Procedure Editor or AppBuilder).