public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Simon Marchi <simon.marchi@ericsson.com>,
	       Patrick Palka <patrick@parcs.ath.cx>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH v2] Restore terminal state in mi_thread_exit (PR gdb/17627)
Date: Thu, 04 Dec 2014 15:40:00 -0000	[thread overview]
Message-ID: <54808068.5050807@redhat.com> (raw)
In-Reply-To: <547F1E3F.3070307@ericsson.com>

On 12/03/2014 02:29 PM, Simon Marchi wrote:
> On 2014-12-02 07:08 PM, Patrick Palka wrote:

>> So I
>> wonder if it would make sense to shift this responsibility to the
>> observer module itself (i.e. generic_observer_notify()), so that all
>> observers implicitly restore the original terminal state when they
>> return.  That way this kind of pattern wouldn't have to be duplicated
>> for each individual observer.
> 
> I wouldn't put that responsibility in the observer module itself. It's a pretty
> generic piece of code (not tied to GDB business logic) and should stay that way
> I think.

Agreed.  An observer could end up resuming the target for instance, or
it could be that the normal_stop observer ends up responsible for calling
target_terminal_ours if nothing else called it before.  In both
those cases it'd be wrong to revert the terminal to the previous state.

> Also, I think that for clarity it's better to leave that responsibility of changing
> the terminal mode to the functions that know that something is going to be printed
> (which are not necessarily the functions that actually print the things). Moving that
> responsibility to some code that has nothing to do with printing (e.g. observer, or
> the caller of observer_notify_*) would make things more confusing. Basically, separation
> of concerns.

*nod*

Thanks,
Pedro Alves

  reply	other threads:[~2014-12-04 15:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-02 22:10 Simon Marchi
2014-12-03  0:09 ` Patrick Palka
2014-12-03 14:29   ` Simon Marchi
2014-12-04 15:40     ` Pedro Alves [this message]
2014-12-04 15:35 ` Pedro Alves
2014-12-05 16:12   ` Simon Marchi
2014-12-10 17:20     ` Pedro Alves
2014-12-10 18:06       ` Simon Marchi

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=54808068.5050807@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=patrick@parcs.ath.cx \
    --cc=simon.marchi@ericsson.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).