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:
- a go line 4. b stays in line 2 until "continue" button pressed.
- a go line 4. b go line 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
Post a Comment