c++ - Step line when debugging multithreaded application -


based on question "step over" when debugging multithreaded programs in visual studio, consider following scenario:

thread running code starts thread b , keep going until point thread needs result of thread b. sake of sanity, let's assume following scheme:

thread     line 1 // <---- starts thread b     line 2     line 3 // <---- breakpoint     line 4     line 5 // <---- wait thread b  thread b     line 1     line 2 // <------ when code breaks, stoped here     line 3     line 4 

what happens when 1 click on "step over" button?

i can think of 3 things:

  1. a go line 4. b stays in line 2 until "continue" button pressed.
  2. a go line 4. b go line 3
  3. a go line 4. while don't stop @ line 4, b keeps going indefinitely. stop again, b stops. means b can in line 4 or exited while going line 3 4.

if asked guess, i'd choose option 3.

following line, there's way debug threads line line option 2? i'm asking in terms of there c++ debugger able halt threads , step on line line each 1 individually?

windbg's step command p allows specify threads continue executing while others remain frozen. see http://msdn.microsoft.com/en-us/library/windows/hardware/ff553496(v=vs.85).aspx

specifically @ optional [~ thread] @ beginning of command.


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -