From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3494 invoked by alias); 8 Jan 2014 21:21:20 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 3482 invoked by uid 89); 8 Jan 2014 21:21:19 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 08 Jan 2014 21:21:17 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1W10Yr-0007BA-Eq from Thomas_Schwinge@mentor.com ; Wed, 08 Jan 2014 13:21:13 -0800 Received: from SVR-IES-FEM-02.mgc.mentorg.com ([137.202.0.106]) by svr-orw-fem-01.mgc.mentorg.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Wed, 8 Jan 2014 13:21:13 -0800 Received: from feldtkeller.schwinge.homeip.net (137.202.0.76) by SVR-IES-FEM-02.mgc.mentorg.com (137.202.0.106) with Microsoft SMTP Server id 14.2.247.3; Wed, 8 Jan 2014 21:21:11 +0000 From: Thomas Schwinge To: Pedro Alves CC: , Subject: Re: [PATCH] Make STARTUP_WITH_SHELL a runtime toggle -- add new "set/show startup-with-shell" option. In-Reply-To: <52693A01.2000108@redhat.com> References: <1382532024-28890-1-git-send-email-palves@redhat.com> <83ppqwhu98.fsf@gnu.org> <52693A01.2000108@redhat.com> User-Agent: Notmuch/0.9-101-g81dad07 (http://notmuchmail.org) Emacs/23.4.1 (i486-pc-linux-gnu) Date: Wed, 08 Jan 2014 21:21:00 -0000 Message-ID: <8738kyi30l.fsf@kepler.schwinge.homeip.net> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" X-SW-Source: 2014-01/txt/msg00218.txt.bz2 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Content-length: 5830 Hi! On Thu, 24 Oct 2013 16:17:21 +0100, Pedro Alves wrote: > Here's what I pushed ..., and what made the Hurd port pretty unhappy. ;-) > gdb/ > 2013-10-24 Pedro Alves >=20 > * NEWS (New options): Mention set/show startup-with-shell. > * config/alpha/nm-osf3.h (START_INFERIOR_TRAPS_EXPECTED): Set to 2 > instead of 3. > * fork-child.c (fork_inferior, startup_inferior): Handle 'set > startup-with-shell'. > (show_startup_with_shell): New function. > (_initialize_fork_child): Register the set/show startup-with-shell > commands. > * inf-ptrace.c (inf_ptrace_create_inferior): Remove comment. > * inf-ttrace.c (inf_ttrace_him): Remove comment. > * procfs.c (procfs_init_inferior): Remove comment. > * infcmd.c (startup_with_shell): New global. > * inferior.h (startup_with_shell): Declare global. > (STARTUP_WITH_SHELL): Delete. > (START_INFERIOR_TRAPS_EXPECTED): Set to 1 by default instead of 2. > --- a/gdb/fork-child.c > +++ b/gdb/fork-child.c > @@ -419,6 +419,12 @@ startup_inferior (int ntraps) > int terminal_initted =3D 0; > ptid_t resume_ptid; >=20=20 > + if (startup_with_shell) > + { > + /* One trap extra for exec'ing the shell. */ > + pending_execs++; > + } > + > --- a/gdb/inferior.h > +++ b/gdb/inferior.h > @@ -346,25 +365,12 @@ struct displaced_step_closure *get_displaced_step_c= losure_by_addr (CORE_ADDR add > +/* Number of traps that happen between exec'ing the shell to run an > + inferior and when we finally get to the inferior code, not counting > + the exec for the shell. This is 1 on most implementations. > + Overridden in nm.h files. */ > #if !defined(START_INFERIOR_TRAPS_EXPECTED) > -#define START_INFERIOR_TRAPS_EXPECTED 2 > +#define START_INFERIOR_TRAPS_EXPECTED 1 > #endif I'd like to push the following, to get the Hurd port functional again. In the thread around , and , we had already (very) briefly been discussing gnu-nat's local pending_execs handling. Is the new approach that I'm posting below (flag instead of counting; saves us from repeating in gnu_create_inferior the increment in the startup_with_shell case) OK until we get a clear understanding if and how we can get rid of it for good? Or should indeed the current value of fork-child.c:startup_inferior's pending_execs be made available, say by moving that variable into inferior.h:struct inferior, and using that in gnu-nat.c instead of gnu-nat.c:struct inf's local pending_execs "replica"? (But apparently there are no other users of this.) commit 57c9fb3afadab5813d7463dc2393d5affe78849e Author: Thomas Schwinge Date: Wed Jan 8 21:42:07 2014 +0100 Hurd: Adjust to startup-with-shell changes. =20=20=20=20 In commit 98882a26513e25b2161b41dfd4bed97b59b2c01a, STARTUP_WITH_SHELL = was made a runtime toggle, startup-with-shell. The Hurd code not adjusted, whic= h had a value hard-coded instead of using START_INFERIOR_TRAPS_EXPECTED. Fix t= hat, and also simplify gnu-nat's pending_execs handling from counting to just a = flag. =20=20=20=20 gdb/ * gnu-nat.c (struct inf): Change pending_execs member to a 1-bit flag. Adjust all users; in particular... (gnu_wait): ..., don't decrement its value in here... (gnu_create_inferior): ..., and instead set the flag in here, around the startup_inferior call, and call that one with START_INFERIOR_TRAPS_EXPECTED. diff --git gdb/gnu-nat.c gdb/gnu-nat.c index 26db81a..5538af5 100644 --- gdb/gnu-nat.c +++ gdb/gnu-nat.c @@ -210,9 +210,9 @@ struct inf unsigned int no_wait:1; =20 /* When starting a new inferior, we don't try to validate threads unti= l all - the proper execs have been done. This is a count of how many execs= we + the proper execs have been done, which this flag states we still expect to happen. */ - unsigned pending_execs; + unsigned int pending_execs:1; =20 /* Fields describing global state. */ =20 @@ -1568,26 +1568,14 @@ rewait: while execing. */ { w->suppress =3D 1; - inf_debug (inf, "pending_execs =3D %d, ignoring minor event", - inf->pending_execs); + inf_debug (inf, "pending_execs, ignoring minor event"); } else if (kind =3D=3D TARGET_WAITKIND_STOPPED && w->status.value.sig =3D=3D GDB_SIGNAL_TRAP) /* Ah hah! A SIGTRAP from the inferior while starting up probably means we've succesfully completed an exec! */ { - if (--inf->pending_execs =3D=3D 0) - /* We're done! */ - { -#if 0 /* do we need this? */ - prune_threads (1); /* Get rid of the old shell - threads. */ - renumber_threads (0); /* Give our threads reasonable - names. */ -#endif - } - inf_debug (inf, "pending exec completed, pending_execs =3D> %d", - inf->pending_execs); + inf_debug (inf, "one pending exec completed"); } else if (kind =3D=3D TARGET_WAITKIND_STOPPED) /* It's possible that this signal is because of a crashed process @@ -2146,7 +2134,7 @@ gnu_create_inferior (struct target_ops *ops, =20 push_target (ops); =20 - inf->pending_execs =3D 2; + inf->pending_execs =3D 1; inf->nomsg =3D 1; inf->traced =3D 1; =20 @@ -2158,7 +2146,8 @@ gnu_create_inferior (struct target_ops *ops, thread_change_ptid (inferior_ptid, ptid_build (inf->pid, inf_pick_first_thread (), 0)); =20 - startup_inferior (inf->pending_execs); + startup_inferior (START_INFERIOR_TRAPS_EXPECTED); + inf->pending_execs =3D 0; =20 inf_validate_procinfo (inf); inf_update_signal_thread (inf); Gr=C3=BC=C3=9Fe, Thomas --=-=-= Content-Type: application/pgp-signature Content-length: 489 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.15 (GNU/Linux) iQEcBAEBAgAGBQJSzcE6AAoJEGe3hdm9kOiiWlEH/2IsVDPDr2KBgtEXbp73dirK O8PDY4BOW5whUuF6YTVKowHx9jDwcEQeLe7Ekzgsez7aCrKgcKTuIjqn6HgGljI3 LrG6TFRYgTXUg/K9mx6TB76jWugBTFawcSiJ5q1nmZGkFiCupgxRARUgSIyDsdy+ NyKan1lt2q537hBGNzZvXbHLVttDLk5Bqk6U/kmmpIEzlUUmu2jK7xOBOj9D0gpK 1VKGfnKnBH5UmLPJZ+HeHT/RjO5ZWyYGmU17geUnOtfWbWqqc00XmCN1+eFekcrR MVw4yIfciWbP2knsOqFhv93wNWlmAXM/59Ie3lqhalCNwN6chgWeJcqndLh6ZT0= =xVk2 -----END PGP SIGNATURE----- --=-=-=--