Show Stack Command

This command displays information about the execution stack for a thread.

Show Stackthread_name [frame_number]

Prerequisites

The thread must have been started with a Start command, but it must currently be in Idle, Paused, or Error state. It cannot be active when this command is issued.

Parameters

thread_name

The name of the thread whose execution stack is to be displayed.

frame_number

The optional number of the stack frame to be displayed. 0 corresponds to the top of the stack, and numbers greater than 0 are deeper frames in the stack. If this parameter is omitted, all stack frames are displayed.

Remarks

When a procedure calls another procedure, information about the calling procedure is saved on the thread execution stack before the called procedure begins running. The information about a procedure on the stack is called the stack frame. These frames are numbered from 0 to n, where 0 is the frame for the currently executing procedure, and successive numbers correspond to deeper frames within the stack. Frame number 1 is for the procedure that called the current frame, etc.

By looking at the frames on the stack, you can determine what procedures are active at the moment, and how the current procedure was called.

The frame also determines the context for dynamic variables within a procedure. The frame number is used to specify this context in the Show Variable command.

The information displayed by this command consists of one line per frame as follows:

frame, project_name, proc_name, proc_line, file_name, file_line, frame_size

where:

frame

Is the number of the stack frame, from 0 to n, where 0 is the current top of the stack, and n is the frame for the main procedure.

project_name

Is the name of the project being executed by the thread.

proc_name

Is the name of the procedure in this frame.

proc_line

Is the number of the line of the procedure that corresponds to the procedure step in this frame.

file_name

Is the name of the file where the procedure is defined.

file_line

Is the number of the line in the file that corresponds to the procedure step in this frame.

frame_size

Is the size of this frame, in kilobytes.

Examples

Show Stack My_project
0, My_project, Sub_current, 6, Testfile.gpl, 123, 1
1, My_project, Sub_test, 20, Testfile.gpl, 44, 1
2, My_project, Main_program, 12, Testfile.gpl, 25, 1

This display indicates that Sub_current is the current procedure, about to execute the instruction at step 6 which is also found at line 123 of source file Testfile.gpl. It uses 1Kb of stack space. Sub_current was called from Sub_test and line 20 will be executed next when Sub_current returns. Sub_test was called from Main_program at line 11.

See Also

Console Commands | Show Thread Command | Show Variable Command