From c82f56d9d760a9b4034eeaac44f2f0fa5779ff69 Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Wed, 8 Jan 2014 21:42:07 +0100 Subject: [PATCH] Hurd: Adjust to startup-with-shell changes. In commit 98882a26513e25b2161b41dfd4bed97b59b2c01a, STARTUP_WITH_SHELL was made a runtime toggle, startup-with-shell. The Hurd code was missed to be adjusted; it had a value hard-coded instead of using START_INFERIOR_TRAPS_EXPECTED. Fix that, and also simplify gnu-nat's pending_execs handling from counting to just a flag. 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. --- gdb/ChangeLog | 7 +++++++ gdb/gnu-nat.c | 25 +++++++------------------ 2 files changed, 14 insertions(+), 18 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 2cf8a1554a0..88e0e9e7861 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,12 @@ 2014-02-16 Thomas Schwinge + * 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. + * gnu-nat.c (ill_rpc): Remove function; replaced with this... (ILL_RPC): ... new macro. (do_mach_notify_no_senders, do_mach_notify_port_deleted) diff --git a/gdb/gnu-nat.c b/gdb/gnu-nat.c index a3ed0e07a6d..b66a7f09aaa 100644 --- a/gdb/gnu-nat.c +++ b/gdb/gnu-nat.c @@ -210,9 +210,9 @@ struct inf unsigned int no_wait:1; /* When starting a new inferior, we don't try to validate threads until 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; /* Fields describing global state. */ @@ -1568,26 +1568,14 @@ rewait: while execing. */ { w->suppress = 1; - inf_debug (inf, "pending_execs = %d, ignoring minor event", - inf->pending_execs); + inf_debug (inf, "pending_execs, ignoring minor event"); } else if (kind == TARGET_WAITKIND_STOPPED && w->status.value.sig == 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 == 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 => %d", - inf->pending_execs); + inf_debug (inf, "one pending exec completed"); } else if (kind == 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, push_target (ops); - inf->pending_execs = 2; + inf->pending_execs = 1; inf->nomsg = 1; inf->traced = 1; @@ -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)); - startup_inferior (inf->pending_execs); + startup_inferior (START_INFERIOR_TRAPS_EXPECTED); + inf->pending_execs = 0; inf_validate_procinfo (inf); inf_update_signal_thread (inf); -- 2.30.2