aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorYao Qi <yao@codesourcery.com>2012-12-15 03:34:03 +0000
committerYao Qi <yao@codesourcery.com>2012-12-15 03:34:03 +0000
commit5f4cf0bb27e5c49c5581c104e24770bde830af85 (patch)
treec3357addb7763569525c244e0f0c457d694afff0 /gdb
parentfee9eda9eed2792c380d3dca8b5fd4c7ee1d0c32 (diff)
downloadbinutils-5f4cf0bb27e5c49c5581c104e24770bde830af85.zip
binutils-5f4cf0bb27e5c49c5581c104e24770bde830af85.tar.gz
binutils-5f4cf0bb27e5c49c5581c104e24770bde830af85.tar.bz2
gdb/
2012-12-15 Yao Qi <yao@codesourcery.com> * remote.c (discard_pending_stop_replies): Update declaration. (remote_detach_1, extended_remote_mourn_1): Likewise. (discard_pending_stop_replies): Change parameter from PID to INF. (remote_close): Update caller. (_initialize_remote): Attach discard_pending_stop_replies to inferior_exit observer.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog10
-rw-r--r--gdb/remote.c28
2 files changed, 25 insertions, 13 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 6c6c205..cd28232 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,15 @@
2012-12-15 Yao Qi <yao@codesourcery.com>
+ * remote.c (discard_pending_stop_replies): Update declaration.
+ (remote_detach_1, extended_remote_mourn_1): Likewise.
+ (discard_pending_stop_replies): Change parameter from PID to
+ INF.
+ (remote_close): Update caller.
+ (_initialize_remote): Attach discard_pending_stop_replies to
+ inferior_exit observer.
+
+2012-12-15 Yao Qi <yao@codesourcery.com>
+
* remote.c (getpkt_or_notif_sane): Add one more argument in
its declaration.
(getpkt_or_notif_sane_1): Add one more argument.
diff --git a/gdb/remote.c b/gdb/remote.c
index 0a83944..3f44367 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -229,7 +229,7 @@ static void do_stop_reply_xfree (void *arg);
static void remote_parse_stop_reply (char *buf, struct stop_reply *);
static void push_stop_reply (struct stop_reply *);
static void remote_get_pending_stop_replies (void);
-static void discard_pending_stop_replies (int pid);
+static void discard_pending_stop_replies (struct inferior *);
static int peek_stop_reply (ptid_t ptid);
static void remote_async_inferior_event_handler (gdb_client_data);
@@ -3022,8 +3022,11 @@ remote_close (int quitting)
inferior_ptid = null_ptid;
discard_all_inferiors ();
- /* We're no longer interested in any of these events. */
- discard_pending_stop_replies (-1);
+ /* Stop replies may from inferiors which are still unknown to GDB.
+ We are closing the remote target, so we should discard
+ everything, including the stop replies from GDB-unknown
+ inferiors. */
+ discard_pending_stop_replies (NULL);
if (remote_async_inferior_event_token)
delete_async_event_handler (&remote_async_inferior_event_token);
@@ -4351,7 +4354,6 @@ remote_detach_1 (char *args, int from_tty, int extended)
if (from_tty && !extended)
puts_filtered (_("Ending remote debugging.\n"));
- discard_pending_stop_replies (pid);
target_mourn_inferior ();
}
@@ -5159,18 +5161,18 @@ stop_reply_xfree (struct stop_reply *r)
}
}
-/* Discard all pending stop replies of inferior PID. If PID is -1,
+/* Discard all pending stop replies of inferior INF. If INF is NULL,
discard everything. */
static void
-discard_pending_stop_replies (int pid)
+discard_pending_stop_replies (struct inferior *inf)
{
struct stop_reply *prev = NULL, *reply, *next;
/* Discard the in-flight notification. */
if (pending_stop_reply != NULL
- && (pid == -1
- || ptid_get_pid (pending_stop_reply->ptid) == pid))
+ && (inf == NULL
+ || ptid_get_pid (pending_stop_reply->ptid) == inf->pid))
{
stop_reply_xfree (pending_stop_reply);
pending_stop_reply = NULL;
@@ -5181,8 +5183,8 @@ discard_pending_stop_replies (int pid)
for (reply = stop_reply_queue; reply; reply = next)
{
next = reply->next;
- if (pid == -1
- || ptid_get_pid (reply->ptid) == pid)
+ if (inf == NULL
+ || ptid_get_pid (reply->ptid) == inf->pid)
{
if (reply == stop_reply_queue)
stop_reply_queue = reply->next;
@@ -7665,9 +7667,6 @@ extended_remote_mourn_1 (struct target_ops *target)
connected. */
rs->waiting_for_stop_reply = 0;
- /* We're no longer interested in these events. */
- discard_pending_stop_replies (ptid_get_pid (inferior_ptid));
-
/* If the current general thread belonged to the process we just
detached from or has exited, the remote side current general
thread becomes undefined. Considering a case like this:
@@ -11344,6 +11343,9 @@ _initialize_remote (void)
/* Hook into new objfile notification. */
observer_attach_new_objfile (remote_new_objfile);
+ /* We're no longer interested in notification events of an inferior
+ when it exits. */
+ observer_attach_inferior_exit (discard_pending_stop_replies);
/* Set up signal handlers. */
sigint_remote_token =