This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: Is there a way to unset inferior-tty?
- From: Pedro Alves <palves at redhat dot com>
- To: Marc Khouzam <marc dot khouzam at ericsson dot com>, Simon Marchi <simon dot marchi at polymtl dot ca>
- Cc: "gdb at sourceware dot org" <gdb at sourceware dot org>
- Date: Thu, 11 Aug 2016 18:16:44 +0100
- Subject: Re: Is there a way to unset inferior-tty?
- Authentication-results: sourceware.org; auth=none
- References: <E59706EF8DB1D147B15BECA3322E4BDC22AF1378@eusaamb103.ericsson.se> <302246af-a394-4a76-5223-5cac924bda9a@redhat.com> <9560791fd070c79f7ab54e5e7b63d433@simark.ca> <E59706EF8DB1D147B15BECA3322E4BDC22AF19ED@eusaamb103.ericsson.se>
On 07/02/2016 03:04 PM, Marc Khouzam wrote:
> In the end I moved to a more complete solution for eclipse. Right
> after an inferior starts, eclipse will reset the tty to a new and
> valid value; that way, if the user does a 'run', the tty will already
> be properly set _and_ will direct inferior output to a valid eclipse
> console.
>
> FWIW, this also led me to automatically set the tty for an inferior
> that is created using the GDB console with the 'add-inferior' command
> (thanks to the =thread-group-added event). I think this will make for
> an improved user experience with the GDB console in eclipse.
Sounds to me like this will end up causing trouble.
E.g., if you follow a big tree of processes (e.g., debug "make check"
with "set detach-on-fork off"), you'll end up creating a useless tty
for each of the thousands of short lived children spawned, right?
It's also racy. E.g., a script can do:
add-inferior ..
inferior 2
run
And before you managed to handle the =thread-group-added event,
"run" has already run, so you can no longer change the inferior's
tty.
Unless you're pointing all inferiors to the same tty?
In that case, why are you destroying the original tty in
the first place?
I wonder whether what we need is a "set default-inferior-tty TTY" command,
that makes inferiors created with "add-inferior" inherit that
TTY automatically? With that, a frontend would have (or could give the
user the) choice of making inferiors created in the console with
add-inferior output to a separate console. If that setting is clear,
then output of new inferiors created on the console goes to
gdb's console by default or to wherever the user forced with
"set inferior-tty", just like when running gdb outside Eclipse.
In sum:
#1 - If "set inferior-tty" is explicitly set in the inferior, use that.
#2 - Otherwise, if "set default-inferior-tty" is explicitly set, use that.
#3 - Otherwise, use gdb's tty.
Thanks,
Pedro Alves