断点有时不能正常工作,微软负责开发VS调试器的领导提供了一个在线小Web程序来帮助解决断点问题。利用这个工具,通过交互式的问答形式可以获得一些解决问题的建议。
http://www.controlav.com/bphelper
我根据我的状况检查出的的问题和解决办法:
The source code is different from the original version
New Feature for Visual Studio 2005
The compilers now checksum the source code when compiling, and record this in the debug information. The debugger uses this checksum to verify that the source file exactly matches the source file at the time of compilation. If it doesn't match, then the breakpoint will not bind.
To fix this, either open the source file that really does match the one at the time of compilation, or disable the checksum. You can disable it on individual breakpoints by right-clicking on the breakpoint in the Breakpoint Window and selecting Location and check Allow the source code to be different from the original version. You can disable it on a global basis via Tools/Options/Debugging/General and uncheck Only use source that exactly matches the original.