core dump 扫盲:https://wiki.archlinux.org/index.php/Core_dump
1. 人为制作 core dump
1.1 实时在线生成core dump。进程不会停止。
[[email protected] ~]# pgrep KingKong 3850 [[email protected] ~]# gdb (gdb) attach 3850 (gdb) generate-core-file Saved corefile core.3850 (gdb) [[email protected] ~]# ll -h core.3850 -rw-r--r-- 1 root root 1.2G May 24 10:37 core.3850[[email protected] ~]# pgrep KingKong3850[[email protected] ~]#
1.2 对进程发生会造成core dump的信号
[[email protected] ~]# man 7 signal [[email protected] ~]# pgrep KingKong 3850 [[email protected] ~]# kill -11 3850
2. 调试
设置启用 core dump 文件
[[email protected] kk]# ulimit -c 0 [[email protected] kk]# ulimit -c unlimited [[email protected] kk]# ulimit -c unlimited
准备好生成的core文件,和可执行程序的二进制文件。使用gdb查看。
/home/tong/Workspace/kk/2017-05-24-https-core-dump [[email protected]] [13:54] > gdb -core core.34373 KingKong
时间: 2024-09-30 16:40:54