Date: Fri, 26 Apr 96 18:12:10 +0200 From: garyj@frt.dec.com To: hackers%freebsd.org@inet-gw-1.pa.dec.com Subject: Re: Something fishy with our PT_ATTACH code! Message-ID: <9604261612.AA25159@cssmuc.frt.dec.com> In-Reply-To: Message from "Jordan K. Hubbard" <jkh@time.cdrom.com> of Fri, 26 Apr 96 02:57:31 PDT.
next in thread | previous in thread | raw e-mail | index | archive | help
jkh@time.cdrom.com writes: > Just got back from Kirk's usual Thursday-night OS class and while we > were going through exit1(), I noticed something that looked a little > odd in the ptrace "reattach" code. In following it (and it later > turned out to be correct), I happened to notice the following weird > behavior with attach and detach: > > Sequence: > > [d0] jkh-ttyp4@time-> cat > <leave cat hanging around reading from stdin> > > [d1] jkh-ttyp5@time-> ps ax | grep cat > <get cat's pid> > > [d2] jkh-ttyp5@time-> gdb > (gdb) attach <catpid> > > [d3] <cat process is now in TX+ state, no wait channel> > > [d4] (gdb) detach > > [d5] [1]+ Suspended (signal) cat > > > This is probably a bit hard to read, so I'll give you > a synopsis: Start cat, attach cat from another tty with > gdb, watch cat go to sleep, detach cat in gdb and watch > cat erroneously suspend itself. > > It would seem to me that the far more correct behavior would > be something like: > > Start cat, attach cat from another tty with gdb, watch cat go to > sleep, detach cat in gdb and watch it return to its previous > un-stopped state. > > Or am I off-base on this one somehow? > I've noticed this behavior myself, but I wasn't sufficiently irritated by it to track it down. I guess I should take a look at it. Note that gdb doesn't use ptrace to do attach/detach (unless somebody changed it). It uses the procfs stuff. Could be an interesting experiment to change gdb to use ptrace now that there's support in there. This would have the added benefit of allowing those weird people who don't mount their procfs on /procfs to also use attach/detach :-) --- Gary Jennejohn (work) gjennejohn@frt.dec.com (home) Gary.Jennejohn@munich.netsurf.de (play) gj@freebsd.org
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?9604261612.AA25159>