Python: debugging with gdb (on OSX)

There are quite a few tutorials on debugging with gdb for Python. Just to name a few of the best:

However, they are all designed for Linux. Is it possible to install all the expansion packs required for OSX?

+6
source share
2 answers

You need to build gdb. Per this answer , you need to set CFLAGS=-Wno-string-plus-int before creating (at least for MacOS 10.9 and gdb 7.6.1).

Before using it, you must codeign gdb .

Then you need to get the "real" executable from the MacOS 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 .

+4
source

Of course it is possible. You probably already have Python for your platform. Now you just need to build gdb. gdb is not supported there, but it works.

Alternatively, you can read the "GDB on Legacy systems" section in this first link.

0
source

Source: https://habr.com/ru/post/954488/


All Articles