gdb で Missing separate debuginfos, use: debuginfo-install glibc-2.12-1.149.el6.x86_64 のエラー

珍しく、Cでちょっとしたプログラムを書いて、gdbデバッグしようとしたら、以下のエラー

Missing separate debuginfos, use: debuginfo-install glibc-2.12-1.149.el6.x86_64

gdbから抜けて、rootで「debuginfo-install glibc-2.12-1.149.el6.x86_64」を実行すればよいと記事があったので、実行してみるも以下のエラー。

Could not find debuginfo for main pkg: glibc-2.12-1.149.el6.x86_64
Could not find debuginfo pkg for dependency package glibc-2.12-1.149.el6.x86_64

このエラーが出た時は、/etc/yum.repos.d/CentOS-Debuginfo.repo の enbledを0から1 ( 無効から有効 )にしてあげればよいらしい。

[root@dev001 C]# cat /etc/yum.repos.d/CentOS-Debuginfo.repo | grep enable
enabled=1

このあと、再度「debuginfo-install glibc-2.12-1.149.el6.x86_64」を実行すれば、無事にパッケージがインストールされ、gdbが通るようになりました。 私はCentOS-Debuginfo.repo自体を消していたので、他のサーバから持ってきました。。 同じような方のためにメモ

[root@dev001 C]# cat /etc/yum.repos.d/CentOS-Debuginfo.repo
[debug]
name=CentOS-6 - Debuginfo
baseurl=http://debuginfo.centos.org/6/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-Debug-6
enabled=1