Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Simon Marchi <simark@simark.ca>, gdb-patches@sourceware.org
Subject: Re: [PATCH] Fix new-ui tty stream leak
Date: Thu, 18 Jul 2019 20:53:00 -0000	[thread overview]
Message-ID: <2378ac9e-e890-7aff-3b13-a146f89ffecd@redhat.com> (raw)
In-Reply-To: <c343fa8a-88b7-123a-6f9d-1471f2fd4dbf@simark.ca>

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


      reply	other threads:[~2019-07-18 20:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-18 18:41 Pedro Alves
2019-07-18 20:09 ` Simon Marchi
2019-07-18 20:53   ` Pedro Alves [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2378ac9e-e890-7aff-3b13-a146f89ffecd@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=simark@simark.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox