1.19 如何调试已经运行中的程序 ============================= |image0| 官方原始wiki:https://wiki.python.org/moin/DebuggingWithGdb 在CentOS 下,安装包过程,官方给的不够详细。这里记录一下 先安装 yum-utils,装完后就能使用 debuginfo .. code:: shell sudo yum install yum-utils 然后使用debuginfo 安装 glibc,不过在安装之前,有可能 你需要先配置debuginfo的仓库,编辑\ ``/etc/yum.repos.d/CentOS-Debuginfo.repo`` :: #Debug Info [debuginfo] name=CentOS-$releasever - DebugInfo # CentOS-4 #baseurl=http://debuginfo.centos.org/$releasever/ # CentOS-5 baseurl=http://debuginfo.centos.org/$releasever/$basearch/ gpgcheck=0 enabled=1 # CentOS-4 #gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-$releasever # CentOS-5 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5 protect=1 然后就可以安装 ``glibc`` 了。 .. code:: shell yum --nogpgcheck --enablerepo=debuginfo install glibc-debuginfo sudo debuginfo-install glibc 最后安装 ``python-debuginfo`` .. code:: shell sudo yum install gdb python-debuginfo |image1| .. |image0| image:: http://image.iswbm.com/20200602135014.png .. |image1| image:: http://image.iswbm.com/20200607174235.png