开发者

Program crashes in debugger before anything happens

开发者 https://www.devze.com 2022-12-30 11:00 出处:网络
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 prog开发者_开发问答ram exits with code 03

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 prog开发者_开发问答ram exits with code 03 before anything happens. In fact, all I see from GDB is:

[New thread 3184.0x7b8]

[New thread 3184.0xef8]

Program exited with code 03.

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.

What should I do? What can I try?


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.


Code 3 is usually returned on a segfault. Try switching to Linux and debugging the program with electric fence. It might give you some extra insight.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号