Visual Studio 2008 provides some smart features for debugging multi-threaded programs. Let’s take a look to few features

image

Flag

You can flag interesting threads from the list

Category

Provides type of a thread, like worker thread or Main thread.

Name

This is one of the coolest feature. You can name a thread. It’s gives flexible way to identify the threads in a readable way.  As you see in the first picture, you can give any crappy name for your threads :)

Location

Provides information on the thread start function. When the mouse is over the location, it also shows up the current stack frame of the particular thread where the mouse belongs.

image

Switch To Thread

You can switch to any running thread within the application using “Switch To Thread” feature. The acitve thread will be marked with a yellow arrow as you see in the first figure.

Show Thread In Source

This feature provides gives an indicator on which are the source statements are currently being executed by different threads. In a single point, there could be multiple threads. By hovering the mouse over this location, you can see the current threads which executes the particular line. In the picture below, you can see multiple squiggly marks. Again, these are the lines currently dealt with different threads. You can also see the tool tip which gives information on multiple threads executing the particular statement.

image

Suspend

The thread Debug window also provides the suspend count of the threads running in the system

Debug Location Bar

This bar provides more information on the current debug location of multiple threads. You can choose a running thread from the “Thread” combo box. If you check the “Stack Frame”, you can see the call stack of the particular thread selected. On selecting a thread, it acts as “Switch To Thread” as I described above.

image

Next Statement Location

Finally it shows, a green indicator which indicates the next statement when the thread returns from the current function being executed.

image

Sharing my thoughts...