调试问题:源文件与构建模块时的源文件不同 [英] Debug problem: The source file is different from when the module was built

查看:89
本文介绍了调试问题:源文件与构建模块时的源文件不同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我调试代码StereoMatch(可以从 http://vision.middlebury.edu/stereo ).当我进入另一个.cpp源文件中定义的函数时,VC ++ 2005 Express(以下简称为VC)始终会报告

I debug the code StereoMatch (can be downloaded from http://vision.middlebury.edu/stereo). When I step into a function that is defined in another .cpp source file, VC++ 2005 Express (abbr. as VC below) always report

> ********************************

源文件:D:\ Projects \ StereoMatch \ stereomatcher.cpp

模块:D:\ Projects \ StereoMatch \ Debug \ StereoMatch.exe

处理:[4024] StereoMatch.exe

源文件与构建模块时的源文件不同.您是否仍要调试器使用它?

> ********************************

我还注意到,一些断点变成了由填充的红色圆圈所包围的空红色圆圈.将鼠标移到空白圆圈上会触发气球提示窗口,其中显示:

************************************** *

在StereoMatcher.cpp,第166行("ComputeCorrespondence()",第128行)

当前不会命中断点.源代码与原始版本不同.

要允许在源代码不同时点击断点,请在断点上单击鼠标右键,选择"Location ...",然后启用"Allow"源代码与原始版本不同.

要在所有断点处使用此功能,请在工具,选项,调试,常规下禁用选项要求源文件与原始版本完全匹配"

************************************** *

总而言之,源文件与构建模块时的源文件不同"是什么意思?有人可以提供解释吗?谢谢.

推荐答案

说明有什么问题? AFAICT,说明了一切.

What's wrong with the description? AFAICT, it says it all.

当编译器生成调试信息时,它将在所有贡献的源文件(即.cpp文件和所有#include的文件)上生成哈希(AFAICT,此时仅支持MD5).这些信息以及构建计算机上文件的完整路径最终都以PDB文件结尾.

When the compiler generates debug information, it will generate a hash (AFAICT, only MD5 is supported at this point) over all contributing source files (i.e. the .cpp file and all #include'd files). This information along with the full path of the files on the build machine eventually end up in the PDB file.

现在,当调试器尝试获取源文件时,它会从PDB文件获取完整路径名,并执行一些基于路径的映射并打开该文件.然后,它会生成哈希值,并检查它是否与保存在PDB中的哈希值匹配.

Now when the debugger tries to obtain a source file, it gets the full path name from the PDB file does some path-based mapping and opens the file. Then it generates the hash and check if it matches the one saved in the PDB.

对于您而言,它不是,这表明您的源文件已过时.您可以强制调试器忽略这种不匹配,但这显然是一项功能,旨在防止您在调试时查看过时的源文件.

In your case, it does not and that suggests your source file is outdated. You can force the debugger to ignore such mismatches, but it is obviously a feature designed to prevent you from looking at outdated source files while debugging.

您是否确实有某些来源和调试信息来自同一版本(显然,您可以在盒子上进行重建以确保)?

Are you quite certain sources and debug information are from the same version (obviously you could just rebuild on your box to make sure)?

-hg


这篇关于调试问题:源文件与构建模块时的源文件不同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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