Created
March 9, 2017 08:34
-
-
Save jonblack/6721785410691623fee29000e7e2024f to your computer and use it in GitHub Desktop.
Test core dump creation
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
#!/bin/bash | |
/usr/bin/g++ -x c++ - -o crash -g <<SOURCE | |
int main(int argc, const char **argv) | |
{ | |
int *p = 0; | |
int r = *p + 1; | |
return 0; | |
} | |
SOURCE | |
rm -f core | |
./crash | |
rm -f crash | |
if test -f core; then | |
rm core | |
echo core file is generated | |
exit 0 | |
else | |
echo no core file generated | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment