Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Alan Hayward <Alan.Hayward@arm.com>
To: Pedro Alves <palves@redhat.com>
Cc: Andrew Burgess <andrew.burgess@embecosm.com>,
	"gdb-patches@sourceware.org"	<gdb-patches@sourceware.org>,
	nd <nd@arm.com>
Subject: Re: [PATCH] Supress SIGTTOU when handling errors
Date: Fri, 24 May 2019 12:36:00 -0000	[thread overview]
Message-ID: <DF6A66BC-8548-433A-9AF7-8B8736467E82@arm.com> (raw)
In-Reply-To: <7483f478-44d2-b2ce-b0cb-3e984054305a@redhat.com>



> On 24 May 2019, at 12:02, Pedro Alves <palves@redhat.com> wrote:
> 
> On 5/24/19 9:54 AM, Alan Hayward wrote:
> 
>> Looking back at my original patch again, I’m wondering if it’s better to
>> move the ignore higher up the call stack in print_flush, so that it’s set
>> across both flushes:
> 
> What are the two flushes?  I only see one, from the serial_drain_output call?

Sorry, I was forgot it was that call. I was thinking it was as part of the
gdb_flush call.
 
> 
> In any case, I think it's better to keep the SIGTTOU handling close to
> the tcdrain call, to make to code a lot more obvious -- SIGTTOU suppression
> is described in tcdrain manuals -- and I don't think we have to worry
> about efficiency here?

True - errors from gdb shouldn’t be frequent enough to be an issue.

> 
>> ...or if it really should be left just around the tcdrain.
>> Not quite sure what the behaviour is on non-Linux targets.
> 
> The behavior should be the same on all POSIX systems:
> 
> https://pubs.opengroup.org/onlinepubs/009695399/functions/tcdrain.html
> 
> "Any attempts to use tcdrain() from a process which is a member of a background
> process group on a fildes associated with its controlling terminal, shall cause the process
> group to be sent a SIGTTOU signal. If the calling process is blocking or ignoring
> SIGTTOU signals, the process shall be allowed to perform the operation, and
> no signal is sent."
> 
> On non-POSIX systems, the serial_drain_output call doesn't end up in
> ser-unix.c:hardwire_drain_output, so from that perspective, putting
> the SIGTTOU suppression in common code is a bit of an abstraction violation.

Ok, agreed.

Any objections to me pushing the original patch then?


> 
>> 
>> 
>>> 
>>> That isn't to say that your patch _isn't_ also correct.  We have many
>>> latent bugs around this area.  Let me take a better look at that one too.
>>> 
>>> I think that even if we get something like your patch in, then
>>> Alan's is still correct because we can have places doing
>>> try/catch to swallow an error but still print it with exception_print,
>>> all while the inferior is running.  Of course such spots should
>>> call ours_for_output(), but that will run into the tcdrain issue.
>>> 
>> 
>> Minor issue is that once my patch is in, it’ll hide the missing ours_for_output
>> bugs (?)
>> 
> 
> Sure.  But we shouldn't avoid fixing one bug because of that.  The
> palves/tty-always-separate-session branch on my github exposes such
> bugs because with a missing ours_for_output call, gdb prints to
> the screen while the terminal is in raw mode, resulting in output
> like
> 
> this is line one
>                this is line two
>                                this is line three
> 
> instead of:
> 
> this is line one
> this is line two
> this is line three
> 
> Thanks,
> Pedro Alves


  parent reply	other threads:[~2019-05-24 12:36 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-16 15:51 Alan Hayward
2019-05-16 18:06 ` Andrew Burgess
2019-05-16 18:30   ` Andrew Burgess
2019-05-23 20:33     ` Pedro Alves
2019-05-17 12:47   ` Alan Hayward
2019-05-18  9:10     ` Andrew Burgess
2019-05-23 20:32   ` Pedro Alves
2019-05-24  8:54     ` Alan Hayward
     [not found]       ` <7483f478-44d2-b2ce-b0cb-3e984054305a@redhat.com>
2019-05-24 12:36         ` Alan Hayward [this message]
2019-05-24 13:15           ` Pedro Alves
2019-05-26 22:43           ` Andrew Burgess
2019-05-27 18:03             ` Pedro Alves
2019-05-28  9:39               ` Alan Hayward
2019-08-02 16:05                 ` [8.3 backport] " Tom de Vries
2019-08-05 10:59                   ` Alan Hayward
2019-08-05 17:33                   ` Tom Tromey
2019-05-18 13:42 ` [PATCH] " Andreas Schwab
2019-05-19 22:06   ` Andrew Burgess
2019-05-20  8:44     ` Alan Hayward
     [not found]       ` <20190520091157.GC2568@embecosm.com>
2019-05-20  9:49         ` Pedro Alves
2019-05-23 20:35         ` Pedro Alves

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=DF6A66BC-8548-433A-9AF7-8B8736467E82@arm.com \
    --to=alan.hayward@arm.com \
    --cc=andrew.burgess@embecosm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=nd@arm.com \
    --cc=palves@redhat.com \
    /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