Forcing C program to core dump

Alex Zbyslaw xfb52 at dial.pipex.com
Thu Dec 7 03:22:31 PST 2006


Niclas Zeising wrote:

> Garrett Cooper wrote:
>
>> Hello,
>>    This may be obvious to some, but after some Googling (apparently 
>> with the wrong search terms, perhaps) and reading the gcc/gdb 
>> manpages, I can't seem to find out how to get a program to produce 
>> core dumps.
>>    So I was wondering, is there some simple means to produce core 
>> dumps or a set of conditions that I need to adhere to in order to get 
>> the OS to core dump the progrdam???
>> Thanks,
>> -Garrett
>
>
> Just kill it with the abort signal (SIGABRT) or some other signal that 
> makes the program dump core. Be aware though that if you are catching 
> or ignoring the signal, this won't work.
> Regards!
> //Niclas

Which usually defaults to ctl-\ from the shell so it's easy to kill a 
foreground program with bothering to find process id's etc.

OK, not what you actually wanted to do, but for completeness :-)

--Alex




More information about the freebsd-hackers mailing list