GDB调试时遇到提示:
no debugging symbols found
Missing separate debuginfos, use: debuginfo-install glibc-2.17-55.el7.x86_64
先安装debuginfo-install glibc-XXX,然后修改make文件。
一、安装debuginfo-install glibc-XXX
根据下面两篇内容整理一下解决方法。
Invalid GPG Key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7_西卦的博客-CSDN博客
1、gdb调试提示如下
Missing separate debuginfos, use: debuginfo-install glibc-2.17-55.el7.x86_64
2、直接安装libc-2.17-55.el7.x86_64提示错误
debuginfo-install glibc-2.17-55.el7.x86_64
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.ustc.edu.cn
* extras: mirrors.aliyun.com
* updates: mirrors.tuna.tsinghua.edu.cn
Could not find a package for: glibc-2.17-55.el7.x86_64
No debuginfo packages available to install
3、安装glibc
修改“/etc/yum.repos.d/CentOS-Debuginfo.repo”文件的enable=1,然后使用
sudo yum install glibc 安装glibc;
4、安装后gdb调试提示
Missing separate debuginfos, use: debuginfo-install glibc-2.17-325.el7_9.x86_64
5、安装glibc-2.17-325.el7_9.x86_64提示No key found in given key data
debuginfo-install glibc-2.17-325.el7_9.x86_64
提示如下错误
Downloading packages:
warning: /var/cache/yum/x86_64/7/debug/packages/nss-softokn-debuginfo-3.15.4-2.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID b6792c39: NOKEY
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-Debug-7
Invalid GPG Key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-Debug-7: No key found in given key data
6、安装CentOS 7 Debug Key
文件获取链接: CentOS GPG Keys
替换文件RPM-GPG-KEY-CentOS-Debug-7
7、再次安装glibc-2.17-325.el7_9.x86_64
二、修改make文件
1、检查make文件,所有的源文件都是-g -c编译。
2、检查生成执行文件编译命令为'-o'。
3、后来在网上查到gcc编译时不能带'-s'选项,找了一圈在编译时没有'-s'选项,不是这个问题。
4、检查安装流程,make文件中安装命令为/usr/bin/install -m 755 -s XXX,带有'-s'命令,去掉后果然可以gdb调试了。