Stack Trace

6.5.1. Stack Window

The stack trace window shows the contents of the program stack. It lists all functions and their arguments in the sequence they were called. There is also a number representing each call. This number is called the frame. Each call in the trace exists in a different frame. This starts from frame 0 (the last function called) and grows higher as function nesting becomes deeper.

Choose the menu item View  ▸ Stack to open the stack trace for the program being debugged.

Figure 6-5Stack trace window

A small arrow points to the currently selected frame in the stack trace. By default, this will be frame 0, the last function called. All evaluation and inspection of expressions or variables will be with reference to this selected frame. The scope of variables or expressions being evaluated will be limited to the selected frame only. The same applies for new expressions only in the watch.

6.5.2. Setting the current frame

Double-clicking on any frame in the stack trace sets that frame as the currently selected frame. The arrow will point to the frame, indicating that it has been selected as the current frame. Alternatively, open the context menu by right-clicking on the Stack trace window, and choose the menu item Set current frame to set the frame.

Changing the stack frame changes the Locals window content, but not the Watches window as each expression is evaluated in the frame used when it was defined.