diff options
author | Pedro Alves <palves@redhat.com> | 2008-09-22 15:20:08 +0000 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2008-09-22 15:20:08 +0000 |
commit | d6b48e9c8beee5d3ab78ac1979f6af0d6de9ae30 (patch) | |
tree | 00f0c2582c9380ba1d33f42285d1919ef65fa391 /gdb/infrun.c | |
parent | 82f7388440b4dc733616a6a85e9dfd290089e508 (diff) | |
download | gdb-d6b48e9c8beee5d3ab78ac1979f6af0d6de9ae30.zip gdb-d6b48e9c8beee5d3ab78ac1979f6af0d6de9ae30.tar.gz gdb-d6b48e9c8beee5d3ab78ac1979f6af0d6de9ae30.tar.bz2 |
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.
Diffstat (limited to 'gdb/infrun.c')
-rw-r--r-- | gdb/infrun.c | 53 |
1 files changed, 36 insertions, 17 deletions
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; |