前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >linux 下coredump相关

linux 下coredump相关

原创
作者头像
意气
发布2019-05-16 17:21:24
1.6K0
发布2019-05-16 17:21:24
举报
文章被收录于专栏:版本管理版本管理

1、支持产生coredump,需要设置:

ulimit -c unlimited

2、控制core文件保存位置和文件名格式

/proc/sys/kernel/core_pattern 查看目前使用的方式

修改文件命令: echo "/corefile/core-%e-%p-%t" > /proc/sys/kernel/core_pattern

或者:

sysctl -w kernel.core_pattern=/corefile/core-%e-%p-%t kernel.core_pattern = /corefile/core-%e-%p-%t

可以将core文件统一生成到/corefile目录下,产生的文件名为core-命令名-pid-时间戳

以下是参数列表:

%p - insert pid into filename 添加pid(进程id)

%u - insert current uid into filename 添加当前uid(用户id)

%g - insert current gid into filename 添加当前gid(用户组id)

%s - insert signal that caused the coredump into the filename 添加导致产生core的信号

%t - insert UNIX time that the coredump occurred into filename 添加core文件生成时的unix时间

%h - insert hostname where the coredump happened into filename 添加主机名

%e - insert coredumping executable name into filename 添加导致产生core的命令名

3、让程序产生一个coredump

kill -s SIGABRT pid 或者 kill -6 pid

kill -s SIGSEGV pid 或者 kill -11 pid

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档