Commit Graph

6 Commits

Author SHA1 Message Date
Joel Brobecker ecd75fc8ee Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
Yao Qi f48ff2a7d3 Move pending_event to remote_notif_state.
This patch moves pending_event to remote_notif_state.  All pending
events are destroyed in remote_notif_state_xfree.  However,
discard_pending_stop_replies release pending event too, so the pending
event of stop notification is released twice, we need some refactor
here.  We add a new function discard_pending_stop_replies_in_queue
which only discard events in stop_reply_queue, and let
remote_notif_state_xfree release pending event for all notif_client.

After this change, discard_pending_stop_replies is only attached to
ifnerior_exit observer, so the INF can't be NULL any more.  The
NULL checking is removed too.

gdb:

2013-10-04  Yao Qi  <yao@codesourcery.com>

	* remote-notif.h (REMOTE_NOTIF_ID): New enum.
	(struct notif_client) <pending_event>: Moved
	to struct remote_notif_state.
	<id>: New field.
	(struct remote_notif_state) <pending_event>: New field.
	(notif_event_xfree): Declare.
	* remote-notif.c (handle_notification): Adjust.
	(notif_event_xfree): New function.
	(do_notif_event_xfree): Call notif_event_xfree.
	(remote_notif_state_xfree): Call notif_event_xfree to free
	each element in field pending_event.
	* remote.c (discard_pending_stop_replies): Remove declaration.
	(discard_pending_stop_replies_in_queue): Declare.
	(remote_close): Call discard_pending_stop_replies_in_queue
	instead of discard_pending_stop_replies.
	(remote_start_remote): Adjust.
	(stop_reply_xfree): Call notif_event_xfree.
	(notif_client_stop): Adjust initialization.
	(remote_notif_remove_all): Rename it to ...
	(remove_stop_reply_for_inferior): ... this.  Update comments.
	Don't check INF is NULL.
	(discard_pending_stop_replies): Return early if notif_state is
	NULL.  Adjust.  Don't check INF is NULL.
	(remote_notif_get_pending_events): Adjust.
 	(discard_pending_stop_replies_in_queue): New function.
	(remote_wait_ns): Likewise.
2013-10-04 07:42:06 +00:00
Yao Qi 5965e02896 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  <yao@codesourcery.com>

	* 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) <notif_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.
2013-10-04 07:32:56 +00:00
Pedro Alves 99f0a309a9 remote-notif.[h|c]:notif_debug: Change type to int.
notif_debug is installed as variable of a "signed" command:

  add_setshow_boolean_cmd ("notification", no_class, &notif_debug,
                           _("\

and:

command.h:extern void add_setshow_boolean_cmd (char *name,
command.h-                                   enum command_class class,
command.h-                                   int *var,

2013-03-07  Pedro Alves  <palves@redhat.com>

	* remote-notif.c (notif_debug): Change type to int.
	* remote-notif.h (notif_debug): Likewise.
2013-03-07 17:52:58 +00:00
Joel Brobecker 28e7fd6234 Update years in copyright notice for the GDB files.
Two modifications:
  1. The addition of 2013 to the copyright year range for every file;
  2. The use of a single year range, instead of potentially multiple
     year ranges, as approved by the FSF.
2013-01-01 06:33:28 +00:00
Yao Qi 722247f1cb gdb/
2012-12-15  Yao Qi  <yao@codesourcery.com>

	* Makefile.in (REMOTE_OBS): Add "remote-notif.o".
	(SFILES): Add "remote-notif.c".
	(HFILES_NO_SRCDIR): Add "remote-notif.h" and "common/queue.h".
	* remote-notif.c: New.  Factored out from remote.c.
	* remote-notif.h: New.
	* remote.c: Include "remote-notif.h".
	(stop_reply_xmalloc, do_stop_reply_xfree):
	(remote_parse_stop_reply, remote_get_pending_stop_replies):
	(remote_async_get_pending_events_handler): Remove declarations.
	(remote_parse_stop_reply): Declare.
	(pending_stop_reply): Remove.
	(remote_async_get_pending_events_token): Move to
	remote-notif.c.
	(remote_close): Replace 'delete_async_event_handler' with
	remote_notif_unregister_async_event_handler.
	Don't call discard_pending_stop_replies.
	(remote_start_remote): Replace code with remote_notif_parse
	and remote_notif_get_pending_replies.
	(remote_open_1): Replace 'create_async_event_handler' with
	remote_notif_register_async_event_handler.
	(extended_remote_attach_1): Call remote_notif_parse and
	notif_stop_reply_push.
	(struct stop_reply) <next>: Remove.
	<base>: New field.
	Callers update.
	(stop_reply_queue): Change its type.
	(stop_reply_xmalloc, do_stop_reply_xfree): Remove.
	(remote_notif_remove_all): New.
	(discard_pending_stop_replies): Update.
	(remote_notif_stop_ack, stop_reply_dtr): New.
	(remote_notif_stop_alloc_event): New.
	(notif_client_stop): New variable.
	(stop_reply_match_ptid, stop_reply_match_ptid_and_ws: New.
	(queued_stop_reply, peek_stop_reply): Adjust.
	(remote_get_pending_stop_replies): Rename to
	remote_notif_get_pending_events.
	(handle_notification): Move to remote-notif.c.
	(remote_async_get_pending_events_handler): Likewise.
	(remote_wait_as): Adjust to call remote_notif_parse.
	Call 'getpkt_or_notif_sane' instead of 'getpkt_sane'.
	Return minus_one_ptid early if gets a notification.
	(remote_wait): Call QUEUE_is_empty (notif_reply_p).
	(_initialize_remote): Call QUEUE_alloc.  Update caller.
	(remote_resume): Call 'remote_notif_process' in all-stop mode.
	* remote.h: Include "remote-notif.h".
	(remote_notif_get_pending_replies): Declare.
2012-12-15 03:50:22 +00:00