From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27562 invoked by alias); 28 Dec 2007 01:35:17 -0000 Received: (qmail 27554 invoked by uid 22791); 28 Dec 2007 01:35:17 -0000 X-Spam-Check-By: sourceware.org Received: from pool-96-233-37-220.bstnma.fios.verizon.net (HELO ednor.cgf.cx) (96.233.37.220) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 28 Dec 2007 01:34:59 +0000 Received: by ednor.cgf.cx (Postfix, from userid 201) id 5D8612B352; Thu, 27 Dec 2007 20:34:57 -0500 (EST) Date: Fri, 28 Dec 2007 04:33:00 -0000 From: Christopher Faylor To: gdb-patches@sourceware.org Subject: Re: PR/2386 [2/2]: MinGW attach to process without an exec file Message-ID: <20071228013457.GB7602@ednor.casa.cgf.cx> Mail-Followup-To: gdb-patches@sourceware.org References: <47744F9C.8040604@portugalmail.pt> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <47744F9C.8040604@portugalmail.pt> User-Agent: Mutt/1.5.16 (2007-06-09) 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: 2007-12/txt/msg00429.txt.bz2 On Fri, Dec 28, 2007 at 01:21:32AM +0000, Pedro Alves wrote: > The target_pid_to_exec_file MinGW implementation > win32-nat.c:win32_pid_to_exec_file is currently an empty stub, > as I mentioned on http://sourceware.org/ml/gdb/2007-10/msg00104.html. > > This patch fills the gap. The patch covers 9x/NT, and tries to > work even if psapi.dll isn't present, as it isn't part of > the OS. To do that, it has to resort to non documented > NT funcionality... If that doesn't work, it falls back > into using psapi.dll. I'd be very happy if someone could > point me at better ways to get at executable from a PID on > Windows, or at a filename from a file handle. Note that de > documented way to use a mapping relies on psapi.dll. > > This is also useful when debugging a native win32 app > from a Cygwin gdb. > > Tested on XP Pro SP2, i686-pc-cygwin, no changes. > > OK ? I'm not going to comment on the MinGW aspects of this other than to note that I think it is rather intrusive and I don't worrying about ancient Windows versions is a good idea. If you want to get the process name from a cygwin pid you just use the /proc interface. cgf