Forcing a core dump

Mike Stump mrs@apple.com
Thu Oct 2 19:13:00 GMT 2003


On Thursday, October 2, 2003, at 06:59 AM, Mark Rowe wrote:
> Is there a compiler flag that forces a core dump when a program 
> terminates
> unexpectedly ?  I have a multi-threaded program that sometimes 
> terminates
> unexpectedly with no core file.  If I can force a core file, I can run 
> gdb
> on it.

No.  Feel free to catch all signals, and put a while (1) pause () in 
the handler, and then compile with -Dexit=myexit and define myexit to 
do the same thing is the arg is != 0, then all you have to do is check 
the return statements in main, and do -Dabort=myabort and you'll be set.

When it hangs, gdb attach it, and then see what it was doing and 
where...

This is beyond the scope of this list...



More information about the Gcc mailing list