[skill][debug][gdb] 使用core dump 進行GDB
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]
3850
[[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]