Date: Sun, 29 Apr 2012 19:43:00 +0300 From: Konstantin Belousov <kostikbel@gmail.com> To: Marcel Moolenaar <marcel@xcllnt.net> Cc: toolchain@freebsd.org, Dmitry Mikulin <dmitrym@juniper.net> Subject: Re: [GDB follow-fork] behavior change for wait() Message-ID: <20120429164300.GR2358@deviant.kiev.zoral.com.ua> In-Reply-To: <7B7A25D1-E99D-486A-B1CA-A5CFEA837B81@xcllnt.net> References: <7B7A25D1-E99D-486A-B1CA-A5CFEA837B81@xcllnt.net>
next in thread | previous in thread | raw e-mail | index | archive | help
--BIyeO76nyr1ZoJNi Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Apr 27, 2012 at 03:33:49PM -0700, Marcel Moolenaar wrote: > Hi Dmitry, >=20 > I've been testing the follow-fork changes in GDB and ran into some weird > behavior. Without gdb, my test program (attached) prints something like: >=20 > fbsdvm% ./fe=20 > fe(41042): initial process. Doing fork & exec... > fe(41043): child after fork. Doing exec... > fe(41043): child after exec. Exiting... > fe(41042): child 41043 exited with status 0 >=20 > In particular: the parent (pid=3D41042) calls wait(2) to reap the child a= nd > the child exits with 0. >=20 > Under gdb, I see this: >=20 > fbsdvm% gdb ./fe > GNU gdb 6.1.1 [FreeBSD] > Copyright 2004 Free Software Foundation, Inc. > GDB is free software, covered by the GNU General Public License, and you = are > welcome to change it and/or distribute copies of it under certain conditi= ons. > Type "show copying" to see the conditions. > There is absolutely no warranty for GDB. Type "show warranty" for detail= s. > This GDB was configured as "i386-marcel-freebsd"... > (gdb) br main > Breakpoint 1 at 0x80487b0: file fe.c, line 14. > (gdb) run > Starting program: /usr/home/marcel/fe=20 >=20 > Breakpoint 1, main (argc=3DError accessing memory address 0x1: Bad addres= s. > ) at fe.c:14 > 14 { > (gdb) n > main (argc=3D1, argv=3D0xbfbfebb4) at fe.c:19 > 19 if (getenv("__FE_FORKED__") !=3D NULL) { > (gdb) c > Continuing. > fe(41141): initial process. Doing fork & exec... > [New process 41143] > fe(41143): child after fork. Doing exec... > fe(41143): child after exec. Exiting... > fe(41141): wait(2) failed with error 10 (No child processes) >=20 > Program exited normally. > (gdb)=20 >=20 > When stepping at least once, the inferior will not be able to properly wa= it(2) > for its child as it seems to have been reaped already. I suspect this is = done > by the debugger -- unintentionally at least. >=20 > Have you seen this before? How old is your kernel ? In particular, do you have r232048+r232104+r232947+r232975+r233808+r233809 ? I cannot reproduce your issue on recent kernels and patched gdb. --BIyeO76nyr1ZoJNi Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (FreeBSD) iEYEARECAAYFAk+db5QACgkQC3+MBN1Mb4j98wCfWt9bOJBEZGjo5E8MD3YxfXxP I0EAn34ENM+jKxWbxhfmzjH2xn/MKDrh =S5ZC -----END PGP SIGNATURE----- --BIyeO76nyr1ZoJNi--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120429164300.GR2358>