From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20387 invoked by alias); 4 Dec 2014 15:40:40 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 20370 invoked by uid 89); 4 Dec 2014 15:40:39 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Thu, 04 Dec 2014 15:40:34 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id sB4FeRmI009198 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 4 Dec 2014 10:40:28 -0500 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id sB4FeOkh009435; Thu, 4 Dec 2014 10:40:25 -0500 Message-ID: <54808068.5050807@redhat.com> Date: Thu, 04 Dec 2014 15:40:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: Simon Marchi , Patrick Palka CC: gdb-patches@sourceware.org Subject: Re: [PATCH v2] Restore terminal state in mi_thread_exit (PR gdb/17627) References: <1417558223-27328-1-git-send-email-simon.marchi@ericsson.com> <547F1E3F.3070307@ericsson.com> In-Reply-To: <547F1E3F.3070307@ericsson.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2014-12/txt/msg00094.txt.bz2 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