There are quite a few tutorials on debugging with gdb for Python. Just to name a few among the best:
However all of them are targeted for the Linux OS. Is it feasible to install all the extension packages required on OSX ?
You need to build gdb. Per this answer, you need to set CFLAGS=-Wno-string-plus-int
before building (at least, for MacOS 10.9 and gdb 7.6.1).
You have to codesign gdb before you can use it.
Then you need get a 'real' executable out of the MacOS fat binary so gdb can read it:
lipo -thin x86_64 -output python-x86_64 /usr/bin/python
Then you can happily:
gdb --args /path/to/python-x86_64 myPythonScript.py arg1 arg2
Alternatively, you can use lldb
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With