Delphi,调试初始化部分
我的问题是系统的某些部分出现了异常,但它发生在初始化期间,我无法弄清楚它在哪里或哪个异常。系统刚开始运行,然后突然关闭。
您有什么方法可以调试这种情况吗?
我正在使用Delphi5,以防万一。
My problem is that there is an Exception being raised in some part of the System, but it happens during initialisation and I can't figure out where or which exception it is. The system just begin to run and then it closes suddenly.
Do you have any methods to debug such a situation?
I am using Delphi5, just in case.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
下载MadExcept。它适用于 Delphi 5,对于非商业用途是免费的(对于商业用途来说绝对是便宜的),并且非常适合追踪各种神秘的异常。
Download MadExcept. It works for Delphi 5, is free for non-commercial use (and is a definite bargain for commercial use), and works really well tracking down all sorts of mysterious exceptions.
使用F7(单步执行)命令启动应用程序,这将跳转到第一个单元初始化...然后您可以使用F7或F8 像往常一样调试任何单元初始化部分,直到找到异常的来源。
有时,调试初始化是一项繁琐的工作……在取得进展时,您可以在初始化部分中放置常规断点,以便从已知点重新开始。
Start the application with the F7 (step into) command, this will jump to the first unit initialization... you can then use the F7 or F8 as usual to debug any unit initialization section until you find the source of your exception.
This is sometimes a tedious work to debug the initialization... while you're making progress, you can put regular breakpoints in initialization sections to start again from a known point.
使用这些接受的答案(调试器工具)后,您是否得到/找到了问题所在?您是否使用需要某些 DLL 的库/组件?根据我的经验(异常没有出现并且应用程序突然关闭);这是因为您无法加载 DLL。该异常不会在调试模式下显示,但当您刚刚运行应用程序时(不是在调试 Delphi 中),它会出现。
Have you get/found where the problem is after using those accepted answer (debugger tool)? Are you using lib/component that require some DLL? As my experience (exception doesn't appear and app closes suddenly); it is because something on your part unable load a DLL. The exception won't show in debug mode, but it'll appear when you just run the app (not in debug-Delphi).