#include <string> int main(){ int *ptr = NULL; *ptr = 10; return 0; }
gcc -g dumpTest.cpp -o dumpTest
ulimit -c unlimited
echo "core.%e" > /proc/sys/kernel/core_pattern
./dumpTest
会在当前目录下生成 core.dumpTest.xxx 文件,我这里是 core.dumpTest.129153
gdb ./dumpTest core.dumpTest.129153
错误提示在第5行