如何调试只发生在应用程序关闭的崩溃? (Delphi) [英] How to debug a crash that only occurs on application shutdown? (Delphi)

查看:1128
本文介绍了如何调试只发生在应用程序关闭的崩溃? (Delphi)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,在最近的一些更改之后,我们发现我们最早的应用程序之一有时在关闭时崩溃。这表现为运行时错误216消息的形式或来自Windows错误报告的应用程序已停止工作的消息。应用程序已经发出 OutputDebugString - 消息在每一个回合,AFAICT所有我们自己的代码正确执行完成。所有析构函数都被称为所有的finalization节和类析构函数,没有一个正在引发任何异常。

So, after some recent changes we discovered that one of our oldest applications is sometimes crashing on shutdown. This manifests itself either in the form of "Runtime error 216" messages or in a message from Windows Error Reporting that the application has stopped working. The application is already emitting OutputDebugString-messages at every turn and AFAICT all of our own code gets executed correctly to completion. All destructors are called as are all finalization sections and class destructors, none of which are raising any exceptions.

此外,madExcept和FastMM4的完全调试模式似乎没有任何东西抱怨(虽然这可能是一个错误的结论,因为崩溃可能发生,甚至在组件自己的finalization代码运行之前)。

Also, neither madExcept nor FastMM4's Full Debug Mode seem to have anything to complain about (though that might be a false conclusion because the crash might happen even before those components' own finalization code runs).

那么,你会做什么?

这个问题应该是更多关于这个问题的一般方法类问题比关于我目前面临的具体实例,所以我故意省略了细节。

推荐答案

运行时错误216意味着您有一个Av(访问冲突),SysUtils已经停止将这些错误转换为异常。

A runtime error 216 means that you have an Av (access violation) and SysUtils has already stopped translating those errors to exceptions.

首先尝试:使用调试DCU构建并查看在出现错误的单元系统中设置断点。

First try: Build with debug DCU's and look in the unit system where the error is raised, set a breakpoint there. hopefully you can catch it in the debugger and work from there.

你可能有一个内存错误(dangling指针,空引用等等)使用s字符串常量已经在最终的单位),最好的办法是在sysutils完成后检查最终结果。你可以通过构建WITH debug dcu来设置断点,在sysutils中设置断点,然后开始逐步执​​行代码,直到发生错误。

You probably have a memory bug (dangling pointer, null reference etc etc use of s string constant in an already finalized unit) and the best trick is to check the finalizations after sysutils is finalized. You can do this by building WITH debug dcu's, setting the break point to the finalization in sysutils and start stepping through the code until the error occurs.

这篇关于如何调试只发生在应用程序关闭的崩溃? (Delphi)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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