aboutsummaryrefslogtreecommitdiff
path: root/gdb/remote-notif.c
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2015-11-30 16:05:13 +0000
committerPedro Alves <palves@redhat.com>2015-11-30 18:36:37 +0000
commit6efcd9a8b3dc6a01cd1f212a2d854e5f8896715e (patch)
treec037bfbc8a183642709bbcd8b6f6a36d6fe5dbd3 /gdb/remote-notif.c
parentf015c27b5294eaf87d0aa814d94972e65c7cc90e (diff)
downloadgdb-6efcd9a8b3dc6a01cd1f212a2d854e5f8896715e.zip
gdb-6efcd9a8b3dc6a01cd1f212a2d854e5f8896715e.tar.gz
gdb-6efcd9a8b3dc6a01cd1f212a2d854e5f8896715e.tar.bz2
Remote all-stop-on-top-of-non-stop
This is the first pass at implementing support for all-stop mode running against the remote target using the non-stop variant of the protocol. The trickiest part here is the initial connection setup/synching. We need to fetch all inferiors' target descriptions etc. before stopping threads, because stop_all_threads needs to read the threads' registers (to record each thread's stop_pc). But OTOH, the initial inferior setup (target_post_attach, post_create_inferior, etc.), only works correctly if the inferior is stopped... So I've split that initial setup part from attach_command_post_wait to a separate function, and added a "still needs setup" flag to the inferior structure. This is similar to gdbserver/linux-low.c's handling of discovering the process's target description). Then if on connection all threads of the remote inferior are running, when we go about stopping them, as soon as they stop we call setup_inferior, from within stop_all_threads. Also, in all-stop, we need to process all the initial stop replies to learn about all the pending signal the threads may already be stopped for, and pick the one to report as current. This is exposed by gdb.threads/reconnect-signal.exp. gdb/ 2015-11-30 Pedro Alves <palves@redhat.com> * gdbthread.h (switch_to_thread_no_regs): Declare. * infcmd.c (setup_inferior): New function, factored out from ... (attach_command_post_wait): ... this. Rename to ... (attach_post_wait): ... this. Replace parameter async_exec with attach_post_wait_mode parameter. Adjust. (enum attach_post_wait_mode): New enum. (struct attach_command_continuation_args): Replace 'async_exec' field with 'mode' field. (attach_command_continuation): Adjust. (attach_command): Add comment. Mark the inferior as needing setup. Adjust to use enum attach_post_wait_mode. (notice_new_inferior): Use switch_to_thread_no_regs. Adjust to use enum attach_post_wait_mode. * inferior.h (setup_inferior): Declare. (struct inferior) <needs_setup>: New field. * infrun.c (set_last_target_status): Make extern. (stop_all_threads): Make extern. Setup inferior, if necessary. * infrun.h (set_last_target_status, stop_all_threads): Declare. * remote-notif.c (remote_async_get_pending_events_handler) (handle_notification): Replace non_stop checks with target_is_non_stop_p() checks. * remote.c (remote_notice_new_inferior): Remove non_stop check. (remote_update_thread_list): Replace non_stop check with target_is_non_stop_p() check. (print_one_stopped_thread): New function. (process_initial_stop_replies): New 'from_tty' parameter. "Notice" all new live inferiors after storing initial stops as pending status in each corresponding thread. If all-stop, stop all threads, try picking a signalled thread as current, and print the status of that one thread. Record the last target status. (remote_start_remote): Replace non_stop checks with target_is_non_stop_p() checks. Don't query for the remote current thread of use qOffsets here. Pass from_tty to process_initial_stop_replies. (extended_remote_attach): Replace non_stop checks with target_is_non_stop_p() checks. (extended_remote_post_attach): Send qOffsets here. (remote_vcont_resume, remote_resume, remote_stop) (remote_interrupt, remote_parse_stop_reply, remote_wait): Replace non_stop checks with target_is_non_stop_p() checks. (remote_async): If target is non-stop, mark/clear the pending events token. * thread.c (switch_to_thread_no_regs): New function.
Diffstat (limited to 'gdb/remote-notif.c')
-rw-r--r--gdb/remote-notif.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/gdb/remote-notif.c b/gdb/remote-notif.c
index a8a6285..4377bda 100644
--- a/gdb/remote-notif.c
+++ b/gdb/remote-notif.c
@@ -116,7 +116,7 @@ remote_notif_process (struct remote_notif_state *state,
static void
remote_async_get_pending_events_handler (gdb_client_data data)
{
- gdb_assert (non_stop);
+ gdb_assert (target_is_non_stop_p ());
remote_notif_process ((struct remote_notif_state *) data, NULL);
}
@@ -166,7 +166,7 @@ handle_notification (struct remote_notif_state *state, char *buf)
/* Notify the event loop there's a stop reply to acknowledge
and that there may be more events to fetch. */
QUEUE_enque (notif_client_p, state->notif_queue, nc);
- if (non_stop)
+ if (target_is_non_stop_p ())
{
/* In non-stop, We mark REMOTE_ASYNC_GET_PENDING_EVENTS_TOKEN
in order to go on what we were doing and postpone