* infcmd.c (attach_command_post_wait): Adjust.
(attach_command): Likewise.
* inferior.h (stop_soon): Delete.
(struct inferior): Add stop_soon member.
* infrun.c (stop_soon): Delete.
(clear_proceed_status, start_remote)
(fetch_inferior_event, handle_inferior_event): Adjust.
(signal_stop_state): Don't check stop_soon here. Check in callers
instead.
(save_inferior_status, restore_inferior_status): Adjust.
* linux-nat.c (linux_nat_resume, linux_nat_wait): Always pass
signals to common code if starting up the inferior.
* inferior.h (struct inferior_info): Added stop_soon member.
* inferior.c (add_inferior) Clear stop_soon.
* mips-tdep.c (heuristic_proc_start): Adjust.
* nto-procfs.c (procfs_create_inferior): Adjust.
* solib-irix.c (irix_solib_create_inferior_hook): Adjust.
* solib-osf.c (osf_solib_create_inferior_hook): Adjust.
* solib-sunos.c (sunos_solib_create_inferior_hook): Adjust.
* solib-svr4.c (svr4_solib_create_inferior_hook): Adjust.
* win32-nat.c (do_initial_win32_stuff): Adjust.
* alpha-tdep.c (alpha_heuristic_proc_start): Adjust.
+2008-09-22 Pedro Alves <pedro@codesourcery.com>
+
+ Make the stop_soon global be per-inferior instead.
+
+ * infcmd.c (attach_command_post_wait): Adjust.
+ (attach_command): Likewise.
+
+ * inferior.h (stop_soon): Delete.
+ (struct inferior): Add stop_soon member.
+
+ * infrun.c (stop_soon): Delete.
+ (clear_proceed_status, start_remote)
+ (fetch_inferior_event, handle_inferior_event): Adjust.
+ (signal_stop_state): Don't check stop_soon here. Check in callers
+ instead.
+ (save_inferior_status, restore_inferior_status): Adjust.
+
+ * linux-nat.c (linux_nat_resume, linux_nat_wait): Always pass
+ signals to common code if starting up the inferior.
+
+ * inferior.h (struct inferior_info): Added stop_soon member.
+ * inferior.c (add_inferior) Clear stop_soon.
+
+ * mips-tdep.c (heuristic_proc_start): Adjust.
+ * nto-procfs.c (procfs_create_inferior): Adjust.
+ * solib-irix.c (irix_solib_create_inferior_hook): Adjust.
+ * solib-osf.c (osf_solib_create_inferior_hook): Adjust.
+ * solib-sunos.c (sunos_solib_create_inferior_hook): Adjust.
+ * solib-svr4.c (svr4_solib_create_inferior_hook): Adjust.
+
+ * win32-nat.c (do_initial_win32_stuff): Adjust.
+
+ * alpha-tdep.c (alpha_heuristic_proc_start): Adjust.
+
2008-09-22 Pedro Alves <pedro@codesourcery.com>
Implement remote multi-process extensions.
CORE_ADDR fence = pc - heuristic_fence_post;
CORE_ADDR orig_pc = pc;
CORE_ADDR func;
+ struct inferior *inf;
if (pc == 0)
return 0;
}
}
+ inf = current_inferior ();
+
/* It's not clear to me why we reach this point when stopping quietly,
but with this test, at least we don't print out warnings for every
child forked (eg, on decstation). 22apr93 rich@cygnus.com. */
- if (stop_soon == NO_STOP_QUIETLY)
+ if (inf->stop_soon == NO_STOP_QUIETLY)
{
static int blurb_printed = 0;
{
char *exec_file;
char *full_exec_path = NULL;
+ struct inferior *inferior;
- stop_soon = NO_STOP_QUIETLY;
+ inferior = current_inferior ();
+ inferior->stop_soon = NO_STOP_QUIETLY;
/* If no exec file is yet known, try to determine it from the
process itself. */
E.g. Mach 3 or GNU hurd. */
if (!target_attach_no_wait)
{
+ struct inferior *inferior = current_inferior ();
+
/* Careful here. See comments in inferior.h. Basically some
OSes don't ignore SIGSTOPs on continue requests anymore. We
need a way for handle_inferior_event to reset the stop_signal
variable after an attach, and this is what
STOP_QUIETLY_NO_SIGSTOP is for. */
- stop_soon = STOP_QUIETLY_NO_SIGSTOP;
+ inferior->stop_soon = STOP_QUIETLY_NO_SIGSTOP;
if (target_can_async_p ())
{
memset (inf, 0, sizeof (*inf));
inf->pid = pid;
+ inf->stop_soon = NO_STOP_QUIETLY;
+
inf->num = ++highest_inferior_num;
inf->next = inferior_list;
inferior_list = inf;
STOP_QUIETLY_NO_SIGSTOP
};
-extern enum stop_kind stop_soon;
-
/* Nonzero if proceed is being used for a "finish" command or a similar
situation when stop_registers should be saved. */
the ptid_t.pid member of threads of this inferior. */
int pid;
+ /* See the definition of stop_kind above. */
+ enum stop_kind stop_soon;
+
/* Private data used by the target vector implementation. */
struct private_inferior *private;
};
int stop_after_trap;
-/* Nonzero means expecting a trap and caller will handle it themselves.
- It is used after attach, due to attaching to a process;
- when running in the shell before the child program has been exec'd;
- and when running some kinds of remote stuff (FIXME?). */
-
-enum stop_kind stop_soon;
-
/* Save register contents here when about to pop a stack dummy frame,
if-and-only-if proceed_to_finish is set.
Thus this contains the return value from the called function (assuming
{
if (!ptid_equal (inferior_ptid, null_ptid))
{
- struct thread_info *tp = inferior_thread ();
+ struct thread_info *tp;
+ struct inferior *inferior;
+
+ tp = inferior_thread ();
tp->trap_expected = 0;
tp->step_range_start = 0;
/* Discard any remaining commands or status from previous
stop. */
bpstat_clear (&tp->stop_bpstat);
+
+ inferior = current_inferior ();
+ inferior->stop_soon = NO_STOP_QUIETLY;
}
stop_after_trap = 0;
- stop_soon = NO_STOP_QUIETLY;
breakpoint_proceeded = 1; /* We're about to proceed... */
if (stop_registers)
void
start_remote (int from_tty)
{
+ struct inferior *inferior;
init_wait_for_inferior ();
- stop_soon = STOP_QUIETLY_REMOTE;
+
+ inferior = current_inferior ();
+ inferior->stop_soon = STOP_QUIETLY_REMOTE;
/* Always go on waiting for the target, regardless of the mode. */
/* FIXME: cagney/1999-09-23: At present it isn't possible to
if (!ecs->wait_some_more)
{
+ struct inferior *inf = find_inferior_pid (ptid_get_pid (ecs->ptid));
+
delete_step_thread_step_resume_breakpoint ();
- if (stop_soon == NO_STOP_QUIETLY)
+ /* We may not find an inferior if this was a process exit. */
+ if (inf == NULL || inf->stop_soon == NO_STOP_QUIETLY)
normal_stop ();
if (target_has_execution
int stopped_by_watchpoint;
int stepped_after_stopped_by_watchpoint = 0;
struct symtab_and_line stop_pc_sal;
+ enum stop_kind stop_soon;
+
+ if (ecs->ws.kind != TARGET_WAITKIND_EXITED
+ && ecs->ws.kind != TARGET_WAITKIND_SIGNALLED
+ && ecs->ws.kind != TARGET_WAITKIND_IGNORE)
+ {
+ struct inferior *inf = find_inferior_pid (ptid_get_pid (ecs->ptid));
+ gdb_assert (inf);
+ stop_soon = inf->stop_soon;
+ }
+ else
+ stop_soon = NO_STOP_QUIETLY;
breakpoint_retire_moribund ();
target_terminal_ours_for_output ();
print_stop_reason (SIGNAL_RECEIVED, ecs->event_thread->stop_signal);
}
- if (signal_stop_state (ecs->event_thread->stop_signal))
+ /* Always stop on signals if we're just gaining control of the
+ program. */
+ if (stop_soon != NO_STOP_QUIETLY
+ || signal_stop_state (ecs->event_thread->stop_signal))
{
stop_stepping (ecs);
return;
int
signal_stop_state (int signo)
{
- /* Always stop on signals if we're just gaining control of the
- program. */
- return signal_stop[signo] || stop_soon != NO_STOP_QUIETLY;
+ return signal_stop[signo];
}
int
{
struct inferior_status *inf_status = XMALLOC (struct inferior_status);
struct thread_info *tp = inferior_thread ();
+ struct inferior *inf = current_inferior ();
inf_status->stop_signal = tp->stop_signal;
inf_status->stop_pc = stop_pc;
inf_status->step_frame_id = tp->step_frame_id;
inf_status->step_over_calls = tp->step_over_calls;
inf_status->stop_after_trap = stop_after_trap;
- inf_status->stop_soon = stop_soon;
+ inf_status->stop_soon = inf->stop_soon;
/* Save original bpstat chain here; replace it with copy of chain.
If caller's caller is walking the chain, they'll be happier if we
hand them back the original chain when restore_inferior_status is
restore_inferior_status (struct inferior_status *inf_status)
{
struct thread_info *tp = inferior_thread ();
+ struct inferior *inf = current_inferior ();
tp->stop_signal = inf_status->stop_signal;
stop_pc = inf_status->stop_pc;
tp->step_frame_id = inf_status->step_frame_id;
tp->step_over_calls = inf_status->step_over_calls;
stop_after_trap = inf_status->stop_after_trap;
- stop_soon = inf_status->stop_soon;
+ inf->stop_soon = inf_status->stop_soon;
bpstat_clear (&tp->stop_bpstat);
tp->stop_bpstat = inf_status->stop_bpstat;
breakpoint_proceeded = inf_status->breakpoint_proceeded;
if (lp->status && WIFSTOPPED (lp->status))
{
- int saved_signo = target_signal_from_host (WSTOPSIG (lp->status));
+ int saved_signo;
+ struct inferior *inf;
- if (signal_stop_state (saved_signo) == 0
+ inf = find_inferior_pid (ptid_get_pid (ptid));
+ gdb_assert (inf);
+ saved_signo = target_signal_from_host (WSTOPSIG (lp->status));
+
+ /* Defer to common code if we're gaining control of the
+ inferior. */
+ if (inf->stop_soon == NO_STOP_QUIETLY
+ && signal_stop_state (saved_signo) == 0
&& signal_print_state (saved_signo) == 0
&& signal_pass_state (saved_signo) == 1)
{
if (WIFSTOPPED (status))
{
int signo = target_signal_from_host (WSTOPSIG (status));
+ struct inferior *inf;
+
+ inf = find_inferior_pid (ptid_get_pid (lp->ptid));
+ gdb_assert (inf);
- /* If we get a signal while single-stepping, we may need special
- care, e.g. to skip the signal handler. Defer to common code. */
+ /* Defer to common code if we get a signal while
+ single-stepping, since that may need special care, e.g. to
+ skip the signal handler, or, if we're gaining control of the
+ inferior. */
if (!lp->step
+ && inf->stop_soon == NO_STOP_QUIETLY
&& signal_stop_state (signo) == 0
&& signal_print_state (signo) == 0
&& signal_pass_state (signo) == 1)
CORE_ADDR fence;
int instlen;
int seen_adjsp = 0;
+ struct inferior *inf;
pc = gdbarch_addr_bits_remove (gdbarch, pc);
start_pc = pc;
instlen = mips_pc_is_mips16 (pc) ? MIPS_INSN16_SIZE : MIPS_INSN32_SIZE;
+ inf = current_inferior ();
+
/* search back for previous return */
for (start_pc -= instlen;; start_pc -= instlen)
if (start_pc < fence)
stop_soon, but with this test, at least we
don't print out warnings for every child forked (eg, on
decstation). 22apr93 rich@cygnus.com. */
- if (stop_soon == NO_STOP_QUIETLY)
+ if (inf->stop_soon == NO_STOP_QUIETLY)
{
static int blurb_printed = 0;
if (exec_bfd != NULL
|| (symfile_objfile != NULL && symfile_objfile->obfd != NULL))
solib_create_inferior_hook ();
- stop_soon = 0;
}
static void
static void
irix_solib_create_inferior_hook (void)
{
+ struct inferior *inf;
struct thread_info *tp;
if (!enable_break ())
can go groveling around in the dynamic linker structures to find
out what we need to know about them. */
+ inf = current_inferior ();
tp = inferior_thread ();
+
clear_proceed_status ();
- stop_soon = STOP_QUIETLY;
+
+ inf->stop_soon = STOP_QUIETLY;
tp->stop_signal = TARGET_SIGNAL_0;
+
do
{
target_resume (pid_to_ptid (-1), 0, tp->stop_signal);
Delaying the resetting of stop_soon until after symbol loading
suppresses the warning. */
solib_add ((char *) 0, 0, (struct target_ops *) 0, auto_solib_add);
- stop_soon = NO_STOP_QUIETLY;
+ inf->stop_soon = NO_STOP_QUIETLY;
}
/* LOCAL FUNCTION
static void
osf_solib_create_inferior_hook (void)
{
+ struct inferior *inf;
struct thread_info *tp;
/* If we are attaching to the inferior, the shared libraries
if (!target_can_run (¤t_target))
return;
+ inf = current_inferior ();
tp = inferior_thread ();
clear_proceed_status ();
- stop_soon = STOP_QUIETLY;
+ inf->stop_soon = STOP_QUIETLY;
tp->stop_signal = TARGET_SIGNAL_0;
do
{
Delaying the resetting of stop_soon until after symbol loading
suppresses the warning. */
solib_add ((char *) 0, 0, (struct target_ops *) 0, auto_solib_add);
- stop_soon = NO_STOP_QUIETLY;
+ inf->stop_soon = NO_STOP_QUIETLY;
}
/* target_so_ops callback. Do additional symbol handling, lookup, etc. after
sunos_solib_create_inferior_hook (void)
{
struct thread_info *tp;
+ struct inferior *inf;
if ((debug_base = locate_base ()) == 0)
{
can go groveling around in the dynamic linker structures to find
out what we need to know about them. */
+ inf = current_inferior ();
tp = inferior_thread ();
+
clear_proceed_status ();
- stop_soon = STOP_QUIETLY;
+
+ inf->stop_soon = STOP_QUIETLY;
tp->stop_signal = TARGET_SIGNAL_0;
do
{
wait_for_inferior (0);
}
while (tp->stop_signal != TARGET_SIGNAL_TRAP);
- stop_soon = NO_STOP_QUIETLY;
+ inf->stop_soon = NO_STOP_QUIETLY;
/* We are now either at the "mapping complete" breakpoint (or somewhere
else, a condition we aren't prepared to deal with anyway), so adjust
static void
svr4_solib_create_inferior_hook (void)
{
+ struct inferior *inf;
struct thread_info *tp;
/* Relocate the main executable if necessary. */
can go groveling around in the dynamic linker structures to find
out what we need to know about them. */
+ inf = current_inferior ();
tp = inferior_thread ();
clear_proceed_status ();
- stop_soon = STOP_QUIETLY;
+ inf->stop_soon = STOP_QUIETLY;
tp->stop_signal = TARGET_SIGNAL_0;
do
{
wait_for_inferior (0);
}
while (tp->stop_signal != TARGET_SIGNAL_TRAP);
- stop_soon = NO_STOP_QUIETLY;
+ inf->stop_soon = NO_STOP_QUIETLY;
#endif /* defined(_SCO_DS) */
}
{
extern int stop_after_trap;
int i;
+ struct inferior *inf;
struct thread_info *tp;
last_sig = TARGET_SIGNAL_0;
clear_proceed_status ();
init_wait_for_inferior ();
- add_inferior (pid);
+ inf = add_inferior (pid);
terminal_init_inferior_with_pgrp (pid);
target_terminal_inferior ();
- stop_soon = STOP_QUIETLY;
+ inf->stop_soon = STOP_QUIETLY;
while (1)
{
stop_after_trap = 1;
break;
}
- stop_soon = NO_STOP_QUIETLY;
+ inf->stop_soon = NO_STOP_QUIETLY;
stop_after_trap = 0;
return;
}
{
extern int stop_after_trap;
int i;
+ struct inferior *inf;
struct thread_info *tp;
last_sig = TARGET_SIGNAL_0;
clear_proceed_status ();
init_wait_for_inferior ();
- add_inferior (pid);
+ inf = add_inferior (pid);
terminal_init_inferior_with_pgrp (pid);
target_terminal_inferior ();
- stop_soon = STOP_QUIETLY;
+ inf->stop_soon = STOP_QUIETLY;
while (1)
{
stop_after_trap = 1;
break;
}
- stop_soon = NO_STOP_QUIETLY;
+ inf->stop_soon = NO_STOP_QUIETLY;
stop_after_trap = 0;
return;
}