How to share the same serial port?
Thu Apr 30 19:57:00 GMT 1998
Getting debug output from the target to stdout on the gdb terminal can
also be done by sending the 'O' packet. It's not documented, but if you
look the switch statement in the standard remote.c, a packet of this
type is interpreted as "console output" from the target. There is,
however, no standard way (as far as I know) of getting stdin from the
gdb session into the target.
>From: firstname.lastname@example.org [SMTP:email@example.com]
>Sent: Thursday, April 30, 1998 12:13 PM
>To: firstname.lastname@example.org; email@example.com
>Subject: Re: How to share the same serial port?
>>I use gdb to do remote debugging, but the target board has only one
>>my problem is, how to use this port to run remote gdb and to use this
>>as the input/output port of the target program at the same time?
>We do this with a customized remote-xxx.c target handler added to gdb
>and a customized gdb stub file in the target. When the target handler
>is waiting for gdb traffic it puts the control terminal in raw mode
>and transparently passes characters between the console and the serial
>debug link. When the gdb stub code handles an exception, it sends a
>special escape sequence to the target handler. The target handler detects
>the escape, and restores the console terminal mode and resumes normal
>gdb processing. There are also a few special escapes on the console
>input side to do things like sending a break sequence to the target.
>We use this to force a break back into gdb in the target.
More information about the crossgcc