+2015-08-21 Pedro Alves <palves@redhat.com>
+
+ PR gdb/18749
+ * inferiors.c (remove_thread): Discard any pending stop reply for
+ this thread.
+ * server.c (remove_all_on_match_pid): Rename to ...
+ (remove_all_on_match_ptid): ... this. Work with a filter ptid
+ instead of a pid.
+ (discard_queued_stop_replies): Change parameter to a ptid. Now
+ extern.
+ (handle_v_kill, kill_inferior_callback, captured_main)
+ (process_serial_event): Adjust.
+ * server.h (discard_queued_stop_replies): Declare.
+
2015-08-21 Pedro Alves <palves@redhat.com>
* linux-low.c (wait_for_sigstop): Always switch to no thread
}
static int
-remove_all_on_match_pid (QUEUE (notif_event_p) *q,
- QUEUE_ITER (notif_event_p) *iter,
- struct notif_event *event,
- void *data)
+remove_all_on_match_ptid (QUEUE (notif_event_p) *q,
+ QUEUE_ITER (notif_event_p) *iter,
+ struct notif_event *event,
+ void *data)
{
- int *pid = data;
+ ptid_t filter_ptid = *(ptid_t *) data;
+ struct vstop_notif *vstop_event = (struct vstop_notif *) event;
- if (*pid == -1
- || ptid_get_pid (((struct vstop_notif *) event)->ptid) == *pid)
+ if (ptid_match (vstop_event->ptid, filter_ptid))
{
if (q->free_func != NULL)
q->free_func (event);
return 1;
}
-/* Get rid of the currently pending stop replies for PID. If PID is
- -1, then apply to all processes. */
+/* See server.h. */
-static void
-discard_queued_stop_replies (int pid)
+void
+discard_queued_stop_replies (ptid_t ptid)
{
QUEUE_iterate (notif_event_p, notif_stop.queue,
- remove_all_on_match_pid, &pid);
+ remove_all_on_match_ptid, &ptid);
}
static void
last_status.kind = TARGET_WAITKIND_SIGNALLED;
last_status.value.sig = GDB_SIGNAL_KILL;
last_ptid = pid_to_ptid (pid);
- discard_queued_stop_replies (pid);
+ discard_queued_stop_replies (last_ptid);
write_ok (own_buf);
return 1;
}
int pid = ptid_get_pid (process->entry.id);
kill_inferior (pid);
- discard_queued_stop_replies (pid);
+ discard_queued_stop_replies (pid_to_ptid (pid));
}
/* Callback for for_each_inferior to detach or kill the inferior,
else
kill_inferior (pid);
- discard_queued_stop_replies (pid);
+ discard_queued_stop_replies (pid_to_ptid (pid));
}
/* for_each_inferior callback for detach_or_kill_for_exit to print
initialize_event_loop ();
if (target_supports_tracepoints ())
initialize_tracepoint ();
+ initialize_notif ();
own_buf = xmalloc (PBUFSIZ + 1);
mem_buf = xmalloc (PBUFSIZ);
}
make_cleanup (detach_or_kill_for_exit_cleanup, NULL);
- initialize_notif ();
-
/* Don't report shared library events on the initial connection,
even if some libraries are preloaded. Avoids the "stopped by
shared library event" notice on gdb side. */
/* Get rid of any pending statuses. An eventual reconnection
(by the same GDB instance or another) will refresh all its
state from scratch. */
- discard_queued_stop_replies (-1);
+ discard_queued_stop_replies (minus_one_ptid);
for_each_inferior (&all_threads,
clear_pending_status_callback);
write_enn (own_buf);
else
{
- discard_queued_stop_replies (pid);
+ discard_queued_stop_replies (pid_to_ptid (pid));
write_ok (own_buf);
if (extended_protocol)