Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Is this correct? Redirecting stdin/stout to implement a gdb-like "set inferior tty" in zshdb

Recently I needed to debug a GNU autoconf configure script which seems to do funky things with stdin and stdout. I realized that the shell debuggers really should have the equivalent of gdb's "set inferior tty" (

Something along the lines of the below is what I came up with. But is this correct? $1 of course supposed to be the tty like say /dev/pts/1 on a GNU/Linuxy box.  When I tried it with the tty of another terminal, I'm getting output to the terminal but not input. I'm not sure it even makes sense to try to mug the input from another terminal or whether two processes (not even parent related) can read from the same input.

typeset line
exec 7<&0 </dev/null 6>&1  # Line taken from an autoconf "configure" script.
exec {_Dbg_fdi} <> $1
while : ; do
  vared -e -h -p "foo> " line <&${_Dbg_fdi} || break
  builtin print -- "$line" >&${_Dbg_fdi}
echo "That's all folks! (${_Dbg_fdi})"

Does zsh have <> like ksh does? It wasn't rejected, so I assume it does.

Finally, in looking at zsh documentation I see the way-cool tcp stuff. This seems to make it doable to implement remote debugging over a tcp connection.  And remote debugging (via sockets) is generally how front-ends like Eclipse or the Java netbeans debuggers work. It also can be very helpful in debugging remote processes. However right now I don't have need or plans to put this in. I mention in case there's someone out there is interested in hacking on.

Messages sorted by: Reverse Date, Date, Thread, Author