linux: how do I generate a core file?
I'm using Ubuntu 10.04. I run "ulimit -c 999" then I compile and execute (gcc test.c && ./a.out
) this tiny app:
#include <signal.h>
int main( void )
{
raise( SIGSEGV );
return 0;
}
开发者_如何学CEven though this does print a "Segmentation fault" message, I don't see a core file. What have I missed that is preventing the core file from being generated?
ulimit -c unlimited
More about enabling core dumps here
EDIT:
Ok, I see what is the problem. Your core file limit is too low. 999 bytes (as you set it) is not enough. Increase it to something reasonable. unlimited is the best parameter.
Use the ulimit
command with the -c
flag to control the maximum size of core file you want to allow.
精彩评论