Linux: How do you get debuginfo packages?
kgibm 0600027VAP Visits (4816)
In a previous post, I discussed the importance of symbols for native libraries. Not only are they needed, but you may be actively deceived by the guesses of stack walkers if you don't have them. On Linux, although it is recommended to simply compile executables and libraries with symbols and ship them unstripped, even the operating system vendors do not do this (the simple reason is the size of the symbol data). For example, Fedora and RedHat do not ship binaries unstripped, but instead they separate the symbols into matching debuginfo packages which you have to download separately.
For RHEL, the debuginfo repository is not available by default. To add this repository, login to RHN to see the topic how to download debuginfo packages like kernel-debuginfo ?
Once you've got the debuginfo repository, the next question is how do you know which debuginfo packages to install? Here are two methods:
Method #1 - ldd
Use the ldd tool to list all shared library dependencies. Find the executable and pass the absolute path to ldd. For each shared library in the list, download the matching debuginfo package.
Method #2 - gdb
GDB has a nice feature where it will tell you what you need and even give you the command that you need to run. For example:
$ gdb /usr/bin/java core.9501 ... Core was generated by `java HelloWorld'. Missing separate debuginfos, use: debuginfo-install libg
debuginfo-install will indirectly call yum, enable any debuginfo repositories, and install the specific packages that are needed. I think this is the best way to find out what to install.