This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: tcsetpgrp error & printing issues!
- To: "Brethour, Tanya (tonic)" <tonic at sequent dot com>
- Subject: Re: tcsetpgrp error & printing issues!
- From: Andrew Cagney <ac131313 at cygnus dot com>
- Date: Wed, 26 Jul 2000 15:02:06 +1000
- CC: GDB Patches <gdb-patches at sourceware dot cygnus dot com>
- References: <166E75C06F27D211B9860000C0AE13F509396330@wembley.sequent.com>
[FYI, list switched to gdb-patches - gdb internal stuff]
"Brethour, Tanya (tonic)" wrote:
>
> Hello!
>
> I am porting GDB 5.0 to ptx and I am running into some issues with tcsetpgrp
> and printing. Below is the output from GDB to give you an idea of what I am
> dealing with. Please note.. that the "stair-stepping" look is exactly how its
> being displayed.
>
> > ./gdb stressTest
> GNU gdb 5.0
> Copyright 2000 Free Software Foundation, Inc.
> GDB is free software, covered by the GNU General Public License, and you are
> welcome to change it and/or distribute copies of it under certain conditions.
> Type "show copying" to see the conditions.
> There is absolutely no warranty for GDB. Type "show warranty" for details.
> This GDB was configured as "i386-sequent-sysv4"...
> (gdb) run
> Starting program: /home/tonic/gdb-5.0/gdb/stressTest
> [tcsetpgrp failed in terminal_inferior: Not owner]
> Step - PID:C26 LWPID:1
> Step
> - PID:C26 LWPID:1
> [New Process 3110 Thread 2 ]
> [New Process 3110 Thread 3 ]
>
> [New Process 3110 Thread 4 ]
> [New Process 3110 Thread 5 ]
> [New Process 3110 Thread
> 6 ]
> [New Process 3110 Thread 7 ]
> [New Process 3110 Thread 8 ]
> [New Process 3110
> Thread 9 ]
> [New Process 3110 Thread 10 ]
> [New Process 3110 Thread 11 ]
>
> Program exited normally.
> (gdb)
The theory...
While the target program has halted, GDB owns the terminal. When the
target program is running, GDB hands control of the terminal over to
that target (and target program).
This is done using target_terminal_inferior(), target_terminal_ours()
and target_terminal_ours_for_output() [NB: currently these are macro's
but I'm going to fix that ... :-)] [NB: This also applies remote targets
but none exploit it]
In the above, what should happen is something like:
o enter run
o target_terminal_inferior()
should save current terminal
state then hand things over
to the sub process.
This looks to be failing.
o target creates new thread
and GDB is notified
o target_terminal_ours_for_output()
and then the thread message
o target_terminal_inferior()
and resume target
The latter output is probably scrambled because that initial
target_terminal_inferior() failed and the terminal is being restored to
a bogus state.
> Being new to porting GDB.. I am very puzzled by the tcsetpgrp error and the
> printing issue. Begining with the printing issue.. as you can see from the
> example... it is only when the program is run that the output becomse "messed
> up" Each time a new thread is created, GDB prints out [New...]. It is not my
> own code that is doing the printing, but GDB is. As soon as the program has
> exited.. it appear as though the printing problem is solved.. because
> "Program exited normally" is positioned correctly. I have no idea why this is
> happening and would appreciate any help you can give me!
Hopefully the above will get you going in the right direction.
Andrew