简体   繁体   中英

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;
}

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM