This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Fix new-ui tty stream leak
On 7/18/19 9:09 PM, Simon Marchi wrote:
> On 2019-07-18 2:41 p.m., Pedro Alves wrote:
>> I noticed that we never close the stream opened by new-ui.
>>
>> This fixes it, by adding a new struct ui ctor that takes ownership of
>> the passed-in stream.
>
> Hi Pedro,
>
> If I am not mistaken, we never delete the UIs themselves either, so it won't
> make a difference today, is that right? They just live until the end of the
> GDB process.
We actually delete them if the tty closes. See stdin_event_handler.
E.g., spawn an instance of KDE's console that just runs "tty" to print
the terminal device:
$ konsole --hold -e tty&
Run a new-ui on that terminal:
$ gdb -ex "new-ui console /dev/pts/36"
...
New UI allocated
Now close the konsole window, and back in the main console, GDB prints:
Error detected on fd 13
> Still, I think this patch is fine, in that it makes things right in case we
> decide to make it possible to close an existing UI some day.
Some day is here. :-)
Thanks,
Pedro Alves