About the Current Execution Location and Current Stack Frame

The current execution location specifies the next PL/SQL source line to be executed. It corresponds to what is commonly referred to as the program counter, or PC.

When you run a module containing a breakpoint in debug mode, execution is suspended just before reaching the source line on which the breakpoint is set. Control is then passed to the debugger, and the PL/SQL Editor automatically displays the source line associated with the current execution location--this location is represented by a pointer in the left margin.

At this point, the current execution location is the source line where the breakpoint is set. When you resume running the module, for example, by choosing the Step Into command, the current execution source line is executed and the pointer advances by one line to a new current execution location.

When a breakpoint is encountered or when execution is suspended by a Step command, the current stack frame is initialized to the execution location of the subprogram at the top of the call stack. The current stack frame is where the debugger looks for variables and parameters associated with the state of the subprogram in the stack. You can change the stack frame to another frame on the stack. This enables you to view local variables of another subprogram in the call chain.

Consider the following code where a breakpoint is set at line 4:

PROCEDURE count_loops (v_count IN NUMBER) IS
  BEGIN
  FOR i in 1..v_count LOOP
* do_message('Number of times through the loop
  '||to_char(i));
  END LOOP;
END;

When run in debug mode, execution is suspended just before line 4 where the breakpoint is set. In the PL/SQL Editor, the pointer is at line 4--the current execution location--which is the next source line to be executed. The current stack frame initializes to procedure COUNT_LOOPS:

MODULE_A.COUNT_LOOPS::4

MODULE_A.WHEN_BUTTON_PRESSED (BLOCK_NAME.CONTROL)::2

In the current stack frame, you can display the local variable values of V_COUNT and I.

When you choose the Step Into command, line 4 executes and the program steps into procedure DO_MESSAGE.

PROCEDURE do_message(msg varchar2) IS
  n number;
BEGIN
> IF (name_in('global.ignoremsg') != 'TRUE') THEN
  OFM_ALERT.SET_PROPERTY('alert', OFC.ALERT_MESSAGE_TEXT,
  msg);
  n := OFM_ALERT.SHOW('alert');
  END IF;
END;

Suspension then occurs at the next current execution location, which is line 4 of procedure DO_MESSAGE. The current stack frame then initializes to procedure DO_MESSAGE:

MODULE_A.DO_MESSAGE::4

MODULE_A.COUNT_LOOPS::4

MODULE_A.CONTROL.WHEN_BUTTON_PRESSED::2

In the current stack frame, you can display the local variable values of MSG and N.


About Breakpoints and Executable Source Lines

About the Call Stack and Stack Frames

Changing the Current Stack Frame

Stepping Through Code

Viewing Stack Frames