Skip to content

Instantly share code, notes, and snippets.

@jonblack
Created March 9, 2017 08:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonblack/6721785410691623fee29000e7e2024f to your computer and use it in GitHub Desktop.
Save jonblack/6721785410691623fee29000e7e2024f to your computer and use it in GitHub Desktop.
Test core dump creation
#!/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