How to debug a running Python program?

Official original wiki: https://wiki.python.org/moin/DebuggingWithGdb

Under CentOS, the installation process is not detailed enough by the official. Record here

Install yum-utils first, then debuginfo can be used after installation

sudo yum install yum-utils

Then use debuginfo to install glibc, but before installation, you may need to configure the debuginfo repository first, edit/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

Then you can install glibcup.

yum --nogpgcheck --enablerepo=debuginfo install glibc-debuginfo
sudo debuginfo-install glibc

Final install python-debuginfo

sudo yum install gdb python-debuginfo

I recommend my original " PyCharm Chinese Guide " e-book, which contains a large number (300) of illustrations . It is well-made and worthy of a collection by every Python engineer.

The address is: http://pycharm.iswbm.com

Guess you like

Origin blog.csdn.net/weixin_36338224/article/details/109023341