From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8627 invoked by alias); 7 Jul 2014 18:13:26 -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 8598 invoked by uid 89); 7 Jul 2014 18:13:21 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 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 (AES256-GCM-SHA384 encrypted) ESMTPS; Mon, 07 Jul 2014 18:13:13 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s67IDCBT016088 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 7 Jul 2014 14:13:12 -0400 Received: from brno.lan (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s67IDAs2021736 for ; Mon, 7 Jul 2014 14:13:11 -0400 From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PUSHED] PR gdb/17096: async support breaks remote debugging on Windows Date: Mon, 07 Jul 2014 18:13:00 -0000 Message-Id: <1404756790-6767-1-git-send-email-palves@redhat.com> X-SW-Source: 2014-07/txt/msg00131.txt.bz2 On Windows, with "maint set target-async on" (the default since a09dd441), Ctrl-C fails to stop a remote target. With maint target-async on, the SIGINT signal handler doesn't send the remote interrupt request immediately. Instead, it marks an async handler as ready, and then the main event loop wakes up and notices that the SIGINT async signal handler token was set, and calls the corresponding event handler, which sends the remote interrupt request. On POSIX-like systems, the SIGINT signal makes the select/poll in the main event loop wake up / return with EINTR. However, on Windows, signal handlers run on a separate thread, and Windows doesn't really have a concept of EINTR. So, just marking the async handler (effectively just setting a flag) does not wake up gdb_select. Instead, we need to call gdb_call_async_signal_handler from the signal handler. The Windows version (in mingw-hdep.c) sets a Windows event that gdb_select's WaitForMultipleObjects is waiting for. Confirmed that with this, Ctrl-C interrupts the remote target on Windows. Also regression tested on x86_64 Fedora 20 against GDBserver. gdb/ 2014-07-07 Pedro Alves gdb/17096 * remote.c (async_handle_remote_sigint) (async_handle_remote_sigint_twice): Call gdb_call_async_signal_handler instead of mark_async_signal_handler. --- gdb/ChangeLog | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 513a919..cb7185e 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -6,6 +6,14 @@ gdb_call_async_signal_handler instead of mark_async_signal_handler. +2014-07-07 Pedro Alves + + PR gdb/17096 + * remote.c (async_handle_remote_sigint) + (async_handle_remote_sigint_twice): Call + gdb_call_async_signal_handler instead of + mark_async_signal_handler. + 2014-07-07 Tom Tromey * target-delegates.c: Rebuild. -- 1.9.3