Last active
November 18, 2019 13:02
-
-
Save MLKrisJohnson/fa00fc1819ae75def4e5e60dab6fcf46 to your computer and use it in GitHub Desktop.
Simple C++ program that immediately crashes. Useful for playing with debuggers and other diagnostic tools.
This file contains hidden or 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 <iostream> | |
int main(int argc, const char** argv) | |
{ | |
// This should force a segmentation fault on most platforms | |
*(volatile char *)0 = 0x77; | |
std::cerr << "The program didn't crash." << std::endl; | |
return 0; | |
} |
This file contains hidden or 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
crash: crash.cpp | |
# Run 'make test' to build and run the program | |
test: crash | |
./crash | |
.PHONY: test |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment