From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26359 invoked by alias); 23 Jan 2014 14:10:27 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 26257 invoked by uid 89); 23 Jan 2014 14:10:26 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 23 Jan 2014 14:10:24 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s0NEAHvg023179 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 23 Jan 2014 09:10:22 -0500 Received: from brno.lan (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s0NEA9qQ026851; Thu, 23 Jan 2014 09:10:16 -0500 From: Pedro Alves To: gdb-patches@sourceware.org Cc: teawater@gmail.com, luis_gustavo@mentor.com Subject: [PATCH 5/5] Add TARGET_WAITKIND_NO_RESUMED support to the RSP. Date: Thu, 23 Jan 2014 14:10:00 -0000 Message-Id: <1390486209-8167-5-git-send-email-palves@redhat.com> In-Reply-To: <1390486209-8167-1-git-send-email-palves@redhat.com> References: <52E12075.3040601@redhat.com> <1390486209-8167-1-git-send-email-palves@redhat.com> X-SW-Source: 2014-01/txt/msg00897.txt.bz2 Makes gdb.threads/no-unwaited-for-left.exp pass. WIP. --- gdb/gdbserver/remote-utils.c | 3 +++ gdb/gdbserver/server.c | 30 ++++++++++++++++++------------ gdb/remote.c | 13 ++++++++++--- 3 files changed, 31 insertions(+), 15 deletions(-) diff --git a/gdb/gdbserver/remote-utils.c b/gdb/gdbserver/remote-utils.c index 3b88995..f5acd12 100644 --- a/gdb/gdbserver/remote-utils.c +++ b/gdb/gdbserver/remote-utils.c @@ -1429,6 +1429,9 @@ prepare_resume_reply (char *buf, ptid_t ptid, else sprintf (buf, "X%02x", status->value.sig); break; + case TARGET_WAITKIND_NO_RESUMED: + sprintf (buf, "N"); + break; default: error ("unhandled waitkind"); break; diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c index 0f50afe..e779793 100644 --- a/gdb/gdbserver/server.c +++ b/gdb/gdbserver/server.c @@ -2321,7 +2321,8 @@ 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 + && 0 /* XXX Check if GDB supports this. */) { /* No proper RSP support for this yet. At least return error. */ @@ -3847,6 +3848,18 @@ handle_serial_event (int err, gdb_client_data client_data) return 0; } +static void +push_stop_notification (ptid_t ptid, struct target_waitstatus *status) +{ + struct vstop_notif *vstop_notif + = xmalloc (sizeof (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 @@ -3860,7 +3873,9 @@ 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 () + && 1 /* XXX Check here if GDB supports for this stop reply. */) + push_stop_notification (null_ptid, &last_status); } else if (last_status.kind != TARGET_WAITKIND_IGNORE) { @@ -3915,16 +3930,7 @@ handle_target_event (int err, gdb_client_data client_data) target_pid_to_str (last_ptid)); } else - { - struct vstop_notif *vstop_notif - = xmalloc (sizeof (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 inferior behind GDB's back. diff --git a/gdb/remote.c b/gdb/remote.c index d886929..94552a3 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -5838,6 +5838,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 (non_stop && ptid_equal (event->ptid, null_ptid)) @@ -5939,7 +5943,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 (); @@ -6108,7 +6113,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 = (struct stop_reply *) remote_notif_parse (¬if_client_stop, @@ -6152,7 +6157,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. */ -- 1.7.11.7