如何打開core轉存以及安裝debuginfo

首先通過命令:ulimit -c 查看是否打開了core生成的開關,如果是0則表示沒有生成,可以使用ulimit -c unlimited 命令來打開開關,此命令表示生成的core大小是不受限制的。但僅在shell中執行該命令,在關閉shell之後,命令會失效。

如果想在整個系統中生效,方法如下:

1) 編輯/root/.bash_profile文件,在其中加入ulitmit -S -c unlimited

2)source /root/.bash_profile

生成的core可以使用gdb 工具調試,接下來講述gdb工具的安裝。

1)首先使用uname -r 查看使用的內核版本,如

Linux 3.10.0-229.1.2.el7.x86_64 x86_64

2)去http://debuginfo.centos.org/7/x86_64/ 下載相應的rpm包,

本機內核是3.10.0-229.1.2.el7.x86_64 x86_64 下載:

 

  • kernel-debuginfo-3.10.0-229.1.2.el7.x86_64.rpm
  • kernel-debuginfo-common-x86_64-3.10.0-229.1.2.el7.x86_64.rpm

 

3)安裝RPM包

rpm -ivh kernel-debuginfo-common-x86_64-3.10.0-229.1.2.el7.x86_64.rpm

rpm -ivh kernel-debuginfo-3.10.0-229.1.2.el7.x86_64.rpm

4)配置CentOS-Debuginfo.repo  (一般雲服務器上是沒有該文件的,需要自己創建)

cat /etc/yum.repos.d/CentOS-Debug.repo

​
#Debug Info
[debug]
name=CentOS-$releasever - DebugInfo
baseurl=http://debuginfo.centos.org/$releasever/$basearch/
gpgcheck=0
enabled=1
protect=1
priority=1

​

5)使用debuginfo-install安裝glibc

debuginfo-install glibc

6)如果提示報錯-bash: debuginfo-install: command not found

yum install nss-softokn-debuginfo --nogpgchec

yum install yum-utils

7)最後安裝其他包:可以根據自己的錯誤提示安裝

debuginfo-install bzip2-libs-1.0.6-12.el7.x86_64 cyrus-sasl-lib-2.1.26-17.el7.x86_64 freetype-2.4.11-10.el7_1.1.x86_64 glibc-2.17-78.el7.x86_64 keyutils-libs-1.5.8-3.el7.x86_64 krb5-libs-1.12.2-14.el7.x86_64 libcom_err-1.42.9-7.el7.x86_64 libcurl-7.29.0-19.el7.x86_64 libidn-1.28-3.el7.x86_64 libjpeg-turbo-1.2.90-5.el7.x86_64 libpng-1.5.13-5.el7.x86_64 libselinux-2.2.2-6.el7.x86_64 libssh2-1.4.3-8.el7.x86_64 libxml2-2.9.1-5.el7_1.2.x86_64 nspr-4.10.6-3.el7.x86_64 nss-3.16.2.3-5.el7.x86_64 nss-softokn-freebl-3.16.2.3-9.el7.x86_64 nss-util-3.16.2.3-2.el7.x86_64 openldap-2.4.39-6.el7.x86_64 openssl-libs-1.0.1e-42.el7.4.x86_64 pcre-8.32-14.el7.x86_64 xz-libs-5.1.2-9alpha.el7.x86_64 zlib-1.2.7-13.el7.x86_64

 

 

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章