Examine the stack.
Sébastien Granjoux
seb.sfo@free.fr
Philip Chimento
philip.chimento@gmail.com
Daniel Nylander
po@danielnylander.se 2007
Anders Jonsson
anders.jonsson@norsjovallen.se 2017

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

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:

## Aktiv

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.

## Tråd

This is a number corresponding to each thread.

## Ram

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.

## Fil

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

## Rad

The line number of the function corresponding to this frame.

## Funktion

The name of the function corresponding to this frame.

## Adress

The address of the function corresponding to this frame.

## Argument

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.

# Visa aktuell funktion

In the Stack window, select the frame you want.

Dubbelklicka, eller högerklicka och välj Visa källa.

# Get a stack trace

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