This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v2] Restore terminal state in mi_thread_exit (PR gdb/17627)


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]