linux设置core文件并查看

生成coredump文件命令:设置大小为不显示大小
echo “ulimit -c unlimited” >> /etc/profile

输入ulimit -c 返回unlimited证明设置成功

1.查询core dump文件路径(测试后并没有新文件生成)
方法1:

cat /proc/sys/kernel/core_pattern

方法2:

/sbin/sysctl kernel.core_pattern

2.修改core dump文件路径为/home/chatbotapp/应用名.core.pid
/sbin/sysctl -w kernel.core_pattern=/home/chatbotapp/%e.core.%p

3.查看core文件
<151 szvphisprb37671:/home/chatbotapp>gdb chatbotapp.core.20398

Try: zypper install -C “debuginfo(build-id)=bc5769b7b2b49fb2283bba6b74be5cc7379cd518”
Failed to read a valid object file image from memory.
Core was generated by `chatbotapp’.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x0000000001223929 in ?? ()
[Current thread is 1 (LWP 20437)]
(gdb) Quit
(gdb) file chatbotapp
Reading symbols from chatbotapp…done.
(gdb) bt
#0 0x0000000001223929 in std::list<CChatbotAddress, std::allocator >::begin (
this=<error reading variable: Cannot access memory at address 0x7fa938faad28>)
at /usr/include/c++/4.8/bits/stl_list.h:759
Backtrace stopped: Cannot access memory at address 0x7fa938faad48

4.通过使用f 0/1/2堆栈编号查看该堆栈数据

如:p 变量

5.也可以在bt之后使用up从0往上查看每个堆栈

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值