From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31763 invoked by alias); 13 Jan 2009 17:00:11 -0000 Received: (qmail 31713 invoked by uid 22791); 13 Jan 2009 17:00:08 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (65.74.133.4) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 13 Jan 2009 16:59:29 +0000 Received: (qmail 25503 invoked from network); 13 Jan 2009 16:59:27 -0000 Received: from unknown (HELO orlando.local) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 13 Jan 2009 16:59:27 -0000 From: Pedro Alves To: gdb-patches@sourceware.org Subject: Re: Issue with gdbserver --multi / remote-extended on Windows XP Date: Tue, 13 Jan 2009 17:00:00 -0000 User-Agent: KMail/1.9.10 Cc: "Dr. Rolf Jansen" , Daniel Jacobowitz References: <200811050103.23123.pedro@codesourcery.com> In-Reply-To: <200811050103.23123.pedro@codesourcery.com> MIME-Version: 1.0 Content-Disposition: inline Content-Type: Multipart/Mixed; boundary="Boundary-00=_EiMbJ6U6jfSJrQF" Message-Id: <200901131659.48833.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-01/txt/msg00280.txt.bz2 --Boundary-00=_EiMbJ6U6jfSJrQF Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Content-length: 2514 Hi, Rolf told me that this does indeed work as expected. I just finished a testsuite run against a native cygwin gdbserver on XP, and spotted no regressions. Daniel, OK to commit? On Wednesday 05 November 2008 01:03:22, Pedro Alves wrote: > On Wednesday 17 September 2008 18:35:15, Dr. Rolf Jansen wrote: > > I experimented a little bit with gdbserver --multi in remote-xtended > > mode on Windows XP and I had one major problem in debugging a gui > > application. If I regularly quit the gui app, to which gdbserver is > > attached, its open windows remain at the screen, and while although > > inresponsive they are still part of the window hierarchy of Windows. > > > > > > Observations: > > - the gui app is terminates itself by calling exit(0). > > - if I quit gdbserver, the open zombie-windows disappear > > - in non-multi/remote-extended-mode gdbserver this problem > > does not appear, because gdbserver terminates itself > > together with the application > > > > > > I found a solution that works for me, although, there might be better > > ways. > > > > At line 1456 of win32-low.c I added: > > > > TerminateProcess (current_process_handle, > > current_event.u.ExitProcess.dwExitCode); > > child_continue (DBG_TERMINATE_PROCESS, -1); > > > > > > > > This code is added in event-handler switch() of > > get_child_debug_event() and the respective case block looks now like: > > > > case EXIT_PROCESS_DEBUG_EVENT: > > OUTMSG2 (("gdbserver: kernel event EXIT_PROCESS_DEBUG_EVENT " > > "for pid=%d tid=%x\n", > > (unsigned) current_event.dwProcessId, > > (unsigned) current_event.dwThreadId)); > > ourstatus->kind = TARGET_WAITKIND_EXITED; > > ourstatus->value.integer = > > current_event.u.ExitProcess.dwExitCode; > > > > > TerminateProcess (current_process_handle, > > current_event.u.ExitProcess.dwExitCode); > > child_continue (DBG_TERMINATE_PROCESS, -1); > > > Hmm, I haven't tried this, but, are you sure you need to > terminate the process like this? Wouldn't a > child_continue (DBG_CONTINUE, -1) work here? It's what > native gdb does (it's in win32_mourn_inferior). > I can't find it now, but I'm almost sure that's documented somewhere > as required for the debugger to do (I scratched my head once at why > was win32_mourn_inferior telling the dead process to continue, and found > that out). Well, I could be wrong though. > -- Pedro Alves --Boundary-00=_EiMbJ6U6jfSJrQF Content-Type: text/x-diff; charset="iso 8859-15"; name="gdbserver_mourn.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="gdbserver_mourn.diff" Content-length: 780 2009-01-13 Pedro Alves * win32-low.c (get_child_debug_event): Issue a final DBG_CONTINUE when handling a EXIT_PROCESS_DEBUG_EVENT. --- gdb/gdbserver/win32-low.c | 1 + 1 file changed, 1 insertion(+) Index: src/gdb/gdbserver/win32-low.c =================================================================== --- src.orig/gdb/gdbserver/win32-low.c +++ src/gdb/gdbserver/win32-low.c @@ -1453,6 +1453,7 @@ get_child_debug_event (struct target_wai (unsigned) current_event.dwThreadId)); ourstatus->kind = TARGET_WAITKIND_EXITED; ourstatus->value.integer = current_event.u.ExitProcess.dwExitCode; + child_continue (DBG_CONTINUE, -1); CloseHandle (current_process_handle); current_process_handle = NULL; break; --Boundary-00=_EiMbJ6U6jfSJrQF--