开发者

linux: how do I generate a core file?

开发者 https://www.devze.com 2023-03-02 19:36 出处:网络
I\'m using Ubuntu 10.04.I run \"ulimit -c 999\" then I compile and execute (gcc test.c && ./a.out) this tiny app:

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;
}
开发者_如何学C

Even 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.

0

精彩评论

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