简体   繁体   English

Delphi:如果我在我的项目中使用包,为什么“使用调试 DCU”变得无效?

[英]Delphi: Why does “use debug DCUs” become ineffective if I'm using packages in my project?

I'm building a project that uses the JVCL plugin system, which relies on runtime Delphi packages, and ever since I added it to my project, debugging has become a nightmare because I'm no longer able to step-trace into the source of any VCL or RTL units.我正在构建一个使用 JVCL 插件系统的项目,该系统依赖于运行时 Delphi 包,自从我将它添加到我的项目以来,调试就变成了一场噩梦,因为我不再能够逐步追踪到任何 VCL 或 RTL 单元。 They're all marked as gray dots in the debugger, (when the relevant functions appear at all in the call stack; sometimes I get very strange results,) and it's driving me crazy.它们在调试器中都被标记为灰点(当相关函数完全出现在调用堆栈中时;有时我会得到非常奇怪的结果),这让我发疯。 Does anyone know how to get my debug DCU functionality back?有谁知道如何恢复我的调试 DCU 功能? (Aside from the obvious: rip out all the plugin-related code. That would work , but it wouldn't really help.) (除了显而易见的:删除所有与插件相关的代码。这会起作用,但它并没有真正的帮助。)

Edit: Just to be clear, I can trace anything else in my project.编辑:为了清楚起见,我可以在我的项目中跟踪任何其他内容。 JVCL code. JVCL 代码。 Other 3rd party libraries.其他 3rd 方库。 My own code.我自己的代码。 All of it shows up just fine in the debugger.所有这些都在调试器中显示得很好。 Just not the Delphi RTL and VCL code--the stuff that the compiler option "use debug DCUs" is supposed to grant you access to.只是不是 Delphi RTL 和 VCL 代码——编译器选项“使用调试 DCU”应该授予您访问权限。

This is working as designed.这是按设计工作的。

When you are building with packages, you are executing the package code, and not using any DCU's.当您使用包构建时,您正在执行包代码,而不是使用任何 DCU。 Therefore, the DCU's are compiled in, and you don't get access to the Debug DCU's.因此,DCU 已编译,您无法访问调试 DCU。

You can either turn off packages altogether, or don't compile with the specific packages you want to debug.您可以完全关闭包,也可以不使用要调试的特定包进行编译。 You can choose what packages should be used or not used, and the ones that aren't used will be "debuggable" with the Debug DCU's.您可以选择应该使用或不使用哪些包,未使用的包将通过 Debug DCU 进行“调试”。

Packages are just DLLs.包只是 DLL。 You have to include the debug info into those to be able to debug them, which is what you want to do.您必须将调试信息包含在那些中才能调试它们,这就是您想要做的。 So you would need to have DEBUG packages for the VCL and RTL, not debug dcus.所以你需要有 VCL 和 RTL 的调试包,而不是调试 dcus。 The debug dcus are not even needed anymore when you use prebuilt packages.当您使用预构建的软件包时,甚至不再需要调试 dcus。

It could be the DCU's you have are out of date, so the debugger doesn't step into the code.可能是您拥有的 DCU 已过时,因此调试器不会进入代码。

Usually deleting all the DCU's then doing a Build All will fix this.通常删除所有 DCU 然后执行 Build All 将解决此问题。

You may need to delete DCU's in the search path too, just to be sure.您可能还需要删除搜索路径中的 DCU,只是为了确定。 Make a backup first of course...当然要先备份...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM