Hi,
discard_pending_stop_replies is called in three places, remote_detach_1,
extended_remote_mourn_1 (/w param pid) and remote_close (/w param -1).
They will finally call observer_notify_inferior_exit in some way,
remote_detach_1 >remote_mourn_1 >generic_mourn_inferior >exit_inferior >observer_notify_inferior_exit
extended_remote_mourn_1 >generic_mourn_inferior >exit_inferior >observer_notify_inferior_exit
remote_close >discard_all_inferiors >exit_inferior_silent >observer_notify_inferior_exit
so this inspires me that we can attach discard_pending_stop_replies
to inferior_exit observer, and don't have to worry about the case that
PID is -1. This is what this patch does. Regression tested on
x86_64-linux with native and gdbserver. Is it OK?
gdb:
2012-12-07 Yao Qi <yao@codesourcery.com>
* remote.c (discard_pending_stop_replies): Remove declaration.
(remote_close): Remove call discard_pending_stop_replies.
(remote_detach_1, extended_remote_mourn_1): Likewise.
(discard_pending_stop_replies): Change parameter from PID to
INF.
(_initialize_remote): Attach discard_pending_stop_replies to
inferior_exit observer.