views:

249

answers:

3

I have a fairly large C++ project, and am trying to use the debugger to step through some code. Unfortunately, it sometimes decides to drop out of that mode, and just execute the code without paying attention to the fact that I pressed F10, and not breaking at subsequent breakpoints. I don't know when it's going to drop out, but it seems to do so consistently when it does.

To be specific, I'm trying to see how a certain element of a display is calculated. I put breakpoints where the calculation occurs. The debugger will stop at a few of them (not getting as far as I need), and then disregard all the rest, and the finished image appears on the window. Some other times, I've been single-stepping through code, and suddenly it simply starts executing.

This is using Visual C++ in Visual Studio 2008 SP1, running on 64-bit Vista. The code is compiled in Debug mode, with no optimizations enabled. I have done a clean and complete rebuild without fixing this.

Does anybody know what could be causing this? Is there anything I can do about it?

Edit: There are no threads involved where I lost the breaks, and I just installed this recommended fix and still have the problem.

+2  A: 

I think I've encountered this before.

You can download hotfixes which will correct this and other issues (available here): http://code.msdn.microsoft.com/Project/ProjectDirectory.aspx?TagName=Visual%20Studio%202008,Hotfix

I installed a bunch and have not since had the problem. After installing, you can see them listed in your About box.

I won't take the time to pick out the most important ones, since I'm at work.. but there are probably at least 3 or 4 which you'll want to install. I think some of the hotfixes may have been grouped into an SP1 of some sort at some time (which is also available in the link).

Edit (in response to an edit in the original post): I am certain that a hotfix addresses an issue resembling what you've described, since installing a bunch of hotfixes addressed the complaints that a bunch of my coworkers were making (the main complaint was along the lines of "it sometimes ignores my breakpoints and keeps running right past them!"). I recommend that you keep installing whatever could apply.

+3  A: 

based from answer from yahoo, KB957912 - Update for Visual Studio 2008 SP1 Debugging and Breakpoints seems the best option

PoweRoy
this one seems to have done the trick on our VS2008 debugger drop off issue.
Nick Josevski
A: 

Are you sure you are debugging the executable that you just build? Maybe a setting in debug mode is wrong and you are debugging a previously compiled one... To be sure you could just run the debug executable from explorer and attach visual studio later on.

If that isn't the problem you could try some ASM:

__asm __emit 0xF1;

this will break after executing. (more on http://ccollomb.free.fr/blog/?p=30)

DaMacc