diff options
author | Pedro Alves <palves@redhat.com> | 2015-11-30 16:05:25 +0000 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2015-11-30 18:43:24 +0000 |
commit | f2faf941ae49653ff6e1485adfee299313d47c91 (patch) | |
tree | 6d494270ef0baff9c2490cb8b1643ab4139d14b7 /gdb/gdbserver/server.c | |
parent | f4836ba964a96364f39c7eab8b8b2f8656d14d05 (diff) | |
download | fsf-binutils-gdb-f2faf941ae49653ff6e1485adfee299313d47c91.zip fsf-binutils-gdb-f2faf941ae49653ff6e1485adfee299313d47c91.tar.gz fsf-binutils-gdb-f2faf941ae49653ff6e1485adfee299313d47c91.tar.bz2 |
Implement TARGET_WAITKIND_NO_RESUMED in the remote protocol
Testing with "maint set target-non-stop on" causes regressions in
tests that rely on TARGET_WAITKIND_NO_RESUMED, which isn't modelled on
the RSP. In real all-stop, gdbserver detects the situation and
reporst error to GDB, and so the tests (e.g.,
gdb.threads/no-unwaited-for-left.exp) at fail quickly. But with
"maint set target-non-stop on", GDB instead hangs forever waiting for
a stop reply that never comes, and so the tests take longer to time
out.
This adds a new "N" stop reply packet that maps 1-1 to
TARGET_WAITKIND_NO_RESUMED.
gdb/ChangeLog:
2015-11-30 Pedro Alves <palves@redhat.com>
PR 14618
* NEWS (New remote packets): Mention the N stop reply.
* remote.c (remote_protocol_features): Add "no-resumed" entry.
(remote_query_supported): Report no-resumed+ support.
(remote_parse_stop_reply): Handle 'N'.
(process_stop_reply): Handle TARGET_WAITKIND_NO_RESUMED.
(remote_wait_as): Handle 'N' / TARGET_WAITKIND_NO_RESUMED.
(_initialize_remote): Register "set/show remote
no-resumed-stop-reply" commands.
gdb/doc/ChangeLog:
2015-11-30 Pedro Alves <palves@redhat.com>
PR 14618
* gdb.texinfo (Stop Reply Packets): Document the N stop reply.
(Remote Configuration): Add the "set/show remote
no-resumed-stop-reply" to the available settings table.
(General Query Packets): Document the "no-resumed" qSupported
feature.
gdb/gdbserver/ChangeLog:
2015-11-30 Pedro Alves <palves@redhat.com>
PR 14618
* linux-low.c (linux_wait_1): If the last resumed thread is gone,
report TARGET_WAITKIND_NO_RESUMED.
* remote-utils.c (prepare_resume_reply): Handle
TARGET_WAITKIND_NO_RESUMED.
* server.c (report_no_resumed): New global.
(handle_query) <qSupported>: Handle "no-resumed+". Report
"no-resumed+" support.
(resume): When the target reports TARGET_WAITKIND_NO_RESUMED, only
return error if the client doesn't support no-resumed events.
(push_stop_notification): New function.
(handle_target_event): Use it. Report TARGET_WAITKIND_NO_RESUMED
events if the client supports them.
gdb/testsuite/ChangeLog:
2015-11-30 Pedro Alves <palves@redhat.com>
* gdb.threads/no-unwaited-for-left.exp: Remove setup_kfail calls.
Diffstat (limited to 'gdb/gdbserver/server.c')
-rw-r--r-- | gdb/gdbserver/server.c | 45 |
1 files changed, 32 insertions, 13 deletions
diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c index 0762f6a..18e9bf1 100644 --- a/gdb/gdbserver/server.c +++ b/gdb/gdbserver/server.c @@ -61,6 +61,10 @@ int report_fork_events; int report_vfork_events; int report_exec_events; int report_thread_events; + +/* Whether to report TARGET_WAITKING_NO_RESUMED events. */ +static int report_no_resumed; + int non_stop; int swbreak_feature; int hwbreak_feature; @@ -2187,6 +2191,12 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p) vCont_supported = 1; else if (strcmp (p, "QThreadEvents+") == 0) ; + else if (strcmp (p, "no-resumed+") == 0) + { + /* GDB supports and wants TARGET_WAITKIND_NO_RESUMED + events. */ + report_no_resumed = 1; + } else { /* Move the unknown features all together. */ @@ -2309,6 +2319,8 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p) strcat (own_buf, ";QThreadEvents+"); + strcat (own_buf, ";no-resumed+"); + /* Reinitialize components as needed for the new connection. */ hostio_handle_new_gdb_connection (); target_handle_new_gdb_connection (); @@ -2716,10 +2728,11 @@ resume (struct thread_resume *actions, size_t num_actions) { last_ptid = mywait (minus_one_ptid, &last_status, 0, 1); - if (last_status.kind == TARGET_WAITKIND_NO_RESUMED) + if (last_status.kind == TARGET_WAITKIND_NO_RESUMED + && !report_no_resumed) { - /* No proper RSP support for this yet. At least return - error. */ + /* The client does not support this stop reply. At least + return error. */ sprintf (own_buf, "E.No unwaited-for children left."); disable_async_io (); return; @@ -4332,6 +4345,19 @@ handle_serial_event (int err, gdb_client_data client_data) return 0; } +/* Push a stop notification on the notification queue. */ + +static void +push_stop_notification (ptid_t ptid, struct target_waitstatus *status) +{ + struct vstop_notif *vstop_notif = XNEW (struct vstop_notif); + + vstop_notif->status = *status; + vstop_notif->ptid = ptid; + /* Push Stop notification. */ + notif_push (¬if_stop, (struct notif_event *) vstop_notif); +} + /* Event-loop callback for target events. */ int @@ -4345,7 +4371,8 @@ handle_target_event (int err, gdb_client_data client_data) if (last_status.kind == TARGET_WAITKIND_NO_RESUMED) { - /* No RSP support for this yet. */ + if (gdb_connected () && report_no_resumed) + push_stop_notification (null_ptid, &last_status); } else if (last_status.kind != TARGET_WAITKIND_IGNORE) { @@ -4405,15 +4432,7 @@ handle_target_event (int err, gdb_client_data client_data) } } else - { - struct vstop_notif *vstop_notif = XNEW (struct vstop_notif); - - vstop_notif->status = last_status; - vstop_notif->ptid = last_ptid; - /* Push Stop notification. */ - notif_push (¬if_stop, - (struct notif_event *) vstop_notif); - } + push_stop_notification (last_ptid, &last_status); } /* Be sure to not change the selected thread behind GDB's back. |