How can a C program produce a core dump of itself without terminating?

void create_dump(void)
{
    if(!fork()) {
        // Crash the app in your favorite way here
        *((void*)0) = 42;
    }
}

Fork the process then crash the child – it’ll give you a snapshot whenever you want

Leave a Comment