Why is stepping jumping all over the place rather than following the execution flow of the source file?
There are at least a couple possible explanations for why stepping through code sometimes doesn’t necessarily follow the flow of the source. 1. The code you are debugging is optimized by the compiler . You can typically ensure that you are debugging an unoptimized version of your program by setting your configuration to “Debug” when building a Visual Studio solution. Debugging optimized code is possible but can be quite tricky. See these blog articles for some helpful hints: http://blogs.msdn.com/greggm/archive/2004/12/15/315673.aspx http://blogs.msdn.com/greggm/archive/2006/01/23/516447.aspx 2. The source file you are viewing doesn’t match the code you are debugging. Visual Studio 2005 attempts to ensure that this cannot happen without you knowing about it, but that functionality can be disabled. To ensure that is enabled check the following debugger option: · Tools->Options->Debugging->General: “Require source files to exactly match the original version”. · In versions of Visual Stud