生成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往上查看每个堆栈