Search code examples
debuggingvisual-studio-2008breakpoints

Breakpoints moving to another class


My break-points are having a strange behavior. When I set one in a dialog function while my software is running, the break-point moves directly to the same function but in another dialog class.

For example :

void MyDialog1::MyFunction()
{
   // some code where I set my break-point
}

void MyDialog2::MyFunction()
{
   // some code where the break-point moves by "itself"
}

All optimizations features are turned off. I don't understand how this magic is done... Is this possible that my PDBs files are corrupted in a way ? Thanks.


Solution

  • This often happens when the project files and user specific VS files like .user .suo get out of sync. You might be seeing and adding a breakpoint to a file that is not part of the project build but a file thats part of the build isnt visible in the workspace but has the breakpoint set already. When you debug the breakpoint for the actually compiled code shows up.

    Ive seen that happen a few times and there are a few things that you should do

    delete all .suo and .user files - that should delete any saved breakpoints. examine the .vcproj file and the source file and see whether there are any anomalies.