Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* make attaching to stopped processes work under windows
@ 2009-02-27 15:04 Oswald Buddenhagen
  2009-02-28  7:15 ` Christopher Faylor
  0 siblings, 1 reply; 17+ messages in thread
From: Oswald Buddenhagen @ 2009-02-27 15:04 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 227 bytes --]

hi,

the rationale is in the patch itself; i can factor it out to the commit
message if preferred.

	* windows-nat.c (get_windows_debug_event): If we find the thread
	  from the CREATE_PROCESS_DEBUG_EVENT suspended, resume it.

[-- Attachment #2: _gdb_windows-attach-suspended.diff --]
[-- Type: text/x-diff, Size: 1229 bytes --]

Index: windows-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/windows-nat.c,v
retrieving revision 1.179
diff -U2 -r1.179 windows-nat.c
--- windows-nat.c	6 Feb 2009 22:21:26 -0000	1.179
+++ windows-nat.c	13 Feb 2009 15:39:41 -0000
@@ -1331,4 +1331,21 @@
 	break;
 
+      /* Resume main thread if we are attaching to a suspended
+	 process.
+	 Note that we are not trying to handle multi-threaded
+	 situations, as these are likely to be too complex anyway.
+	 This is primarily meant to cover the case where someone
+	 creates a process in suspended state and hands it over
+	 to gdb (this is an abstraction - you cannot actually do
+	 that due to Windows bugs. You need to start debugging the
+	 process yourself, and once it has started up, you suspend
+	 it and detach from it). */
+      if (SuspendThread (current_event.u.CreateProcessInfo.hThread) == 2)
+	{
+	  printf_unfiltered ("gdb: thawing initially frozen thread.\n");
+	  ResumeThread (current_event.u.CreateProcessInfo.hThread);
+	}
+      CHECK (ResumeThread (current_event.u.CreateProcessInfo.hThread));
+
       current_process_handle = current_event.u.CreateProcessInfo.hProcess;
       if (main_thread_id)

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2009-03-10  9:01 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-27 15:04 make attaching to stopped processes work under windows Oswald Buddenhagen
2009-02-28  7:15 ` Christopher Faylor
2009-03-02 10:07   ` Oswald Buddenhagen
2009-03-02 17:23     ` Joel Brobecker
2009-03-02 18:28       ` Oswald Buddenhagen
2009-03-02 19:18         ` Eli Zaretskii
2009-03-02 19:55           ` Oswald Buddenhagen
2009-03-02 21:21             ` Eli Zaretskii
2009-03-03  5:21               ` Christopher Faylor
2009-03-03 12:05                 ` Oswald Buddenhagen
2009-03-08 19:32                   ` Christopher Faylor
2009-03-09 18:45                     ` Joel Brobecker
2009-03-09 20:51                     ` Oswald Buddenhagen
2009-03-10  8:52                       ` Christopher Faylor
2009-03-10 13:37                         ` Oswald Buddenhagen
2009-03-03  5:41         ` Christopher Faylor
2009-03-02 19:14       ` Eli Zaretskii

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox