Saturday, January 9, 2021

Setting up GDB for Debugging Python 3.9.1 on OS X Mojave

https://unconj.ca/blog/setting-up-gdb-for-debugging-python-on-os-x.html

brew install gdb and codesign gdb (updated procedure from: https://sourceware.org/gdb/wiki/PermissionsDarwin)

Brew installed python3 is already in thin format, no need to use lipo to extract, although you can still use lipo to check python executable format. (Non-fat file: python3 is architecture: x86_64)

Providing python3 interpreter (not symbolic link) with path if necessary, after gdb , and this will solve error message like: "0x7ffeefbff800s": not in executable format: file format not recognized

Had to compile Python3 from source to get rid of the following warning: ( ./configure --with-pydebug). Uncommenting SSL related lines in Modules/Setup file is to load ssl module in Python

Reading symbols from python...
(No debugging symbols found in python)

Also build gdb from source code again (./configure --with-python=/usr/local/bin/python3 --disable-werror), as brew info gdb failed with Brew installed python@3.9. Codesign command again for gdb.







Python gdp support: https://devguide.python.org/gdb/

 ~/.gdbinit with content below:

set startup-with-shell off

add-auto-load-safe-path /usr/local/bin


No comments:

Post a Comment