[AuckLUG] gdb with input/output in a separate window

John O'Gorman john at og.co.nz
Sun Jul 29 15:03:10 NZST 2007


On Sat, 2007-07-28 at 20:18 +1200, Michal Ludvig wrote:
> John O'Gorman wrote:
> > This is one for old-timers?
> 
> Doh!
> 
> > 2. Fire up gdb on dev/pts/0 with the arg -tty /dev/pts/1
> > e.g.
> > $ gdb -tty /dev/pts/1 prog.4ae
> > gdb> run
> > gdb> ...
> 
> A different approach. Or two, actually:
> 
> 1) Run your program on one terminal, get its PID and run "gdb --attach
> that-pid prog.4ae". As the target is your program I assume you can make
> it print its PID and wait for a keypress on start before doing anything
> useful. That will give you time to --attach it.
There are some 40 odd programs to alter in this way (but they won't all
neeed intesive debugging).
> 
> 2) Or run your program under gdbserver and attach and control it from
> gdb over loopback (localhost) interface. That could help in case you
> couldn't (or are not willing to) add that waiting for keypress.

This one is news to me. I confirmed that it exists on my system and, in
fact, rpm -q --whatprovides /usr/bin/gdbserver shows that it is part of
the gdb distribution.
> 
> The difference between #1 and #2 is that in #1 your program is already
> running at the time you attach it, while in #2 you are able to control
> it from the very beginning.
> 
> In both cases you get the TTY separation of gdb and your program
> natively as each of them is invoked on a different terminal.

Many thanks! I will try both solutions, although at the moment I favour
your #2 option

regards
John O'Gorman
> 
> HTH,
> 
> Michal
> 
> 
> 
> 
> _______________________________________________
> AuckLUG mailing list
> AuckLUG at linux.net.nz
> http://www.linux.net.nz/cgi-bin/mailman/listinfo/aucklug
> 




More information about the AuckLUG mailing list