From d3fd534293b3e22ff1aac0e141bb22e99fbbe3c2 Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Tue, 4 Nov 2008 20:52:24 +0000 Subject: [PATCH] * inf-loop.c (inferior_event_handler): On INF_ERROR and INF_REG_EVENT throwing, don't call target_async or pop_target. Call pop_all_targets_above. * remote.c (remote_close): Call remote_terminal_ours. Don't call signal or target_async. --- gdb/ChangeLog | 8 ++++++++ gdb/inf-loop.c | 6 ++---- gdb/remote.c | 21 ++++++++++----------- 3 files changed, 20 insertions(+), 15 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 45bbb122ecc..ea9c1d8ac82 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,11 @@ +2008-11-04 Pedro Alves + + * inf-loop.c (inferior_event_handler): On INF_ERROR and + INF_REG_EVENT throwing, don't call target_async or pop_target. + Call pop_all_targets_above. + * remote.c (remote_close): Call remote_terminal_ours. Don't call + signal or target_async. + 2008-11-04 Daniel Jacobowitz * eval.c (evaluate_subexp_standard): Assert that there is at diff --git a/gdb/inf-loop.c b/gdb/inf-loop.c index 8c2c282e18b..2e0f4d26770 100644 --- a/gdb/inf-loop.c +++ b/gdb/inf-loop.c @@ -50,8 +50,7 @@ inferior_event_handler (enum inferior_event_type event_type, { case INF_ERROR: printf_unfiltered (_("error detected from target.\n")); - target_async (NULL, 0); - pop_target (); + pop_all_targets_above (file_stratum, 0); discard_all_intermediate_continuations (); discard_all_continuations (); async_enable_stdin (); @@ -65,8 +64,7 @@ inferior_event_handler (enum inferior_event_type event_type, if (!catch_errors (fetch_inferior_event_wrapper, client_data, "", RETURN_MASK_ALL)) { - target_async (NULL, 0); - pop_target (); + pop_all_targets_above (file_stratum, 0); discard_all_intermediate_continuations (); discard_all_continuations (); async_enable_stdin (); diff --git a/gdb/remote.c b/gdb/remote.c index a5589f63215..f4d6c1f48cd 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -232,6 +232,8 @@ static int peek_stop_reply (ptid_t ptid); static void remote_async_inferior_event_handler (gdb_client_data); static void remote_async_get_pending_events_handler (gdb_client_data); +static void remote_terminal_ours (void); + /* The non-stop remote protocol provisions for one pending stop reply. This is where we keep it until it is acknowledged. */ @@ -2287,18 +2289,15 @@ extended_remote_restart (void) static void remote_close (int quitting) { - if (remote_desc) - { - /* Unregister the file descriptor from the event loop. */ - if (target_is_async_p ()) - target_async (NULL, 0); - serial_close (remote_desc); - remote_desc = NULL; - } + if (remote_desc == NULL) + return; /* already closed */ - /* Make sure we don't leave the async SIGINT signal handler - installed. */ - signal (SIGINT, handle_sigint); + /* Make sure we leave stdin registered in the event loop, and we + don't leave the async SIGINT signal handler installed. */ + remote_terminal_ours (); + + serial_close (remote_desc); + remote_desc = NULL; /* We don't have a connection to the remote stub anymore. Get rid of all the inferiors and their threads we were controlling. */ -- 2.30.2