I recently tried to learn about nginx. Of course, it is essential to prepare a debug environment for nginx. Compile the nginx debug version according to the articles on the Internet, and use GDB to set the breakpoint. After searching for some information on the Internet, I searched for it for a long time and finally got it done. I recorded it and kept it for later use.
First describe the system version: Redhat Enterprise Linux 6.3 (rhel-6.3, 2.6.32-279. el6.x86 _ 64)
Problems encountered
When you start GDB and set the breakpoint to debug nginx, the following message is displayed:
Missing separate debuginfos, use: debuginfo-install glibc-2.12-1.80.el6.x86_64 nss-softokn-freebl-3.12.9-11.el6.x86_64 openssl-1.0.0-20.el6_2.5.x86_64 pcre-7.8-4.el6.x86_64 zlib-1.2.3-27.el6.x86_64
I searched for a large string on the Internet and finally made it clear that the debuginfo RPM package of glibc/glibc-Common/NSS-softokn/OpenSSL/PCRE/zlib needs to be installed, so I searched online, find the debuginfo RPM package. Found at http://debuginfo.centos.org/6/x86_64 /. For the specified version, download:
Glibc-debuginfo-2.12-1.80.el6.x86_64.rpm
Glibc-debuginfo-common-2.12-1.80.el6.x86_64.rpm
Nss-softokn-debuginfo-3.12.9-11.el6.x86_64.rpm
Openssl-debuginfo-1.0.0-20.el6_2.5.x86_64.rpm
Pcre-debuginfo-7.8-4.el6.x86_64.rpm
Zlib-debuginfo-1.2.3-27.el6.x86_64.rpm
After rpm-ivh xxxx is installed, everything is done, and a strange problem occurs:
Warning: the debug information found in "/usr/lib/debug // usr/lib64/libcrypto. so.1.0.0.debug" does not match "/usr/lib64/libcrypto. so.10 "(CRC Mismatch).
Warning: the debug information found in "/usr/lib/debug/usr/lib64/libcrypto. so.1.0.0.debug" does not match "/usr/lib64/libcrypto. so.10 "(CRC Mismatch).
Missing separate debuginfo for/usr/lib64/libcrypto. so.10
Try: Yum -- disablerepo = '*' -- enablerepo = '*-Debug *' install/usr/lib/debug/. Build-ID/3D/b461dfc7dd4bfb0398b359e6b172bfeb3a853b.
Warning: the debug information found in "/usr/lib/debug // lib64/libz. so.1.2.3.debug" does not match "/lib64/libz. so.1" (CRC mismatch ).
Warning: the debug information found in "/usr/lib/debug/lib64/libz. so.1.2.3.debug" does not match "/lib64/libz. so.1" (CRC mismatch ).
Missing separate debuginfo for/lib64/libz. so.1
Try: Yum -- disablerepo = '*' -- enablerepo = '*-Debug *' install/usr/lib/debug/. Build-ID/20/9 a7ebeab54483fed76e2a984b4ae29c66d69. Debug
Warning: the debug information found in "/usr/lib/debug/lib64/libc-2.12.so.debug" does not match "/lib64/libc. so.6 "(CRC Mismatch).
Warning: the debug information found in"/Usr/lib/debug/lib64/libc-2.12.so.debug" does not match "/lib64/libc. so.6"(CRC Mismatch).
Missing separate debuginfo for/lib64/libc. so.6
Try: Yum -- disablerepo = '*' -- enablerepo = '*-Debug *' install/usr/lib/debug/. Build-ID/64/7 ba5bbe0cb2dbdb1c7afbc9c4e74da5db5f29e. Debug
Warning: the debug information found in "/usr/lib/debug // lib64/libfreebl3.so. debug" does not match "/lib64/libfreebl3.so "(CRC Mismatch).
Warning: the debug information found in "/usr/lib/debug/lib64/libfreebl3.so. debug" does not match "/lib64/libfreebl3.so "(CRC Mismatch).
Missing separate debuginfo for/lib64/libfreebl3.so
Try: Yum -- disablerepo = '*' -- enablerepo = '*-Debug *' install/usr/lib/debug/. Build-ID/4D/7a4246f3e891524fb3434b5593422b69af09. Debug
From the output, I guess it is the RPM package of debuginfo installed, which is different from the one I installed on a rhel-6.3 system disk. After all, I downloaded the debuginfo RPM package from the centos website. It is estimated that the RPM package provided by native RedHat is inconsistent. In this case, I have to find out where to download the native debuginfo RPM package provided by RedHat. How can we get it? Next, let's see:
How to Get debuginfo RPM from Redhat's official website
The system is RedHat 6.3. Previously, the debuginfo RPM package was downloaded from http://debuginfo.centos.org/6/x86_64. However, after the downloaded package is installed and running GDB for debugging, CRC mismatch is still said. I checked the RedHat official website and found out how to download the corresponding RPM package from the RedHat official website after a long time:
1. log on to the RedHat official website.
2. Go to the RPM package search page: https://rhn.redhat.com/rhn/channels/software/Search.do
3. enter the name of the debuginfo RPM package you want to find: Glibc and find the corresponding package:
4. Select the desired package: Glibc-debuginfo.
5. Here we will actually list all the versions from which you will select the desired version: glibc-debuginfo-2.12-1.80.el6.x86_64.rpm
6. Click to enter the detailed page of The glibc-debuginfo-2.12-1.80.el6.x86_64.rpm at this time:
7. You can click Download package in the lower-right corner. Occasionally, you will find that the package cannot be downloaded and cannot be found.
8. If a network problem occurs and the bottom half is disconnected, try several more times.
9. If it is not a network problem and the webpage cannot be found, try another method:"
RHEL server debuginfo (V.6 for x86_64) goes to the entire RHEL server debuginfo (V.6) Page
10. Click the 3rd tab: packages to download the RPM package from the entire debuginfo package:
11. Here, you can enter the desired RPM package in "filter by package:", and then click "Download packages" to download the package in a unified manner.
12. Click "Download selected packages now! ", The system will package" rhn-packages.tar ", download to local (it is possible to download midway out, then keep trying again, or into multiple packages, download separately, the debuginfo RPM package provided by red hat is obtained successfully !, On the package information page, you can compare the MD5 code of the RPM package you downloaded to confirm that the data is correct.
Reinstall the debuginfo RPM package
First, run the rpm-e command to uninstall the earlier installation package, then reinstall the debuginfo RPM downloaded from the RedHat official website, and then try to debug nginx through GDB.
Everything is OK ~!