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 ()) {