Debugging Threaded Applications

The Debug menu's Threads option opens the Threads dialog box, which displays a list of the threads in the program being debugged. This list includes the file name and the location of each thread.

BKBEBEDBUG09-low.gif

By default, the Run all threads check box is checked, which means the debugger runs all threads simultaneously.

To execute only one thread at a time, disable the Run all threads check box and click Go. In this case, to switch between threads, select the thread you want from the Threads dialog box and click Go.

If you enable the Show full path name check box in the Threads dialog box, the list of threads includes the file’s full path. Disable this check box if you want the dialog box to list only the file name.

While the Threads dialog box provides a useful tool for controlling how the debugger navigates between threads, the act of single-stepping through a program, by its nature, interferes with the natural threading behavior of the runtime. As a result, if you are trying to debug a threading issue, you may receive a more accurate picture of your program's behavior by enabling paragraph tracing and running the program with an error file than by stepping through the program line-by-line.