# Threads/Stack Overview

The Threads/Stack window displays information for the current project. While the debugger is running, choose Debug -> Threads/Stack, to open the Threads/Stack window.

Using the Thread/Stack window you can:

- Examine the threads, classes, and methods in the current project
- Expand objects and arrays to show all embedded variables
- View the stack frame in a thread
- View the variables local to each stack
- Expand objects and arrays to show all of their members
- Track the value of a variable as you step through your source code
- Suspend and resume threads

When you first open the Threads/Stack window, the stack frame in which program execution stopped is highlighted. Click the + and - icons to expand and contract the thread groups, threads, stacks, and variables.

## Thread Groups

Initially, the Threads/Stack window lists the following thread groups that make up the current project:

- The `main` thread group. Any keyboard action by the user interacts with the threads in the `main` thread group.
- The thread group that represents the viewer that executes the project (for applet projects only). The applet runs in the Applet Viewer (the `sun.applet.AppletViewer.main` thread group).
- The thread groups particular to the project. If you cannot find the current stopping point inside this thread, try looking inside the browser thread groups.

## Threads

Click the + icon next to the glyph to list the threads that make up a thread group.

Each thread is in the form of:

    "AWT-Motif" (java.lang.Thread) at breakpoint (priority 5)

for example.

Where, in the thread example above:

- `AWT-Motif` is the thread name
- `java.lang.Thread` is the thread class
- "at breakpoint" is the thread state
- priority 5 is the priority for running the thread (the thread with the highest priority is run first)

The glyph accompanying a thread is an additional clue as to the state of the thread. In all, a thread can be in one of seven states:

  The state of the thread cannot be determined.
  Thread is a zombie (has been exited, but has not yet been reaped or has been constructed but not yet started).
  Thread is running.
  Thread is sleeping.
  Thread is waiting on a conditional variable.
  Thread is suspended.
  Thread is stopped at a breakpoint.

## Stack Frames

When you expand a thread in the Threads/Stack window, the stack frames in the thread are shown. Each stack frame is marked with the icon.

The stack frames are listed in the order in which they were called. The stack frame that was executing when the program stopped is at the top of the stack. The initial stack frame is at the bottom of the stack. If a class does not have a stack frame, try recompiling your program with the `-g` option.

## Local Variables

Expanding a stack frame displays the arguments and local variables. Objects are marked with the icon. When you expand an object, all data members of the object are shown. Although only the first 100 elements of an array are shown.

You can repeat this action on nested objects. Local variables that are out of scope are not shown.