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

/*
 * 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<stdio.h>
#include<stdlib.h>
#include<unistd.h>

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
 */

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。