[PATCH, RFC] fix gdbserver channel leaks

Sandra Loosemore sandra@codesourcery.com
Wed Jan 16 21:18:00 GMT 2019


I've been trying to remove some ancient cruft in our local remote-target 
gdbserver test harness that has caused problems with some newer GDB 
tests.  This has exposed what I think is a problem in GDB's own 
gdbserver-support.exp:  having opened a channel to the gdbserver spawn 
in gdbserver_start, in many cases it is failing to close it cleanly, 
causing it to leak so many open channels that eventually TCL runs out 
and starts giving ERRORs.  Specifically, gdbserver_start is discarding 
any already-open server_spawn_id without closing it when opening a new 
channel, and the logic in gdbserver_gdb_exit that tries to clean up the 
gdbserver connection is failing to actually close the channel before 
discarding server_spawn_id.

I've thought it best to consolidate the logic to manage server_spawn_id 
in start_gdbserver and close_gdbserver.  It did seem plausible to put 
the logic to shut down any old server_spawn_id channel before opening a 
new one in gdbserver_run instead of in start_gdbserver, but there are 
places that bypass that function (e.g., in the mi test support).

The alternative to fixing this in GDB's own test support seems to be 
doing it at the DejaGnu board level instead, which is what I'm trying to 
get rid of in our local test harness.  There's no documentation about 
the expectations and it seems pretty hacky and a violation of 
abstractions to do it in the low-level board support.

I'm wondering, can other people who do remote-target gdbserver testing 
help try out this patch and see if it works for them?  I've gotten good 
results with my nios2-linux-gnu test setup but I don't know what kind of 
board support other people might be using.  Also, assuming the patch is 
OK, I don't know if it's inappropriate or too late for the 8.3 release.

-Sandra
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gdbserver-channel.log
Type: text/x-log
Size: 262 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20190116/61bed013/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gdbserver-channel.patch
Type: text/x-patch
Size: 893 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20190116/61bed013/attachment-0001.bin>


More information about the Gdb-patches mailing list