今天在cygwin下学习如何调试程序,结果写了一个会崩溃的程序,但是却没有生成core文件,只生成的stackdump文件,后来上网查看资料后发现,原来是cygwin没有默认设置dumper.exe目录的环境变量,所以只要设置一下环境变量就可以生成core文件了。
只对本shell生效,直接输入:export CYGWIN="error_start=E:/cygwin64/bin/dumper.exe"。
对本用户的shell都生效,在~/.bash_profile 中export CYGWIN="error_start=E:/cygwin64/bin/dumper.exe",source ~/.bash_profile。
对所有用户的shell都生效,在/etc/profile中export CYGWIN="error_start=E:/cygwin64/bin/dumper.exe",source /etc/profile。
进行上面的设置就可以生成core文件了。