7

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 ?

2 Answers 2

4

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.

Sign up to request clarification or add additional context in comments.

Comments

0

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.

1 Comment

Yes, but how do you add the Python extensions for gdb? is there a configure flag that needs to be set when building gdb? Some extra download?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.