I am debugging a Python app which uses wxPython that is crashing on macOS with an error like:
Python(35192,0x700005851000) malloc: Incorrect checksum for freed object 0x7fb56640cdb8: probably modified after being freed.
Corrupt value: 0x51
Python(35192,0x700005851000) malloc: *** set a breakpoint in malloc_error_break to debug
Fatal Python error: Aborted
Now, I believe I can only set a C breakpoint on malloc_error_break
with gdb if I build Python from source with debugging symbols, using the --with-pydebug
configure option.
However if I build such a version of Python and then try to run my program, I immediately get an error:
This program needs access to the screen. Please run with a
Framework build of python, and only when you are logged in
on the main display of your Mac.
So I need a “Framework build of python” that also has debugging symbols. How can I build such a Python binary?