Examine the stack.
Sébastien Granjoux
seb.sfo@free.fr
Philip Chimento
philip.chimento@gmail.com
Jaume Planas
jplanas@itberga.com 2011
Gil Forcada
gilforcada@guifi.net 2013

# 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.

Per obrir la finestra Pila, trieu Visualitza Pila en el menú principal.

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

In the Stack window, select the frame you want.

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

In the Stack window, select the frame you want.

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

# Get a stack trace

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