How to install glibc with debugging info on CentOS 5.5
c, centos, glibc
Solution
Under CentOS, you can install the debug information for a particular package using the `debuginfo-install` command. For example:
debuginfo-install glibc
For this to work, you need to have the `debuginfo` repository defined. For CentOS 5, put the following in `/etc/yum.repos.d/CentOS-Base-debuginfo.repo`:
[base-debuginfo]
name=CentOS-$releasever - DebugInfo
baseurl=http://debuginfo.centos.org/$releasever/$basearch/
gpgcheck=0
enabled=0
protect=1
priority=1
Caveat: In case you found your way here from Google looking about information for CentOS 6: This works great for CentOS 5. The CentOS team has had a hard time getting their act together with CentOS 6, and the CentOS 6 debuginfo repositories are out-of-date respect to the most recent packages. You may or may not be able to find the appropriate debuginfo package for CentOS 6.
Problem
I am working through Zed Shaw's Learn C the Hard Way. In the chapter on Valgrind, the section "What you should see" has line numbers for various glibc functions. I've determined that (obviously) my CentOS 5.5 install has the non-debug glibc installed. However yum does not list glibc-dbg (or anything similar: ``` [nzucker:~/projects/lcthw]$ yum info \*glibc\* | grep Name Name : glibc Name : glibc Name : glibc-common Name : glibc-devel Name : glibc-devel Name : glibc-headers Name : compat-glibc Name : compat-glibc Name : compat-glibc-headers Name : glibc-utils ``` I've bricked Linux boxes in the past by haphazardly installing packages (either via packages or building from source), so I want to know what I'm doing here. Questions: Since I have glibc-devel already installed, are the debug libraries perhaps already there and I just need to link to them and/or add a compilation switch? If I re-build glibc from source (or install a package) with debugging enabled, how can I be sure not to accidentally brick the machine (i.e. because building the wrong package and triggering library incompatibilities)?