GDB, ptys and other non-ciritical stuff (was "Looking for an

This is in follow up to my question in qnx4.devtools. I posted it in the
wrong place, my applogies…

I think I found why I’m having problems.

pdebug opens /dev/ptyp0 to feed data into and read data from my program. It
then spawns program and attaches stdin, stdout and stderr of my program to
/dev/ttyp0. I confirmed this with ‘sin fds’.

The problem I think is that data written to /dev/ptyp0 is not coming out of
(as input into my program) /dev/ttyp0.

I did two tests:

  1. pterm -d /dev/ptyqf &
    pterm -d /dev/ttyqf &

Two pterms started…if I typed in the pterm attached to ttyqf…the
characters typed appeared in the pterm attached to /dev/ptyqf
BUT if I typed in the pterm attached to /dev/ptyqf, the characters appeared
in itself, while nothing appeared in pterm attached to /dev/ttyqf.

So after having a converstation with cdm, he mentioned that this would not
work…so…I tried just cat and echo.

Thus test #2:
I had the same response with an interesting twist. ‘cat’ would
block…waiting for data if attached to /dev/ptyqf (i.e. ‘cat /dev/ptyqf’),
but would exit instantly if attached to /dev/ttyqf. (i.e. ‘cat /dev/ttyqf’)

If ‘cat’ was attached to /dev/ptyqf and I did 'echo “testing”

/dev/ttyqf’…cat would spit out the text “testing” and continue to wait
for more data.

I couldn’t get any data out of /dev/ttyqf using cat. (I also tried ‘cat <
/dev/ttyqf’…same thing…would just return to the shell prompt. But if I
‘cat </dev/ptyqf’ it would block, waiting for data).

So…noticing that stdin of my program is attached to /dev/ttyp0, I have
come to the conclusion that this relationship is behaving just like my pterm
and cat/echo tests. Thus pdebug is sending data faithfully, but it is never
getting through /dev/ttyp0 as stdin to my program.

Two things: Am I coming to the correct conclusions? Second…can someone
point me to a reference that I may come to a more accurate definition of the
pseudo terminal? I think I have a too simplistic view of it all.

I am going to assume that this is correct behavior of devc-pty, and thus I
am never going to get input into my remote-debuged program unless I write my
own version of devc-pty that is simply just a bi-directional fifo pipe on
both ends.

BTW: I’m not complaining…just trying to understand what I’m dealing
with…

Thanks all,

Kevin

What about modifying your program (for debug purposes) to redirect its own
std… to the tty associated with the session you want to interact with the
program in?

dB

“Kevin Stallard” <kevin@ffflyingrobots.com> wrote in message
news:ag0k32$23f$1@inn.qnx.com

This is in follow up to my question in qnx4.devtools. I posted it in the
wrong place, my applogies…

I think I found why I’m having problems.

pdebug opens /dev/ptyp0 to feed data into and read data from my program.
It
then spawns program and attaches stdin, stdout and stderr of my program to
/dev/ttyp0. I confirmed this with ‘sin fds’.

The problem I think is that data written to /dev/ptyp0 is not coming out
of
(as input into my program) /dev/ttyp0.

I did two tests:

  1. pterm -d /dev/ptyqf &
    pterm -d /dev/ttyqf &

Two pterms started…if I typed in the pterm attached to ttyqf…the
characters typed appeared in the pterm attached to /dev/ptyqf
BUT if I typed in the pterm attached to /dev/ptyqf, the characters
appeared
in itself, while nothing appeared in pterm attached to /dev/ttyqf.

So after having a converstation with cdm, he mentioned that this would not
work…so…I tried just cat and echo.

Thus test #2:
I had the same response with an interesting twist. ‘cat’ would
block…waiting for data if attached to /dev/ptyqf (i.e. ‘cat
/dev/ptyqf’),
but would exit instantly if attached to /dev/ttyqf. (i.e. ‘cat
/dev/ttyqf’)

If ‘cat’ was attached to /dev/ptyqf and I did ‘echo “testing”
/dev/ttyqf’…cat would spit out the text “testing” and continue to wait
for more data.

I couldn’t get any data out of /dev/ttyqf using cat. (I also tried ‘cat
/dev/ttyqf’…same thing…would just return to the shell prompt. But if
I
‘cat </dev/ptyqf’ it would block, waiting for data).

So…noticing that stdin of my program is attached to /dev/ttyp0, I have
come to the conclusion that this relationship is behaving just like my
pterm
and cat/echo tests. Thus pdebug is sending data faithfully, but it is
never
getting through /dev/ttyp0 as stdin to my program.

Two things: Am I coming to the correct conclusions? Second…can someone
point me to a reference that I may come to a more accurate definition of
the
pseudo terminal? I think I have a too simplistic view of it all.

I am going to assume that this is correct behavior of devc-pty, and thus I
am never going to get input into my remote-debuged program unless I write
my
own version of devc-pty that is simply just a bi-directional fifo pipe on
both ends.

BTW: I’m not complaining…just trying to understand what I’m dealing
with…

Thanks all,

Kevin
\