Fall back from Windows to cygwin PIDs
Brian Ford
ford@vss.fsi.com
Wed Jan 29 17:15:00 GMT 2003
I haven't gotten any response from gdb-patches yet, so I thought I would
ping the cygwin list too.
I think this is a valuable addition since it adds functionality that
most UNIX users expect without changing current behavior. I also saw a
posting (gdb or cygwin, I can't remember which) that said a patch for this
would probably be accepted if submitted.
Thanks.
2003-01-29 Brian Ford <ford@vss.fsi.com>
* win32-nat.c (cygwin_pid): Removed as unused.
(child_attach): Try fall back to Cygwin pid.
> On Mon, Jan 06, 2003 at 01:23:35PM -0600, Brian Ford wrote:
>
>The attached patch attempts to fall back from Windows to Cygwin PIDs.
>This only adds functionality, without changing the previous behavior. As
>such, I believe it will lessen confusion for those expecting normal
>Unix like behavior under Cygwin. Thanks and please CC me on replies.
>
--
Brian Ford
Senior Realtime Software Engineer
VITAL - Visual Simulation Systems
FlightSafety International
Phone: 314-551-8460
Fax: 314-551-8444
-------------- next part --------------
Index: win32-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/win32-nat.c,v
retrieving revision 1.68
diff -u -p -u -p -r1.68 win32-nat.c
--- win32-nat.c 14 Jan 2003 00:49:04 -0000 1.68
+++ win32-nat.c 29 Jan 2003 16:26:36 -0000
@@ -124,7 +124,6 @@ static DEBUG_EVENT current_event; /* The
static HANDLE current_process_handle; /* Currently executing process */
static thread_info *current_thread; /* Info on currently selected thread */
static DWORD main_thread_id; /* Thread ID of the main thread */
-static pid_t cygwin_pid; /* pid of cygwin process */
/* Counts of things. */
static int exception_count = 0;
@@ -1467,12 +1466,21 @@ child_attach (char *args, int from_tty)
printf_unfiltered ("This can cause attach to fail on Windows NT/2K/XP\n");
}
- pid = strtoul (args, 0, 0);
+ pid = strtoul (args, 0, 0); /* Windows pid */
ok = DebugActiveProcess (pid);
saw_create = 0;
if (!ok)
- error ("Can't attach to process.");
+ {
+ /* Try fall back to Cygwin pid */
+ pid = cygwin_internal (CW_CYGWIN_PID_TO_WINPID, pid);
+
+ if (pid > 0)
+ ok = DebugActiveProcess (pid);
+
+ if (!ok)
+ error ("Can't attach to process.");
+ }
if (has_detach_ability ())
{
-------------- next part --------------
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
More information about the Cygwin
mailing list