This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH v2] Restore terminal state in mi_thread_exit (PR gdb/17627)
- From: Pedro Alves <palves at redhat dot com>
- To: Simon Marchi <simon dot marchi at ericsson dot com>, Patrick Palka <patrick at parcs dot ath dot cx>
- Cc: gdb-patches at sourceware dot org
- Date: Thu, 04 Dec 2014 15:40:24 +0000
- Subject: Re: [PATCH v2] Restore terminal state in mi_thread_exit (PR gdb/17627)
- Authentication-results: sourceware.org; auth=none
- References: <1417558223-27328-1-git-send-email-simon dot marchi at ericsson dot com> <CA+C-WL_7DR0Bj-Co4GhFV+=HuX4VYt1FpGUi-6BcZZGNAuOquA at mail dot gmail dot com> <547F1E3F dot 3070307 at ericsson dot 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