From 70166e7ad853a415d641fb5222b39953cc20c209 Mon Sep 17 00:00:00 2001 From: qiyao Date: Fri, 4 Oct 2013 07:32:56 +0000 Subject: Move notif_queue and remote_async_get_pending_events_token to remote_state This patch also removes notif_xfree, and don't pass it QUEUE_alloc, because we don't have to free notif_client when the remote_notif_state is freed. gdb: 2013-10-04 Yao Qi * remote-notif.c (DECLARE_QUEUE_P): Remove. (notif_queue): Remove. (remote_notif_process): Add one parameter 'notif_queue'. Update comments. Callers update. (remote_async_get_pending_events_token): Remove. (remote_notif_register_async_event_handler): Remove. (remote_notif_unregister_async_event_handler): Remove. (handle_notification): Add parameter 'notif_queue'. Update comments. Callers update. (notif_xfree): Remove. (remote_notif_state_allocate): New function. (remote_notif_state_xfree): New function. (_initialize_notif): Remove code to allocate queue. * remote-notif.h (DECLARE_QUEUE_P): Moved from remote-notif.c. (struct remote_notif_state): New. (handle_notification): Update declaration. (remote_notif_process): Likewise. (remote_notif_register_async_event_handler): Remove. (remote_notif_unregister_async_event_handler): Remove. (remote_notif_state_allocate): Declare. (remote_notif_state_xfree): Declare. * remote.c (struct remote_state) : New field. (remote_close): Don't call remote_notif_unregister_async_event_handler. Call remote_notif_state_xfree. (remote_open_1): Don't call remote_notif_register_async_event_handler. Call remote_notif_state_allocate. --- gdb/remote.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'gdb/remote.c') diff --git a/gdb/remote.c b/gdb/remote.c index a9ef2974ac3..6ac3f511eb0 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -425,6 +425,9 @@ struct remote_state threadref echo_nextthread; threadref nextthread; threadref resultthreadlist[MAXTHREADLISTRESULTS]; + + /* The state of remote notification. */ + struct remote_notif_state *notif_state; }; /* Private data that we'll store in (struct thread_info)->private. */ @@ -3073,7 +3076,7 @@ remote_close (void) if (remote_async_inferior_event_token) delete_async_event_handler (&remote_async_inferior_event_token); - remote_notif_unregister_async_event_handler (); + remote_notif_state_xfree (rs->notif_state); trace_reset_local_state (); } @@ -4337,7 +4340,7 @@ remote_open_1 (char *name, int from_tty, remote_async_inferior_event_token = create_async_event_handler (remote_async_inferior_event_handler, NULL); - remote_notif_register_async_event_handler (); + rs->notif_state = remote_notif_state_allocate (); /* Reset the target state; these things will be queried either by remote_query_supported or as they are needed. */ @@ -4931,7 +4934,7 @@ remote_resume (struct target_ops *ops, before resuming inferior, because inferior was stopped and no RSP traffic at that moment. */ if (!non_stop) - remote_notif_process (¬if_client_stop); + remote_notif_process (rs->notif_state, ¬if_client_stop); rs->last_sent_signal = siggnal; rs->last_sent_step = step; @@ -7352,7 +7355,7 @@ putpkt_binary (char *buf, int cnt) str); do_cleanups (old_chain); } - handle_notification (rs->buf); + handle_notification (rs->notif_state, rs->buf); /* We're in sync now, rewait for the ack. */ tcount = 0; } @@ -7738,7 +7741,7 @@ getpkt_or_notif_sane_1 (char **buf, long *sizeof_buf, int forever, if (is_notif != NULL) *is_notif = 1; - handle_notification (*buf); + handle_notification (rs->notif_state, *buf); /* Notifications require no acknowledgement. */ -- cgit v1.2.1