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/remote.c | |
parent | f4836ba964a96364f39c7eab8b8b2f8656d14d05 (diff) | |
download | binutils-gdb-f2faf941ae49653ff6e1485adfee299313d47c91.tar.gz |
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/remote.c')
-rw-r--r-- | gdb/remote.c | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/gdb/remote.c b/gdb/remote.c index 4daaf08c4b4..9d44ce1d7be 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -1488,6 +1488,9 @@ enum { /* Support remote CTRL-C. */ PACKET_vCtrlC, + /* Support TARGET_WAITKIND_NO_RESUMED. */ + PACKET_no_resumed, + PACKET_MAX }; @@ -4527,6 +4530,7 @@ static const struct protocol_feature remote_protocol_features[] = { PACKET_Qbtrace_conf_pt_size }, { "vContSupported", PACKET_DISABLE, remote_supported_packet, PACKET_vContSupported }, { "QThreadEvents", PACKET_DISABLE, remote_supported_packet, PACKET_QThreadEvents }, + { "no-resumed", PACKET_DISABLE, remote_supported_packet, PACKET_no_resumed }, }; static char *remote_support_xml; @@ -4622,6 +4626,9 @@ remote_query_supported (void) if (packet_set_cmd_state (PACKET_QThreadEvents) != AUTO_BOOLEAN_FALSE) q = remote_query_supported_append (q, "QThreadEvents+"); + if (packet_set_cmd_state (PACKET_no_resumed) != AUTO_BOOLEAN_FALSE) + q = remote_query_supported_append (q, "no-resumed+"); + /* Keep this one last to work around a gdbserver <= 7.10 bug in the qSupported:xmlRegisters=i386 handling. */ if (remote_support_xml != NULL) @@ -6596,6 +6603,10 @@ Packet: '%s'\n"), event->ptid = pid_to_ptid (pid); } break; + case 'N': + event->ws.kind = TARGET_WAITKIND_NO_RESUMED; + event->ptid = minus_one_ptid; + break; } if (target_is_non_stop_p () && ptid_equal (event->ptid, null_ptid)) @@ -6697,7 +6708,8 @@ process_stop_reply (struct stop_reply *stop_reply, ptid = inferior_ptid; if (status->kind != TARGET_WAITKIND_EXITED - && status->kind != TARGET_WAITKIND_SIGNALLED) + && status->kind != TARGET_WAITKIND_SIGNALLED + && status->kind != TARGET_WAITKIND_NO_RESUMED) { struct remote_state *rs = get_remote_state (); struct private_thread_info *remote_thr; @@ -6875,7 +6887,7 @@ remote_wait_as (ptid_t ptid, struct target_waitstatus *status, int options) remote_fileio_request (buf, rs->ctrlc_pending_p); rs->ctrlc_pending_p = 0; break; - case 'T': case 'S': case 'X': case 'W': + case 'N': case 'T': case 'S': case 'X': case 'W': { struct stop_reply *stop_reply; @@ -6914,7 +6926,9 @@ remote_wait_as (ptid_t ptid, struct target_waitstatus *status, int options) break; } - if (status->kind == TARGET_WAITKIND_IGNORE) + if (status->kind == TARGET_WAITKIND_NO_RESUMED) + return minus_one_ptid; + else if (status->kind == TARGET_WAITKIND_IGNORE) { /* Nothing interesting happened. If we're doing a non-blocking poll, we're done. Otherwise, go back to waiting. */ @@ -13755,6 +13769,9 @@ Show the maximum size of the address (in bits) in a memory packet."), NULL, add_packet_config_cmd (&remote_protocol_packets[PACKET_QThreadEvents], "QThreadEvents", "thread-events", 0); + add_packet_config_cmd (&remote_protocol_packets[PACKET_no_resumed], + "N stop reply", "no-resumed-stop-reply", 0); + /* Assert that we've registered "set remote foo-packet" commands for all packet configs. */ { |