Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Brian Ford <ford@vss.fsi.com>
To: cygwin@cygwin.com
Cc: gdb-patches@sources.redhat.com
Subject: Re: Fall back from Windows to cygwin PIDs
Date: Wed, 29 Jan 2003 16:29:00 -0000	[thread overview]
Message-ID: <Pine.GSO.4.44.0301290958350.25762-200000@eos> (raw)
In-Reply-To: <Pine.GSO.4.44.0301071058530.544-200000@eos>

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1007 bytes --]

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

[-- Attachment #2: Type: TEXT/PLAIN, Size: 1334 bytes --]

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

  reply	other threads:[~2003-01-29 16:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-06 19:24 Fall back from Windows to Cygwin PIDs Brian Ford
2003-01-07 16:57 ` Fall back from Windows to cygwin PIDs Christopher Faylor
2003-01-07 17:03   ` Brian Ford
2003-01-29 16:29     ` Brian Ford [this message]
2003-01-30  1:40       ` Christopher Faylor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.GSO.4.44.0301290958350.25762-200000@eos \
    --to=ford@vss.fsi.com \
    --cc=cygwin@cygwin.com \
    --cc=gdb-patches@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox