gdb调试C++程序出现Missing separate debuginfos

文章描述了在使用GNUGDB调试RedHatEnterpriseLinux7程序时遇到Segmentationfault的问题。解决方案是安装缺失的debuginfo包,特别是glibc的相关版本。然而,glibc-2.17-324.el7_9.x86_64无法安装,提示没有可用的debuginfo包。通过编辑/etc/yum.repos.d/CentOS-Debuginfo.repo启用debuginfo仓库并尝试重新安装glibc-2.17-326.el7_9.x86_64的debuginfo包。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

gdb demo core.23358

GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-120.el7
Copyright © 2013 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”.
For bug reporting instructions, please see:
http://www.gnu.org/software/gdb/bugs/
Reading symbols from /root/demo…(no debugging symbols found)…done.
[New LWP 23358]
Core was generated by `./demo’.
Program terminated with signal 11, Segmentation fault.
#0 0x0000000000400869 in bb(int, std::string) ()
Missing separate debuginfos, use: debuginfo-install glibc-2.17-326.el7_9.x86_64 libgcc-4.8.5-44.el7.x86_64 libstdc+±4.8.5-44.el7.x86_64

debuginfo-install glibc-2.17-326.el7_9.x86_64 libgcc-4.8.5-44.el7.x86_64 libstdc++-4.8.5-44.el7.x86_64

然后glibc-2.17-324.el7_9.x86_64总是装不上
提示

已加载插件:fastestmirror, langpacks
enabling centos-sclo-rh-debuginfo
enabling centos-sclo-sclo-debuginfo
Loading mirror speeds from cached hostfile

  • centos-sclo-rh: mirrors.ustc.edu.cn
  • centos-sclo-sclo: mirrors.aliyun.com
    Could not find a package for: glibc-2.17-324.el7_9
    No debuginfo packages available to install

打开配置文件 vim /etc/yum.repos.d/CentOS-Debuginfo.repo

# CentOS-Debug.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#

# All debug packages from all the various CentOS-7 releases
# are merged into a single repo, split by BaseArch
#
# Note: packages in the debuginfo repo are currently not signed
#

[base-debuginfo]
name=CentOS-7 - Debuginfo
baseurl=http://debuginfo.centos.org/7/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-Debug-7
enabled=0

把enabled=0改成enabled=1即可
再执行
debuginfo-install glibc-2.17-326.el7_9.x86_64
即可

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值