The call stack represents the chain of subprograms starting from the inital entry point down to the currently executing subprogram.
For example, if procedure A calls procedure B, which in turn calls procedure C and a statement in procedure C is currently executing, the call stack would appear as shown:
Module_A C::7
Module_A B::2
Module_A A::8
Each subprogram call is represented by a frame on the stack. A stack frame contains information about the corresponding subprogram--its name, actual parameter values, local variable values, and the next statement to be executed. For example, Module_A C::7 indicates that line 7 of C in module Module_A will be executed when the application resumes running.
During debugging, the Stack window displays the stack of subprogram calls (frames) that are currently active. Stack frames are listed in the reverse order the subprograms were executed. The earliest frame is at the bottom of the stack, while the latest frame is at the top of the stack. When a subprogram is called, it is pushed to the top of the stack. When the subprogram returns, it is pushed off the stack.
For example, consider the module MODULE_A which has a WHEN_BUTTON_PRESSED trigger that executes the procedure COUNT_LOOPS. This procedure in turns calls another procedure, DO_MESSAGE. When execution is suspended by a breakpoint at line 4 of procedure DO_MESSAGE, the stack frames would appear as follows:
MODULE_A.DO_MESSAGE::4
MODULE_A.COUNT_LOOPS::4
MODULE_A.WHEN_BUTTON_PRESSED (BLOCK_NAME.CONTROL)::2
Procedure COUNT_LOOPS executes a FOR LOOP and calls procedure DO_MESSAGE for each count.
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 procedure DO_MESSAGE completes execution, the top frame (DO_MESSAGE::4) is pushed off the stack, and the stack frames would now appear as follows:
MODULE_A.COUNT_LOOPS::4
MODULE_A.WHEN_BUTTON_PRESSED (BLOCK_NAME.CONTROL)::2
About the Current Execution Location and Current Stack Frame