This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: PR/2386 [2/2]: MinGW attach to process without an exec file
- From: Christopher Faylor <cgf-use-the-mailinglist-please at sourceware dot org>
- To: gdb-patches at sourceware dot org
- Date: Thu, 27 Dec 2007 20:34:57 -0500
- Subject: Re: PR/2386 [2/2]: MinGW attach to process without an exec file
- References: <47744F9C.8040604@portugalmail.pt>
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