From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14148 invoked by alias); 26 Feb 2009 19:25:41 -0000 Received: (qmail 14133 invoked by uid 22791); 26 Feb 2009 19:25:41 -0000 X-SWARE-Spam-Status: No, hits=-0.3 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from smtp.nokia.com (HELO mgw-mx06.nokia.com) (192.100.122.233) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 26 Feb 2009 19:25:28 +0000 Received: from vaebh105.NOE.Nokia.com (vaebh105.europe.nokia.com [10.160.244.31]) by mgw-mx06.nokia.com (Switch-3.2.6/Switch-3.2.6) with ESMTP id n1QJPHor003200 for ; Thu, 26 Feb 2009 21:25:23 +0200 Received: from vaebh104.NOE.Nokia.com ([10.160.244.30]) by vaebh105.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 26 Feb 2009 21:24:57 +0200 Received: from mgw-int01.ntc.nokia.com ([172.21.143.96]) by vaebh104.NOE.Nokia.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.3959); Thu, 26 Feb 2009 21:24:54 +0200 Received: from troll08.nokia.trolltech.de (bett-ws017.europe.nokia.com [172.25.167.41]) by mgw-int01.ntc.nokia.com (Switch-3.2.5/Switch-3.2.5) with SMTP id n1QJOqUA014239 for ; Thu, 26 Feb 2009 21:24:52 +0200 Date: Fri, 27 Feb 2009 15:04:00 -0000 From: Oswald Buddenhagen To: gdb-patches@sourceware.org Subject: make attaching to stopped processes work under windows Message-ID: <20090226192552.GB15958@troll08.nokia.trolltech.de> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="UHN/qo2QbUvPLonB" Content-Disposition: inline User-Agent: Mutt/1.5.17+20080114 (2008-01-14) X-Nokia-AV: Clean 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-02/txt/msg00491.txt.bz2 --UHN/qo2QbUvPLonB Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 227 hi, the rationale is in the patch itself; i can factor it out to the commit message if preferred. * windows-nat.c (get_windows_debug_event): If we find the thread from the CREATE_PROCESS_DEBUG_EVENT suspended, resume it. --UHN/qo2QbUvPLonB Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="_gdb_windows-attach-suspended.diff" Content-length: 1229 Index: windows-nat.c =================================================================== RCS file: /cvs/src/src/gdb/windows-nat.c,v retrieving revision 1.179 diff -U2 -r1.179 windows-nat.c --- windows-nat.c 6 Feb 2009 22:21:26 -0000 1.179 +++ windows-nat.c 13 Feb 2009 15:39:41 -0000 @@ -1331,4 +1331,21 @@ break; + /* Resume main thread if we are attaching to a suspended + process. + Note that we are not trying to handle multi-threaded + situations, as these are likely to be too complex anyway. + This is primarily meant to cover the case where someone + creates a process in suspended state and hands it over + to gdb (this is an abstraction - you cannot actually do + that due to Windows bugs. You need to start debugging the + process yourself, and once it has started up, you suspend + it and detach from it). */ + if (SuspendThread (current_event.u.CreateProcessInfo.hThread) == 2) + { + printf_unfiltered ("gdb: thawing initially frozen thread.\n"); + ResumeThread (current_event.u.CreateProcessInfo.hThread); + } + CHECK (ResumeThread (current_event.u.CreateProcessInfo.hThread)); + current_process_handle = current_event.u.CreateProcessInfo.hProcess; if (main_thread_id) --UHN/qo2QbUvPLonB--