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

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

问题描述

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

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:


  • 在一行代码的断点处停止

  • 步进通过代码

  • 看到调试指针停在代码的空白行

  • Stopping at a breakpoint on a line of code
  • Stepping through the code
  • Seeing the debugging pointer stop at a blank line of code

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

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).

另一个选项(如其他人所建议的)是您不是在构建 Debug 配置。虽然可以调试发布版本,但代码已得到了极大的优化,这会使调试器发生异常行为,例如

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;

通常不会正确设置断点(尽管通常会移至下一行 real )。但是,如果您的代码行初始化了变量:

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天全站免登陆