Using the Call Stack

See Also

In a debugging session, you can see the call stack for the current thread in the Debugging window (opened automatically whenever you start a debugging session). If you expand the node for the current thread you can see a list of the sequence of calls made during the execution of the thread.

The information given for each call (marked by a Current frame icon icon) includes the name of the call, followed by the file name and line number of the call's currently executing statement. If the sources are available, you can right-click the call and choose Go To Source to go to the source code of the call.

Alternatively, you can open the Call Stack window by choosing Window > Debugging > Call Stack (Alt -Shift-3).

Changing the Current Call

The current call (indicated in bold) is the most recent call made by the current thread. When you select a different current thread, the window is updated to show the calls for that thread. The Local Variables window is also updated to display the values of variables for the current call.

To browse the call stack, do any of the following:

You can capture a textual representation of the call stack by right-clicking a a call and choosing Copy Stack from the pop-up menu. When you copy the call stack, the text is copied to the clipboard. You can then paste the call stack into a text file.

Popping a Call From the Call Stack

You can change the execution of your program so that the next statement to be executed is one of the calls made earlier on the stack. In general, popping, or removing, a call from the call stack does not undo any effects that the call caused. For example, if a call opened a database connection and then that call is removed, the database connection will remain open.

To pop the most recent call from the call stack:

To pop multiple calls from the call stack:

See Also
Using the Debugging Window
Stepping Through Your Program
Debugging Threads in the IDE

Legal Notices