Stack

List stack frames

A stack frame is the area of the stack associated to each function call. It lists all functions and their arguments in the sequence they were called. Each stack frame is numbered starting from 0 for the current function. You can only view the stack frames while the debugger is running.

Moreover, a program can be composed of several threads. Each thread is executed independently and has its own registers, stack and local variables, but shares all global variables.

  1. From the main menu, select View ▸ Stack to open the Stack window.

The stacks are displayed in a tree view having their corresponding thread as parent and displaying the following information:

Active

This contains a yellow arrow to represent the active stack frame. By default it is frame 0, the current function. All evaluations and local variables are relative to this active frame. You can change the active stack frame to examine local variables in other functions.

Thread

This is a number corresponding to each thread.

Frame

This is the frame number starting from 0 for the current function. The first function of your program, for example main() in a C program, has the highest number.

File

The name of the file containing the function corresponding to this frame.

Line

The line number of the function corresponding to this frame.

Function

The name of the function corresponding to this frame.

Address

The address of the function corresponding to this frame.

Arguments

The function arguments.

Change the current stack frame or thread

  1. In the Stack window, select the frame you want.

  2. Right-click and select Set current frame.

Clicking on a stack frame in the same thread changes only the stack frame, allowing to see other local variables. But doing it in another thread will change both the stack frame and the thread. The register values will be different and the debugger will restart in the selected thread.

View the current function

  1. In the Stack window, select the frame you want.

  2. Double-click, or right-click and select View Source.

Get a stack trace

  1. In the Stack window, right-click and select Get stack trace.