From owner-freebsd-hackers Fri Apr 26 09:17:10 1996 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id JAA16662 for hackers-outgoing; Fri, 26 Apr 1996 09:17:10 -0700 (PDT) Received: from mail1.digital.com (mail1.digital.com [204.123.2.50]) by freefall.freebsd.org (8.7.3/8.7.3) with SMTP id JAA16657 for ; Fri, 26 Apr 1996 09:17:09 -0700 (PDT) From: garyj@frt.dec.com Received: from cssmuc.frt.dec.com by mail1.digital.com (5.65 EXP 4/12/95 for V3.2/1.0/WV) id AA22718; Fri, 26 Apr 1996 09:12:14 -0700 Received: from localhost by cssmuc.frt.dec.com; (5.65v3.2/1.1.8.2/14Nov95-0232PM) id AA25159; Fri, 26 Apr 1996 18:12:10 +0200 Message-Id: <9604261612.AA25159@cssmuc.frt.dec.com> X-Mailer: exmh version 1.6.4 10/10/95 To: hackers%freebsd.org@inet-gw-1.pa.dec.com In-Reply-To: Message from "Jordan K. Hubbard" of Fri, 26 Apr 96 02:57:31 PDT. Reply-To: gjennejohn@frt.dec.com Subject: Re: Something fishy with our PT_ATTACH code! Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Fri, 26 Apr 96 18:12:10 +0200 X-Mts: smtp Sender: owner-hackers@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk 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 > > > [d1] jkh-ttyp5@time-> ps ax | grep cat > > > [d2] jkh-ttyp5@time-> gdb > (gdb) attach > > [d3] > > [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