Daniel Jacobowitz wrote about some Python/GDB experiences and bugs in the email: http://sourceware.org/ml/archer/2009-q4/msg00008.html This bug (and others in their own bugs) is extracted from that email to track the issue: * The archer branch calls PyGILState_Ensure in several places where it should call ensure_python_env. So python_language was often unset if I tried 'gdb -ex "source -p file.py"'. To work around it, I had the end of file.py register a new gdb.Command, and called the command.
This causes a segfault when it triggers.
I've checked in a patch to archer-tromey-python. Checked FSF upstream and there do not appear to be any other areas where PyGILState_Ensure is used. commit d4a1bd50bb1d7c3cab75f690597c64191b2b6f78 Author: Phil Muldoon <pmuldoon@redhat.com> Date: Thu Oct 22 08:39:28 2009 +0100 Use ensure_python_dev over PyGILState_Ensure/Release. 2009-10-21 Phil Muldoon <pmuldoon@redhat.com> PR python/10806 * python/python.c (run_python_script): Use ensure_python_env over PyGILState_Ensure. (gdbpy_run_events): Likewise. (run_python_script): Likewise. (source_python_script): Likewise. * python/py-breakpoint.c (gdbpy_breakpoint_created): Likewise. (gdbpy_breakpoint_deleted): Likewise. * python/py-inferior.c (delete_inferior_object): Likewise. (add_thread_objet): Likewise. (delete_thread_object): Likewise.