麒麟V10-CoreDump核心转储文件调试

1、Linux核心转储

①、 核心转储参数配置

Linux 版本 2.6 开始,可以根据 Linux"/proc/sys/kernel/core_pattern" 文件所包含的格式化字符串来控制对系统上生成的所有核心转储文件的命名。

[pwenrls@kysrv1 ~]$ cat /proc/sys/kernel/core_pattern
|/usr/lib/systemd/systemd-coredump %P %u %g %s %t %c %h
[pwenrls@kysrv1 ~]$ 

②、 核心转储文件保存位置

核心转储文件的保存位置:systemd-coredump 可以根据配置将核心转储文件保存到指定的位置。通常情况下,它们会被保存在 "/var/lib/systemd/coredump/" 目录下。

③、 命令行方式查看核心转储文件

命令为: "coredumpctl list"

┌──[root@liruilongs.github.io]-[/var/lib/systemd/coredump]
└─$coredumpctl list
TIME                            PID   UID   GID SIG COREFILE  EXE
Wed 2023-09-20 23:36:55 CST    6767     0     0  11 present   /usr/bin/ls

④、 调试CoreDump文件

可以通过 "coredumpctl gdb 6767" 启动 gdb 加载调试转储文件,其中的 6767为 转储文件PID

┌──[root@liruilongs.github.io]-[/var/lib/systemd/coredump]
└─$coredumpctl gdb 6767
           PID: 6767 (ls)
           UID: 0 (root)
           GID: 0 (root)
        Signal: 11 (SEGV)
     Timestamp: Wed 2023-09-20 23:36:55 CST (5min ago)
    Executable: /usr/bin/ls
 Control Group: /user.slice/user-0.slice/session-5.scope
          Unit: session-5.scope
         Slice: user-0.slice
       Session: 5
     Owner UID: 0 (root)
       Boot ID: b8a76ac3ad1b411385973f9bcd0358e5
    Machine ID: 84136345e7d24e3286fd7c657f4e1cda
      Hostname: liruilongs.github.io
       Storage: /var/lib/systemd/coredump/core.ls.0.b8a76ac3ad1b411385973f9bcd0358e5.6767.1695224215000000.lz4
       Message: Process 6767 (ls) of user 0 dumped core.
​
                Stack trace of thread 6767:
                #0  0x00007fb8c122a53b n/a (n/a)
​
GNU gdb (GDB) Red Hat Enterprise Linux 8.2-11.el8
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.
​
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/bin/ls...Reading symbols from .gnu_debugdata for /usr/bin/ls...(no debugging symbols found)...done.
(no debugging symbols found)...done.
[New LWP 6767]
Core was generated by `ls --color=auto /etc LS_COLORS=rs=0:di=38;5;33:ln=38;5;51:mh=00:pi=40;38;5;11:s'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00007fb8c122a53b in ?? ()
Missing separate debuginfos, use: yum debuginfo-install coreutils-8.30-6.el8.x86_64
(gdb) bt
#0  0x00007fb8c122a53b in ?? ()
Backtrace stopped: Cannot access memory at address 0x7ffc1adcfdb8
(gdb)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值