From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 74093 invoked by alias); 3 Jun 2015 17:30:55 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 74016 invoked by uid 89); 3 Jun 2015 17:30:55 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.1 required=5.0 tests=AWL,BAYES_50,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_NONE autolearn=no version=3.3.2 X-HELO: rgout0501.bt.lon5.cpcloud.co.uk Received: from rgout0501.bt.lon5.cpcloud.co.uk (HELO rgout0501.bt.lon5.cpcloud.co.uk) (65.20.0.222) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 03 Jun 2015 17:30:48 +0000 X-OWM-Source-IP: 31.51.205.195(GB) X-OWM-Env-Sender: jonturney@btinternet.com X-CTCH-RefID: str=0001.0A090205.556F39C8.007B,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0 X-Junkmail-Premium-Raw: score=27/50,refid=2.7.2:2015.6.2.130915:17:27.888,ip=31.51.205.195,rules=__HAS_FROM, __TO_MALFORMED_2, __TO_NO_NAME, __HAS_MSGID, __SANE_MSGID, __HAS_X_MAILER, __IN_REP_TO, __REFERENCES, __ANY_URI, URI_ENDS_IN_HTML, __URI_NO_WWW, __URI_NO_PATH, BODYTEXTP_SIZE_3000_LESS, BODY_SIZE_2000_2999, __MIME_TEXT_ONLY, RDNS_GENERIC_POOLED, __URI_NS, SXL_IP_DYNAMIC[195.205.51.31.fur], HTML_00_01, HTML_00_10, BODY_SIZE_5000_LESS, RDNS_SUSP_GENERIC, RDNS_SUSP, BODY_SIZE_7000_LESS, REFERENCES X-CTCH-Spam: Unknown Received: from localhost.localdomain (31.51.205.195) by rgout05.bt.lon5.cpcloud.co.uk (8.6.122.06) (authenticated as jonturney@btinternet.com) id 556DA854008F2A08; Wed, 3 Jun 2015 18:30:40 +0100 From: Jon Turney To: gdb-patches@sourceware.org Cc: Jon Turney Subject: [PATCH 4/4] windows-nat: Also ignore ERROR_INVALID_HANDLE from SuspendThread() Date: Wed, 03 Jun 2015 17:30:00 -0000 Message-Id: <1433352592-9728-6-git-send-email-jon.turney@dronecode.org.uk> In-Reply-To: <1433352592-9728-1-git-send-email-jon.turney@dronecode.org.uk> References: <1433352592-9728-1-git-send-email-jon.turney@dronecode.org.uk> X-SW-Source: 2015-06/txt/msg00051.txt.bz2 Discussed somewhat in the thread at https://cygwin.com/ml/gdb-patches/2013-06/msg00680.html This is pretty straightforward to demonstrate on Cygwin currently: $ cat main.c int main() { return 0; } $ gcc -g -O0 main.c -o main $ ./gdb ./main [...] (gdb) r Starting program: /wip/binutils-gdb/build.x86_64/gdb/main warning: SuspendThread (tid=0x1cf0) failed. (winerr 6) [Inferior 1 (process 976) exited normally] with this patch applied: $ ./gdb ./main [...] (gdb) r Starting program: /wip/binutils-gdb/build.x86_64/gdb/main [Inferior 1 (process 4852) exited normally] gdb/ChangeLog: 2015-06-03 Jon Turney * windows-nat.c (thread_rec): Also ignore ERROR_INVALID_HANDLE from SuspendThread(). Signed-off-by: Jon Turney --- gdb/ChangeLog | 5 +++++ gdb/windows-nat.c | 7 +++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 996dffe..eddcf4d 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,10 @@ 2015-06-03 Jon Turney + * windows-nat.c (thread_rec): Also ignore ERROR_INVALID_HANDLE + from SuspendThread(). + +2015-06-03 Jon Turney + * windows-nat.c : Consistently use numeric get_context parameter to thread_rec() throughout. diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c index ce1513f..75d9414 100644 --- a/gdb/windows-nat.c +++ b/gdb/windows-nat.c @@ -310,8 +310,11 @@ thread_rec (DWORD id, int get_context) /* We get Access Denied (5) when trying to suspend threads that Windows started on behalf of the debuggee, usually when those threads are just - about to exit. */ - if (err != ERROR_ACCESS_DENIED) + about to exit. + We can get Invalid Handle (6) if the main thread + has exited. */ + if (err != ERROR_INVALID_HANDLE + && err != ERROR_ACCESS_DENIED) warning (_("SuspendThread (tid=0x%x) failed." " (winerr %u)"), (unsigned) id, (unsigned) err); -- 2.1.4