This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


On 16/10/2018 22:39, Tom Tromey wrote:
> Pedro> Hopefully it'll be possible to tighten the test a bit to avoid that.
> 
> I should have read the test more closely.  It doesn't do what it claims
> to do at all.

I'm not sure what it or I claimed? The initial snippet and test was included
with this explanation:

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

This was from the original (version 1) email.

> 
> The only way the test can fail is if one "Hello" or "Sleeping" line
> comes with the wrong number:
> 
> 	set n $expect_out(1,string)
> 	if { $hello_last + 1 != $n } {
> 	    fail $test
> 
> But this just isn't possible.

I can't remember why I wrote it this way, or if there was a
modification to the patch over the years, but, the original intention
to the patch was to test interleaved output from the Python thread and
GDB (thereby proving the GIL was released).

> 
> Also the Python code is calling print on a gdb stream in a background
> thread, which is a no-no.

Yeah, this came up in the original review thread. You pointed out that
GDB wasn't thread safe when I was worried over any existing scripts
out there that would rely on the expectation that the gdb.command API
would hold the GIL. For some reason, I did not know this beforehand
(that GDB wasn't thread safe), so that is why it snuck in there (back
in 2014).

Cheers

Phil


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]