当断点命中时,单位源代码与代码执行路径不匹配

编程入门 行业动态 更新时间:2024-10-24 12:23:19
本文介绍了当断点命中时,单位源代码与代码执行路径不匹配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我正在调试使用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.

更多推荐

当断点命中时,单位源代码与代码执行路径不匹配

本文发布于:2023-11-12 04:31:07,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1580518.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:断点   源代码   路径   不匹配   单位

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!