出現segment錯誤 以後沒有core的排查

檢查是否打開core

沒有打開的例子:
[root@senbo088]# ulimit -c
0
[root@senbo088]# ./test
Segmentation faultcookie

打開以後的例子:tcp

[root@senbo088]# ulimit -c unlimited
0
[root@senbo088]# ulimit -c
unlimited
[root@senbo088]# ./test
Segmentation fault (core dumped)ide

檢查core 的路徑

一種典型而又及其隱蔽的core不dump的錯誤是 修改了core dump的默認路徑,可是目錄不存在。ip

以下這種狀況:
[root@senbo088]# ulimit -c
unlimited
[root@senbo088]# ./test
Segmentation fault it

[root@senbo088]# sysctl -p
排查過程以下:
net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
error: "net.bridge.bridge-nf-call-ip6tables" is an unknown key
error: "net.bridge.bridge-nf-call-iptables" is an unknown key
error: "net.bridge.bridge-nf-call-arptables" is an unknown key
kernel.printk = 0
kernel.printk = 0
kernel.corepattern = /var/core/core%e_%p
kernel.core_uses_pid = 0io

[root@senbo088]# ls /var/core
ls: cannot access /var/core: No such file or directory編譯

建立 /var/core目錄以後,就行了:cookies

[root@senbo088]# mkdir -p /var/core/
[root@senbo088]# ./test
Segmentation fault (core dumped)table

爲了支持core 最好打開-ggdb編譯選項

必需 -g / -ggdb 支持;class

相關文章
相關標籤/搜索