From: Oswald Buddenhagen <oswald.buddenhagen@trolltech.de>
To: gdb-patches@sourceware.org
Subject: make attaching to stopped processes work under windows
Date: Fri, 27 Feb 2009 15:04:00 -0000 [thread overview]
Message-ID: <20090226192552.GB15958@troll08.nokia.trolltech.de> (raw)
[-- 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)
next reply other threads:[~2009-02-26 19:25 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-27 15:04 Oswald Buddenhagen [this message]
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
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=20090226192552.GB15958@troll08.nokia.trolltech.de \
--to=oswald.buddenhagen@trolltech.de \
--cc=gdb-patches@sourceware.org \
/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