为什么 Visual Studio 2008 跳过我的断点? [英] Why does Visual Studio 2008 skip over my break points?

查看:26
本文介绍了为什么 Visual Studio 2008 跳过我的断点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行带有 SP1 的 Visual Studio 2008.当我调试应用程序时,它会跳过我的断点.

I am running Visual Studio 2008 with SP1. When I debug an application, it will skip over my break points.

例如,我有两行代码,每行调用一个方法.我将在两条线上放置一个断点.我会运行一次,它会在第一个断点处停止,但不会在下一个断点处停止.我将再次运行它,它击中了第二个,而不是第一个.

For example, I have two lines of code, each call a method. I will put a break point on both lines. I will run it one time, and it ill stop at the first break point, but not the next one. I will run it again, and it ill hit the second one, not the first one.

我尝试清理解决方案并重建.

I have tried to clean the solution and a rebuild.

我的解决方案中有多个项目.

I do have multiple projects in the solution.

推荐答案

符号文件不兼容

您的符号文件 (.pdb) 可能与您的源代码不同步.这种情况的一个常见症状是:

Symbol file incompatibility

It's possible that your symbol file (.pdb) is out of sync with your source code. A common symptom of this is:

  • 在一行代码的断点处停止
  • 单步执行代码
  • 看到调试指针停在空白行代码

调试时,您永远不应看到调试指针停在空行上,这表明您在某处存在符号/源不匹配.

When debugging, you should never see the debugging pointer stop on a blank line, and this would indicate that you have a symbol/source mismatch somewhere.

这种不匹配也可能导致像您看到的那样跳过断点,但清理解决方案通常会修复它(听起来您已经尝试过).

This sort of mismatch could also cause breakpoints to be skipped like you are seeing, but cleaning the solution generally fixes it (and it sounds like you have tried this already).

另一个选项(如其他人所建议的)是您不构建调试配置.虽然可以调试发布版本,但代码经过了显着优化,这可能会使调试器行为异常,例如

The other option (as suggested by others) is that you aren't building a Debug configuration. While it is possible to debug a Release build, the code is significantly optimised which can make the debugger act strangely, e.g.

  • 单步执行条件(即 if 块)可以使 if 和 else 情况看起来都在运行
  • 有些代码已经完全优化,你无法破解

另一个需要注意的重要事项是断点不能在每一行代码上设置.例如,如果您的代码只有一个变量初始化:

One other important thing to note is that breakpoints cannot be set on every line of code. For example, if your code only has a variable initialisation:

long numObjects;

断点通常不会被正确设置(尽管它通常会移动到真实"代码的下一行).但是,如果您的代码行初始化了变量:

the breakpoint will generally not be set properly (although it will usually move to the next line of "real" code). However, if your line of code initialises the variable:

long numObjects = 5;

断点可以设置.

这篇关于为什么 Visual Studio 2008 跳过我的断点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆