From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27256 invoked by alias); 23 Feb 2008 18:31:17 -0000 Received: (qmail 27247 invoked by uid 22791); 23 Feb 2008 18:31:17 -0000 X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (65.74.133.4) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sat, 23 Feb 2008 18:31:00 +0000 Received: (qmail 4248 invoked from network); 23 Feb 2008 18:30:57 -0000 Received: from unknown (HELO localhost) (vladimir@127.0.0.2) by mail.codesourcery.com with ESMTPA; 23 Feb 2008 18:30:57 -0000 From: Vladimir Prus Date: Sat, 23 Feb 2008 18:47:00 -0000 Subject: [RFA] Unbreak 'target async'. To: gdb-patches@sources.redhat.com X-TUID: 319c7880f0deb453 X-Length: 1104 X-UID: 131 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200802232130.56913.vladimir@codesourcery.com> 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 X-SW-Source: 2008-02/txt/msg00364.txt.bz2 Presently, if I connect to gdbserver using 'target async' and then to 'continue', then continue never finishes. What happens is that serial_async first calls scb->ops->async, and only then sets scb->async_handler. However, ser_base_async calls reschedule which calls serial_is_async, which checks scb->async_handler. Since it's not set yet, async mode is never enabled. The below patch allows me to do 'continue' successfully. I did not run the testsuite, since it's apparent that this patch cannot break "target async" more that it's broken now. OK? - Volodya Unbreak 'target async'. * serial.c (serial_async): Set the handler function before enabling async mode. --- gdb/serial.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gdb/serial.c b/gdb/serial.c index 7bdf170..1fb7f31 100644 --- a/gdb/serial.c +++ b/gdb/serial.c @@ -515,12 +515,12 @@ serial_async (struct serial *scb, serial_event_ftype *handler, void *context) { - /* Only change mode if there is a need. */ - if ((scb->async_handler == NULL) - != (handler == NULL)) - scb->ops->async (scb, handler != NULL); + int changed = ((scb->async_handler == NULL) != (handler == NULL)); scb->async_handler = handler; scb->async_context = context; + /* Only change mode if there is a need. */ + if (changed) + scb->ops->async (scb, handler != NULL); } int -- 1.5.3.5