Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 569
Adrián Romero Avatar asked May 06 '14 04:05

Adrián Romero


People also ask

What triggers a core dump?

Core dumps are triggered by the kernel in response to program crashes, and may be passed to a helper program (such as systemd-coredump) for further processing.

What does a core dump contain?

A core dump is a file that gets automatically generated by the Linux kernel after a program crashes. This file contains the memory, register values, and the call stack of an application at the point of crashing.

What are core dumps used for?

Core dumps can be used to capture data freed during dynamic memory allocation and may thus be used to retrieve information from a program that is no longer running. In the absence of an interactive debugger, the core dump may be used by an assiduous programmer to determine the error from direct examination.


1 Answers

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

like image 139
coder hacker Avatar answered Sep 23 '22 14:09

coder hacker