5.5. Stack Trace and Thread

5.5.1. Stack Window

The Stack trace window shows the contents of the program stack. It lists all of the 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 the function nesting become deeper.

Choose the menu item View->Program Stack, to open the stack trace for the program being debugged.

Figure 5-5. Stack 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 of the evaluation and inspection of expressions or variables will be with reference to this selected frame. The scope of the variables or expressions being evaluated will be limited to the selected frame only. The same applies for new expressions only in the watch.

5.5.2. Setting the current frame

Double-clicking on any frame in the stack trace will set 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 Operation menu by right-clicking on the Stack trace window, and choose the menu item Set frame to set the frame.

Changing the stack frame will change the Locals list window content, but not the expression watch window as each expression is evaluated in the frame used when it was defined.

5.5.3. Thread Window

The Thread window show all threads used by the program and display the current thread. Choose the menu item View->Thread, to open this window.

A small arrow points to the current thread. When the programm is stopped, it correspond to the thread which has been interrupted. Each thread has its own stack frame,so changing the current thread will change the current stack frame.

5.5.4. Setting the current thread

Double-clicking on any thread in the thread list will set that thread as the currently selected thread (the arrow will point to the thread, indicating that it has been selected as the current thread). Alternatively, open the Operation menu by right-clicking on the Thread list window, and choose the menu item Set thread to set the thread.

Changing the thread will change the value of CPU registers and the current stack frame, so the Locals list window will change too.