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
- X-seq: zsh-users 13547
- From: "Rocky Bernstein" <rocky.bernstein@xxxxxxxxx>
- To: "Zsh users list" <zsh-users@xxxxxxxxxx>
- Subject: Is this correct? Redirecting stdin/stout to implement a gdb-like "set inferior tty" in zshdb
- Date: Tue, 9 Dec 2008 06:27:48 -0500
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:mime-version:content-type; bh=nFqAcwwvRJB6BDfBAuvTvEPEETMup/3AyWuN14ChxPc=; b=mmqcxsz4JsPZJ7KkcFpFY7YtBeHQNDmV/LU4bi6Xp0czfkHOqfDlXVEhRPZ7sMV3fx q4q8Bm9I4nBwZzAwwkHd0FtvGberVCz8EoQm3UABRF6V+IVW5a2QNWp7QDcX2aKPjiPX U8GasoCRbxz5GKsjc2qQJY5YmEIuKCkgtR0fo=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type; b=GcTr95NLGyOZ4iH6TYNqC6IBaZsBVirdyLb9hluNpxNytYHpfGl5NOJxspneg3XHaP lbyuQXv2Abwo96yUWPzHKhxbPpMF52nkhgkrQPURrHlFLsPs+rSbJm6sumFxnVoZtkUy e/BZ0u2AK9w5Jk5Ic7XWHjD2prar7ZS2dV9TU=
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
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" (
http://www.mcs.vuw.ac.nz/cgi-bin/info2www?(gdb)Input/Output)
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.
#!/usr/local/bin/zsh
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}
line=''
done
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