本文介绍了程序崩溃在调试器在任何事情发生之前的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用MinGW工具链构建Windows XP应用程序,它有时候会意外崩溃。所以,我试图使用调试器(Gdb),但程序退出与代码03之前,任何事情发生。事实上,我从GDB看到的是:

I'm building an application for Windows XP using the MinGW tool chain and it sometimes crashes unexpectedly. So, I'm trying to use a debugger (Gdb) but the program exits with code 03 before anything happens. In fact, all I see from GDB is:

使用代码03退出程序。

Program exited with code 03.

我怀疑有一些失败的动态链接的依赖(它们是Qt,VTK和ITK,所有建立与MinGW)。但是,这不会发生,当我只是正常运行程序。或者如果发生,它似乎是间歇性的,很好的程序启动和运行后。 注意:我也使用Cmake进行交叉编译。

My suspicion is that there is some failed dynamic linking of a dependency (which are Qt, VTK, and ITK, all built with MinGW). However, this does not happen when I just run the program normally. Or if it happens, it appears to be intermittent and well after the program is launched and running. NOTE: I'm also using Cmake for cross compiling.

我该怎么办?

推荐答案

通过信号(SIGABRT,< callback>)添加回调捕获调用以在关闭进程之前中止。如果在你点击 main()之前发生这种情况,你可能需要诉诸一个静态的全局和编译器来捕捉它。

Add a callback via signal(SIGABRT, <callback>) to catch the call to abort before it shuts down the process. If this happens before you hit main() you might have to resort to a static global and compiler trickery to catch it.

这篇关于程序崩溃在调试器在任何事情发生之前的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 16:51