diff options
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 34 | ||||
-rw-r--r-- | gdb/alpha-tdep.c | 5 | ||||
-rw-r--r-- | gdb/infcmd.c | 8 | ||||
-rw-r--r-- | gdb/inferior.c | 2 | ||||
-rw-r--r-- | gdb/inferior.h | 5 | ||||
-rw-r--r-- | gdb/infrun.c | 53 | ||||
-rw-r--r-- | gdb/linux-nat.c | 23 | ||||
-rw-r--r-- | gdb/mips-tdep.c | 5 | ||||
-rw-r--r-- | gdb/nto-procfs.c | 1 | ||||
-rw-r--r-- | gdb/solib-irix.c | 9 | ||||
-rw-r--r-- | gdb/solib-osf.c | 6 | ||||
-rw-r--r-- | gdb/solib-sunos.c | 8 | ||||
-rw-r--r-- | gdb/solib-svr4.c | 6 | ||||
-rw-r--r-- | gdb/win32-nat.c | 7 | ||||
-rw-r--r-- | gdb/windows-nat.c | 7 |
15 files changed, 137 insertions, 42 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index b508f67..753757d 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,39 @@ 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. * remote.c (struct remote_state): Add extended and diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c index 27137d9..ede74c5 100644 --- a/gdb/alpha-tdep.c +++ b/gdb/alpha-tdep.c @@ -909,6 +909,7 @@ alpha_heuristic_proc_start (struct gdbarch *gdbarch, CORE_ADDR pc) CORE_ADDR fence = pc - heuristic_fence_post; CORE_ADDR orig_pc = pc; CORE_ADDR func; + struct inferior *inf; if (pc == 0) return 0; @@ -946,10 +947,12 @@ alpha_heuristic_proc_start (struct gdbarch *gdbarch, CORE_ADDR pc) } } + 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; diff --git a/gdb/infcmd.c b/gdb/infcmd.c index 6ffc97f..6ed6341 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -1956,8 +1956,10 @@ attach_command_post_wait (char *args, int from_tty, int async_exec) { 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. */ @@ -2087,12 +2089,14 @@ attach_command (char *args, int from_tty) 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 ()) { diff --git a/gdb/inferior.c b/gdb/inferior.c index 128e8fc..4233a51 100644 --- a/gdb/inferior.c +++ b/gdb/inferior.c @@ -76,6 +76,8 @@ add_inferior_silent (int pid) 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; diff --git a/gdb/inferior.h b/gdb/inferior.h index 51bee34..66e7d47 100644 --- a/gdb/inferior.h +++ b/gdb/inferior.h @@ -339,8 +339,6 @@ enum stop_kind 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. */ @@ -423,6 +421,9 @@ struct inferior 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; }; diff --git a/gdb/infrun.c b/gdb/infrun.c index c7fdd61..93487e3 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -230,13 +230,6 @@ show_stop_on_solib_events (struct ui_file *file, int from_tty, 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 @@ -1097,7 +1090,10 @@ clear_proceed_status (void) { 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; @@ -1112,10 +1108,12 @@ clear_proceed_status (void) /* 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) @@ -1351,8 +1349,11 @@ proceed (CORE_ADDR addr, enum target_signal siggnal, int step) 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 @@ -1648,9 +1649,12 @@ fetch_inferior_event (void *client_data) 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 @@ -1840,6 +1844,18 @@ handle_inferior_event (struct execution_control_state *ecs) 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 (); @@ -2673,7 +2689,10 @@ process_event_stop_test: 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; @@ -3972,9 +3991,7 @@ hook_stop_stub (void *cmd) 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 @@ -4376,6 +4393,7 @@ save_inferior_status (int restore_stack_info) { 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; @@ -4388,7 +4406,7 @@ save_inferior_status (int restore_stack_info) 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 @@ -4430,6 +4448,7 @@ void 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; @@ -4442,7 +4461,7 @@ restore_inferior_status (struct inferior_status *inf_status) 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; diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c index c1cb563..5ff4bce 100644 --- a/gdb/linux-nat.c +++ b/gdb/linux-nat.c @@ -1708,9 +1708,17 @@ linux_nat_resume (ptid_t ptid, int step, enum target_signal signo) 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) { @@ -2926,10 +2934,17 @@ retry: 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) diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index 1cc3448..2556e0e 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -2493,6 +2493,7 @@ heuristic_proc_start (struct gdbarch *gdbarch, CORE_ADDR pc) CORE_ADDR fence; int instlen; int seen_adjsp = 0; + struct inferior *inf; pc = gdbarch_addr_bits_remove (gdbarch, pc); start_pc = pc; @@ -2505,6 +2506,8 @@ heuristic_proc_start (struct gdbarch *gdbarch, CORE_ADDR 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) @@ -2513,7 +2516,7 @@ heuristic_proc_start (struct gdbarch *gdbarch, CORE_ADDR pc) 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; diff --git a/gdb/nto-procfs.c b/gdb/nto-procfs.c index 9e569c5..130eb95 100644 --- a/gdb/nto-procfs.c +++ b/gdb/nto-procfs.c @@ -1101,7 +1101,6 @@ procfs_create_inferior (char *exec_file, char *allargs, char **env, if (exec_bfd != NULL || (symfile_objfile != NULL && symfile_objfile->obfd != NULL)) solib_create_inferior_hook (); - stop_soon = 0; } static void diff --git a/gdb/solib-irix.c b/gdb/solib-irix.c index 5b612ec..49bd200 100644 --- a/gdb/solib-irix.c +++ b/gdb/solib-irix.c @@ -422,6 +422,7 @@ enable_break (void) static void irix_solib_create_inferior_hook (void) { + struct inferior *inf; struct thread_info *tp; if (!enable_break ()) @@ -435,10 +436,14 @@ irix_solib_create_inferior_hook (void) 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); @@ -463,7 +468,7 @@ irix_solib_create_inferior_hook (void) 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 diff --git a/gdb/solib-osf.c b/gdb/solib-osf.c index b83a8ec..031d598 100644 --- a/gdb/solib-osf.c +++ b/gdb/solib-osf.c @@ -307,6 +307,7 @@ osf_clear_solib (void) 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 @@ -333,9 +334,10 @@ osf_solib_create_inferior_hook (void) 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 { @@ -351,7 +353,7 @@ osf_solib_create_inferior_hook (void) 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 diff --git a/gdb/solib-sunos.c b/gdb/solib-sunos.c index c83b057..e18d9a5 100644 --- a/gdb/solib-sunos.c +++ b/gdb/solib-sunos.c @@ -739,6 +739,7 @@ static void sunos_solib_create_inferior_hook (void) { struct thread_info *tp; + struct inferior *inf; if ((debug_base = locate_base ()) == 0) { @@ -761,9 +762,12 @@ sunos_solib_create_inferior_hook (void) 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 { @@ -771,7 +775,7 @@ sunos_solib_create_inferior_hook (void) 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 diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c index 3ba22ac..250f87d 100644 --- a/gdb/solib-svr4.c +++ b/gdb/solib-svr4.c @@ -1570,6 +1570,7 @@ svr4_relocate_main_executable (void) static void svr4_solib_create_inferior_hook (void) { + struct inferior *inf; struct thread_info *tp; /* Relocate the main executable if necessary. */ @@ -1591,10 +1592,11 @@ svr4_solib_create_inferior_hook (void) 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 { @@ -1602,7 +1604,7 @@ svr4_solib_create_inferior_hook (void) 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) */ } diff --git a/gdb/win32-nat.c b/gdb/win32-nat.c index becd3ca..8365cba 100644 --- a/gdb/win32-nat.c +++ b/gdb/win32-nat.c @@ -1523,6 +1523,7 @@ do_initial_win32_stuff (DWORD pid) { extern int stop_after_trap; int i; + struct inferior *inf; struct thread_info *tp; last_sig = TARGET_SIGNAL_0; @@ -1544,12 +1545,12 @@ do_initial_win32_stuff (DWORD pid) 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; @@ -1561,7 +1562,7 @@ do_initial_win32_stuff (DWORD pid) break; } - stop_soon = NO_STOP_QUIETLY; + inf->stop_soon = NO_STOP_QUIETLY; stop_after_trap = 0; return; } diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c index becd3ca..8365cba 100644 --- a/gdb/windows-nat.c +++ b/gdb/windows-nat.c @@ -1523,6 +1523,7 @@ do_initial_win32_stuff (DWORD pid) { extern int stop_after_trap; int i; + struct inferior *inf; struct thread_info *tp; last_sig = TARGET_SIGNAL_0; @@ -1544,12 +1545,12 @@ do_initial_win32_stuff (DWORD pid) 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; @@ -1561,7 +1562,7 @@ do_initial_win32_stuff (DWORD pid) break; } - stop_soon = NO_STOP_QUIETLY; + inf->stop_soon = NO_STOP_QUIETLY; stop_after_trap = 0; return; } |