Table of Contents Previous Next


7 Debugger : 7.1.5 Debugging a Program

Screen shot 2013-07-25 at 9 Use the Step Into icon to execute the line of code currently highlighted by the green bar in the Program Body pane, and then pause execution. If the executed code line is a call to a subprogram, the called subprogram is brought into the Program Body pane, and the first executable line of code of the subprogram is highlighted as the Debugger waits for you to perform an operation on the subprogram.
Screen shot 2013-07-25 at 9 Use the Step Over icon to execute a line of code, stepping over any subprograms invoked by that line of code. The subprogram is executed, but not debugged. If the subprogram contains a breakpoint, the debugger will stop at that breakpoint.
Screen shot 2013-07-25 at 9 Use the Continue icon to execute the line of code highlighted by the green bar, and continue execution until either a breakpoint is encountered or the last line of the program has been executed.
Figure 7.11 shows the locations of the Step Into, Step Over, and Continue icons on the tool bar:
Screen shot 2013-07-25 at 9
Screen shot 2013-07-25 at 9
Local Breakpoint - A local breakpoint can be set at any executable line of code within a program. The Debugger pauses execution when it reaches a line where a local breakpoint has been set.
Global Breakpoint - A global breakpoint will trigger when any session reaches that breakpoint. Set a global breakpoint if you want to perform in-context debugging of a program. When a global breakpoint is set on a program, the debugging session that set the global breakpoint waits until that program is invoked in another session. A global breakpoint can only be set by a superuser.
breakpoint
You can also set a breakpoint by left-clicking in the Program Body to place your cursor, and selecting Toggle Breakpoint from Debug menu or by clicking the Toggle Breakpoint icon (see Figure 7.14). A red dot appears in the left-hand margin indicating a breakpoint has been set as the line of code.
Screen shot 2013-07-25 at 10
Left click the mouse on the red breakpoint indicator in the left margin of the Program Body pane. The red dot disappears, indicating that the breakpoint has been removed.
Use your mouse to select the location of the breakpoint in the code body, and select Toggle Breakpoint from Debug menu, or click the Toggle Breakpoint icon.
You can remove all of the breakpoints from the program that currently appears in the Program Body frame by selecting Clear all breakpoints from the Debug menu (see Figure 7.15) or by clicking the Clear All Breakpoints icon.
Screen shot 2013-07-25 at 10
Note: When you perform any of the preceding actions, only the breakpoints in the program that currently appears in the Program Body frame are removed. Breakpoints in called subprograms or breakpoints in programs that call the program currently appearing in the Program Body frame are not removed.
To set a global breakpoint for in-context debugging, highlight the stored procedure, function, or trigger on which you wish to set the breakpoint in the Object browser panel. Navigate through the Tools menu to select Debugging, and then Set Breakpoint (see Figure 7.16)
global_breakpoint_1
global_breakpoint_2
After you choose Set Breakpoint, the Debugger window opens and waits for an application to call the program to be debugged (see Figure 7.18).
global_breakpoint_3
In Figure 7.19, the EDB-PSQL client invokes the select_emp function (on which a global breakpoint has been set).
global_breakpoint_4
The select_emp function does not complete until you step through the program in the Debugger, which now appears as shown in Figure 7.20.
global_breakpoint_5
global_breakpoint_6
The select_emp function completes execution and its output is displayed.
At this point, you can end the Debugger session by choosing Exit from the File menu. If you do not end the Debugger session, the next application that invokes the program will encounter the global breakpoint and the debugging cycle will begin again.
To end a Debugger session and exit the Debugger, select Exit from File menu or press Alt-F4 as shown by the following:
exit_debugger

7 Debugger : 7.1.5 Debugging a Program

Table of Contents Previous Next