简体   繁体   中英

Python: debugging with gdb (on OSX)

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 .

Sure, it is feasible. You presumably already have Python for your platform. Now you just need to build gdb. gdb isn't as well-supported there, but it does work.

Alternatively you can read the section "GDB on Legacy systems" at that first link.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM