From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29575 invoked by alias); 26 Nov 2009 22:30:41 -0000 Received: (qmail 29546 invoked by uid 22791); 26 Nov 2009 22:30:40 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 26 Nov 2009 22:30:35 +0000 Received: (qmail 12227 invoked from network); 26 Nov 2009 22:30:33 -0000 Received: from unknown (HELO orlando) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 26 Nov 2009 22:30:33 -0000 From: Pedro Alves To: gdb-patches@sourceware.org Subject: Re: gdbserver/win32, fix ctrl-c handling. Date: Thu, 26 Nov 2009 22:30:00 -0000 User-Agent: KMail/1.9.10 References: <200911262228.04610.pedro@codesourcery.com> In-Reply-To: <200911262228.04610.pedro@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200911262230.34939.pedro@codesourcery.com> X-IsSubscribed: yes 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: 2009-11/txt/msg00577.txt.bz2 On Thursday 26 November 2009 22:28:04, Pedro Alves wrote: > Sometimes, a win32 gdbserver would ignore a ctrl-c, because > this > > remote-utils.c:input_interrupt: > > if (cc != 1 || c != '\003' || current_inferior == NULL) > { > fprintf (stderr, "input_interrupt, count = %d c = %d ('%c')\n", > cc, c, c); > return; > } > > was being reached with current_inferior == NULL. current_inferior > ends up set to NULL after a EXIT_THREAD_DEBUG_EVENT event. Between > a thread exit event and any other event that forced a curren_inferiot > switch, ctrl-c's where ignored. I've applied this patch to handle it > like linux-low.c does. When a thread exits, switch to any thread > other thread (always the first in the thread list, just because it's > simple and handy). > Here's the patch. 2009-11-26 Pedro Alves Issue #7133. gdb/gdbserver/ * win32-low.c (get_child_debug_event): On EXIT_THREAD_DEBUG_EVENT events, don't leave current_inferior pointing at null. -- Pedro Alves --- gdb/gdbserver/win32-low.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) Index: src/gdb/gdbserver/win32-low.c =================================================================== --- src.orig/gdb/gdbserver/win32-low.c 2009-11-26 19:20:21.000000000 +0000 +++ src/gdb/gdbserver/win32-low.c 2009-11-26 19:20:27.000000000 +0000 @@ -1438,10 +1438,6 @@ get_child_debug_event (struct target_wai gotevent: - ptid = debug_event_ptid (¤t_event); - current_inferior = - (struct thread_info *) find_inferior_id (&all_threads, ptid); - switch (current_event.dwDebugEventCode) { case CREATE_THREAD_DEBUG_EVENT: @@ -1463,7 +1459,9 @@ get_child_debug_event (struct target_wai (unsigned) current_event.dwThreadId)); child_delete_thread (current_event.dwProcessId, current_event.dwThreadId); - break; + + current_inferior = (struct thread_info *) all_threads.head; + return 1; case CREATE_PROCESS_DEBUG_EVENT: OUTMSG2 (("gdbserver: kernel event CREATE_PROCESS_DEBUG_EVENT " @@ -1558,6 +1556,7 @@ get_child_debug_event (struct target_wai break; } + ptid = debug_event_ptid (¤t_event); current_inferior = (struct thread_info *) find_inferior_id (&all_threads, ptid); return 1;