How to compile Python extension with debug info using PIP
Asked Answered
W

1

15

I have source code for an extension in Python. I want to see debug symbols for that extension when I debug it. How do I tell PIP to compile and link debug symbols for my extension?

(Preferably platform agnostic, else Linux)

Warehouseman answered 10/5, 2015 at 16:42 Comment(0)
T
15

You need to invoke setup.py's build command with --debug flag during package installation. Using pip additional flags to setup.py can be passed using --global-option:

pip install --no-binary :all: --global-option build --global-option --debug PACKAGE

In case of errors try upgrading pip and setuptools:

pip install -U setuptools
pip install -U pip

I found this information in this blogpost by Jonathan Lange: https://jml.io/2015/08/debugging-python-with-gdb.html

Tripoli answered 17/6, 2016 at 18:50 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.