gdbserver:Set linux target in async mode in default

Set gdbserver linux in async mode in default.

gdb/gdbserver:

2012-09-18  Yao Qi  <yao@codesourcery.com>

	* linux-low.c (target_is_async_p): Remove macro.
	(linux_wait) Don't check target_is_async_p.  Check 'non_stop'.
	(sigchld_handler): Don't check target_is_async_p, check
	non_stop instead.
	(linux_async): Don't call linux_async.
	(initialize_low): Call linux_async.
	* remote-utils.c (handle_accept_event): Don't call
	target_async, setting 'non_stop' to zero instead.
gdbserver:Remove async from target_ops

Hi,
After patch 1/2 is applied, 'target_async' is not used in common code any
more, this patch is to clean up.

gdb/gdbserver:

2012-09-18  Yao Qi  <yao@codesourcery.com>

	* target.h (struct target_ops) <asnyc>: Remove.
	(target_async): Remove macro.
	* linux-low.c (linux_target_ops): Update.
	* lynx-low.c (lynx_target_ops): Update.
	* nto-low.c (nto_target_ops): Update.
	* win32-low.c (win32_target_ops): Update.
new queue.h in common/.

Hi,
When writing the patches for 'general notification', I find queue is
used in many places, so I think we may need a general queue.  This
queue not only have typical operations enqueue and dequeue, but also
has some have some operations like remove and remove_all.

gdb/

2012-09-14  Yao Qi  <yao@codesourcery.com>
	    Doug Evans  <dje@google.com>

	* common/queue.h: New.
de-couple %Stop from notification: gdb

This patch is to de-couple vStopped/%Stop from notification in gdb side.

gdb:

2012-09-24  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.  Moved from remote.c.
	* remote-notif.h: New.
	* remote.c: Include 'remote-notif.h'.
	Remove declarations of stop_reply_xmalloc, stop_reply_xfree,
	do_stop_reply_xfree, remote_parse_stop_reply, push_stop_reply,
	remote_get_pending_stop_replies,
	remote_async_get_pending_events_handler, and
	discard_pending_stop_replies.
	Declare remote_parse_stop_reply and notif_queued_reply_push.
	Remove variable pending_stop_reply.
	(remote_async_inferior_event_token): Remove 'static'.
	(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.
	(remote_start_remote): Replace code with remote_notif_parse
	and remote_notif_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_reply_push.

	(struct stop_reply) <next>: Remove.
	<base>: New field.
	<ptid>: Move it to 'struct notif_reply'.
	Callers update.
	(stop_reply_queue): Remove.
	(stop_reply_xmalloc, stop_reply_xfree, do_stop_reply_xfree): Remove
	(remote_notif_ack_stop, stop_reply_dtr): New.
	(remote_notif_alloc_reply_stop): New.
	(notif_packet_stop): New variable.
	(stop_reply_match_ptid, stop_reply_match_ptid_and_ws: New.
	(queued_stop_reply, peek_stop_reply): Adjust.
	(push_stop_reply): Add one more parameter 'queue', and rename to
	notif_queued_reply_push.

	(remote_get_pending_stop_replies): Move to remote-notif.c.
	(handle_notification): Likewise.
	(remote_async_get_pending_events_handler): Likewise.
	(remote_wait_as): Adjust to call remote_notif_parse.
	(remote_wait): Call QUEUE_is_empty (notif_reply_p).
	* remote.h: Include "target.h" and "remote-notif.h".
	Declare remote_notif_pending_replies and
	remote_async_inferior_event_token
de-couple %Stop from notification: gdbserver

gdb/gdbserver:

2012-08-24  Yao Qi  <yao@codesourcery.com>

	* Makefile.in (OBS): Add notif.o.
	(notif_h, queue_h): New.
	(notif.o): New rule.

	* linux-low.c: Include "notif.h".
	(linux_wait): Put notif_stop into queue.
	* notif.c, notif.h: New.
	* server.c: Include 'notif.h'.
	(struct vstop_notif): Move it to notif.h.
	(notif_reply_stop): New.
	(notif_stop): New variable.
	(push_event, notif_queue): Remove.
	(vstop_notif_match_pid, notif_queued_replies_discard): New.
	(notif_queued_replies_discard_all): New.
	(discard_queued_stop_replies, send_next_stop_reply): Remove.
	(handle_v_kill): Don't call discard_queued_stop_replies.  Call
	notif_queued_replies_discard_all instead.
	(handle_v_stopped): Remove.
	(handle_v_requests): Don't call handle_v_stopped.  Call
	handle_ack_notif instead.
	(queue_stop_reply_callback): Call notif_reply_enqueue instead
	of queue_stop_reply.
	(handle_status): Don't call discard_queued_stop_replies.  Call
	notif_queued_replies_discard instead.
	(kill_inferior_callback): Likewise.
	(detach_or_kill_inferior_callback): Likewise.
	(main): Call initialize_notif.
	(process_serial_event): Likewise.  Call
	notif_queued_replies_empty_p.
	(handle_target_event): Process queued replies.
	* server.h: Remove declaration of push_event.
command 'set debug notification'.

This patch adds a new command 'set debug notification', and documents
this new command.

gdb:

2012-09-22  Yao Qi  <yao@codesourcery.com>

	* remote-notif.c (_initialize_notif): Add new command
	'set debug notification'.

gdb/doc:

2012-09-22  Yao Qi  <yao@codesourcery.com>

	* gdb.texinfo (Debugging Output): Document set debug notification.
gdb: mark remote_async_get_pending_events_token in non-stop mode

Hi,
remote_async_get_pending_events_token is added for supporting non-stop
mode in remote target.  As we generalizing notification to support
both non-stop and all-stop, we have to do a check on 'non_stop' and
only call mark_async_event_handler in non-stop mode.

gdb:

2012-09-23  Yao Qi  <yao@codesourcery.com>

	* remote-notif.c (remote_async_get_pending_events_handler):
	Assert tat 'non_stop' is true.
	(handle_notification): Call mark_async_event_handler only
	if 'non_stop' is true.
new notification "TEST".

This patch is only to present how do we add a new type of notifcation
in the future, and to test two types of notifications coexist together
for testing purpose.  In each time GDB fetches registers, a new event
is pushed, and GDBserver will send a notification %Test to GDB.

This patch is not for committing to CVS trunk.

gdb/gdbserver:

2012-09-24  Yao Qi  <yao@codesourcery.com>

   	* linux-low.c (linux_fetch_registers): Call circular_queue_enque
	and async_file_mark.
	* notif.c (notif_process_vtested): New.
	(notif_test): New variable.
	(notfi_packets): Add new element 'notif_test'.
	* notif.h (notif_type): New enum 'NOTIF_TEST'.
	* server.c (handle_target_event): Handle 'NOTIF_V_TESTED'.

gdb:

2012-09-24  Yao Qi  <yao@codesourcery.com>

	* remote-notif.c (struct test_reply): New.
	(remote_notif_parse_test): New.
	(remote_notif_ack_test): New.
	(remote_notif_alloc_reply_test): New.
	(notif_packet_test): New variable.
	(notifs): New element 'notif_packet_test'.