0

I am debugging a multi-threaded program in Visual Studio 2008.

  • When I break in the main thread, what is the status of the other threads in the process ?
  • They keep executing or they break as well ?
  • What happens to them when I do a F10/F11 in the main thread ?
  • How should I proceed if I need to check which thread has changed a particular variable ?
proton
  • 658
  • 1
  • 7
  • 26

1 Answers1

2

If the debugger breaks into the process (for example via Breakpoints or "Break All"), then all threads a get suspended.

If the press F10 or F11, then a new "temporary" breakpoint is added to the next line and the process is started (resumed) again. Therefore all threads runt (for a very short time), until the breakpoint is hit.

If you need to detect how is changing a variable, you can set a "Data-Breakpoint". For a reference see What are data breakpoints? Also take a look at the documentation: How to: Set a Data Breakpoint

Also please be aware, that you can see the list of threads by opening the "Threads"-Window (Debug|Windows|Threads)!

Community
  • 1
  • 1
Jochen Kalmbach
  • 3,549
  • 17
  • 18