【发布时间】:2018-02-03 18:58:59
【问题描述】:
在某些文件中,调试器在单步执行代码时指向错误的行。准确地说,它正好是一条线(总是)
我已经尝试过:
1) normlized line-endings in all of the files
2) wiped out all of the PDB files
3) wiped out the entire debug folder
4) rebuilt the entire project
5)ensured that optimisation for the entire solution and projects within it it is turned-off (/Od switch enabled)
6)ensured that libraries (*.LIB) to which source code I have access to, have had their optimisation disabled and use the same threading mode as the main executable.
7) rebooted PC / VS
项目设置为 x64 Debug,使用 SQLite3 LIB 和 DLL,OpenCL.lib
错误文件中的示例:
int a = 0;
a++;
=> a++; //debugger points at this line, though the value of 'a' is already equal to 2
a++;
一个文件有问题,而另一个文件可能没有。我没有发现受影响的文件与其内容之间有任何关联。
【问题讨论】:
-
你试过重启visual studio吗?
-
刚做了,整机都没用
-
是不是被一个语句关闭了? VS 经常会指向要执行的 next 语句,尤其是当你切换到调用堆栈中更高的调用时。
-
它被一个语句关闭,但从某种意义上说,它指向了它应该指向的位置上方的一行(这可能发生并且经常恰好是空行)。当我在代码中添加人为的空行时,它似乎考虑到了这些并且仍然只关闭了一行(因此更新了 PDB 文件)
-
优化器可能会将多个源代码行折叠成一个机器代码。那么调试器只有一次可能的停止。
标签: c++ visual-studio debugging