Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cs.utexas.edu!usc!ucsd!telesoft!jjh From: jjh@telesoft.telesoft.com (Jim Hayes @wayward) Newsgroups: comp.unix.wizards Subject: How do I detect child input? Message-ID: <469@telesoft.telesoft.com> Date: 29 Aug 89 17:51:01 GMT Organization: TeleSoft, San Diego, CA. Lines: 25 Hi all, I'm working on a source-level debugger which runs on a Sun3 using SunOS 4.0. We spawn the target program (the program being debugged) using vfork(2) and keep control over it using ptrace(2). We want to have complete control over the child's terminal input and output so we can direct it to an i/o window we've set up; in order to do this we replace the child's stdin, stdout, and stderr descriptors with one end of a pipe, the other end of which the debugger watches. This works fine for the child's output: we check the pipe periodically using fstat(2), and when the child writes something onto the pipe we read it and display it to the window. But I sure can't figure out how to detect when the child is waiting for input. Right now we make the assumption that anything the user types while the child is running is intended for the child, and we send it down the pipe. This works ok, but it's not "right" and has several problems associated with it. Any suggestions? We're working under the restriction that we're not allowed to muck with the target's code (at least not much). I've beat my head against this one for quite a while now, so I'd greatly appreciate any help folks can offer. --Jim ------------------------------------------------------------------------------ "There's no problem so awful that you can't | Jim Hayes add some guilt to it and make it even worse!" | ...!ucsd!telesoft!jjh