gdb调用程序崩溃时的内存镜像core文件

2015-07-20 17:18:03 · 作者: · 浏览: 5
/*
 * gcc gdb_test.c -o gdb_test -g
 * ./gdb_test 
 * Segmentation fault (core dumped)
 * gdb gdb_test -c core.5521 
 * Core was generated by `gdb_test'.
 * Program terminated with signal 11, Segmentation fault.
 * #0  0x000000000040048b in main (argc=1, argv=0x7fff00c0b438) at gdb_test.c:18
 * 18		*ptr='\n';
 */
#include
  
#include #include int main(const int argc,const char *argv[]) { char *ptr=NULL; *ptr='\n'; return 0; } /* * add follow in the ~/.bashrc file to generate core file * ulimit -c unlimited */