Skip to content

Instantly share code, notes, and snippets.

@alepez
Created February 13, 2018 09:45
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 alepez/a128e8c3e68d23e46fab56a7c6621dd1 to your computer and use it in GitHub Desktop.
Save alepez/a128e8c3e68d23e46fab56a7c6621dd1 to your computer and use it in GitHub Desktop.
Enable Core dump in C/C++
#include <iostream>
#include <sys/resource.h>
int main() {
rlimit core_limits;
core_limits.rlim_cur = core_limits.rlim_max = RLIM_INFINITY;
setrlimit(RLIMIT_CORE, &core_limits);
std::cout << "begin\n";
int* x = 0;
*x = 1;
std::cout << *x << "end\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment