Re: [RFC] Release the GIL while running a gdb command or expression

Tom Tromey
2018-10-09T19:42:10Z

>>>>> "Phil" == Phil Muldoon <pmuldoon@redhat.com> writes:

Phil> We've had a similar patch in the Fedora RPM for a while. It's been on
Phil> my list to upstream for a bit. Initially I was a bit reluctant
Phil> because I hadn't audited all the Python reentry points in GDB to make
Phil> sure we reacquired the GIL before interacting with Python. I realize
Phil> now this was not a real concern (reviews would catch this and if one
Phil> did slip by it would be fixed as a bug.)

Yes, I think it would result in a crash.

Phil> The only real difference in the patch approach was to make the GIL
Phil> release an option over a default.

I don't think this is necessary, mostly because I can't think of when it
would be desirable not to release the GIL; but also because when writing
Python one doesn't normally have to worry about the GIL -- it's not
really a Python-visible feature, nor should it be, since implementations
like PyPY don't have it.

Phil> As for a test, we also have a test included. It does not appear to be
Phil> racy for our purposes. I also include it for consideration. This
Phil> snippet is just for initial consideration and will make any changes
Phil> needed to include it in the patch.

I can try it. If it works, whose name should I put on the ChangeLog?

Tom