This took me too long to findt/remember for such a simple task, so I’ll blog it. If you want to create a core dump file in Unix/Linux when your C/C++ program crashes, you need to set your environment to create it:
ulimit -c [max filesize in KB]
I usually set it to:
ulimit -c 10000
If you set the max too small, your file will be truncated and will be unreadable by gdb.
Hi,
When i run the command below,
~/linuxC$gdb ch15-abort core.4142
it tells:
core.4142 is not a core dump: File format not recognized.
(gdb)
How can i create a core dump file with
the correct format?
Thanks!
Jay
Comment by jay — July 30, 2006 @ 2:27 am
Jay -
Usually that error is the result of a truncated core dump. Did you try setting the max filesize higher?
Comment by Benjamin Chodroff — July 30, 2006 @ 3:01 am