Bob Bob -4 years ago 155
C Question

System call for a core dump?

i have a question:
exists any system call for generate a core dump?

I know which a core dump could be generated by a signal, but i want know if it's possible generated from system call

Answer Source
void createdump(void)
    if(!fork()) { //child process
        // Crash the app
        abort() || (*((void*)0) = 42);

What ever place you wan't to dump call the function. This will create a child and crash it. So you can get dump even without exiting your program

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download