当断点命中时,单位源代码与代码执行路径不匹配 [英] Unit source code does not match code execution path when breakpoint hit

查看:478
本文介绍了当断点命中时,单位源代码与代码执行路径不匹配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在调试使用Delphi 6 Pro使用DSPACK代码库创建的DirectShow过滤器。当我设置的断点在一个名为BaseClass.pas的特定单元中被击中时,我开始跟踪,执行点跳转到源代码中的奇怪位置。这通常表示正在跟踪的源代码与编译到Delphi应用程序使用的一个包中的源代码不匹配。奇怪的是,它只是BaseClass单元,因为我跟踪了属于DSPACK代码库的其他单元,并且它们没有出现这个问题。我没有使用运行时软件包。



我扫描了我的磁盘,发现只有一个BaseClass.dcu的副本,修改日期等于我最后一次构建程序。我没有修改该单元的源或任何其他属于DSPACK的源。由于我的Filter是主应用程序的一部分,因此表示BaseClass.pas将会受到双重使用的影响,因为它用于构建DSPACK组件包(dpk),并且也被我的主应用程序直接通过TBCSource对象引用我的过滤器从。注意,我尝试将单位PAS文件直接添加到我的项目,但没有修复任何东西。



我也回去重新打开每个DSPACK包文件并完成重新构建。这些都没有帮助。还有什么我可以尝试使源与BaseClass单元的编译映像同步吗?或者是一个不同的问题,如果是这样,它是什么,如何解决它?

解决方案

有时这种情况发生在代码是从网页或其他来源复制/粘贴的,而这些行不以 CR / LF 对(#13#10 0x0D0A ,Windows的标准),但只在LF(#10 0x0A ,通常是以* nix系统结尾的行)或CR(#13 0x0D ,典型的Mac OSX / iOS)。错误的行终止符混淆了调试器 - 这对于过去的几个Delphi版本来说已经是一个问题。



有时可以通过使用文本编辑器打开源文件来解决这个问题记事本,做一个小的无意义的变化(插入,然后删除一个空行),然后保存文件。


I am debugging a DirectShow filter I created with the DSPACK code library using Delphi 6 Pro. When a breakpoint I set is hit in one particular unit named BaseClass.pas, and I begin tracing, the Execution Point jumps to strange places in the source code. This usually indicates that the source code being traced does not match the source code that was compiled into one of the packages being used by the Delphi application. Oddly enough it is only the BaseClass unit since I have traced other units belonging to the DSPACK code library and they do not exhibit this problem. I am not using run-time packages.

I scanned my disk and found only one copy of BaseClass.dcu with a modification date equal to the last time I built the program. I have not modified the source for that unit or any other belonging to DSPACK. Since my Filter is part of the main application this indicates that BaseClass.pas would be subject to a dual use situation since it is used to build the DSPACK component package (dpk), and is also referenced by my main application directly via the TBCSource object my Filter descends from. Note, I did try adding the unit PAS file directly to my Project but that didn't fix anything.

I also went back and re-opened each of the DSPACK package files and did a full re-build. None of this helped. Is there something else I can try to get the source synchronized with the compiled image of the BaseClass unit? Or is a different problem altogether and if so, what is it and how can I fix it?

解决方案

Sometimes this happens when code is copied/pasted from web pages or other sources, and the lines don't end with CR/LF pairs (#13#10 or 0x0D0A, standard for Windows) but end in only LF (#10 or 0x0A, typically the line ending in *nix systems) or CR (#13 or 0x0D, typical with Mac OSX/iOS). The incorrect line terminators confuse the debugger - this has been an issue for the past several Delphi versions.

You can sometimes fix this by opening the source file using a text editor like Notepad, making a small meaningless change (insert and then delete a blank line, for instance), and then save the file.

这篇关于当断点命中时,单位源代码与代码执行路径不匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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