Created
February 23, 2016 02:24
-
-
Save henryscala/55cff87c989feaae7c15 to your computer and use it in GitHub Desktop.
to force a coredump
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <signal.h> | |
#include <stdlib.h> | |
#include <assert.h> | |
#include <unistd.h> | |
/* this program tries to generate a crash. A prove of concept program. */ | |
/* as per my test, crash may be created in other diectory, but not in my $HOME directory, I don't know why yet */ | |
void function1() { | |
printf("%s\n","in function1"); | |
raise(SIGSEGV); | |
// | |
//abort(); not work | |
//assert(false); | |
//while(true) { | |
// sleep(1); | |
// | |
//} | |
} | |
void function2() { | |
printf("in function2\n"); | |
function1(); | |
} | |
int main() { | |
function2(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment