From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12174 invoked by alias); 19 Nov 2019 16:22:29 -0000 Mailing-List: contact gdb-testers-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-testers-owner@sourceware.org Received: (qmail 12163 invoked by uid 89); 19 Nov 2019 16:22:29 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-15.0 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: kwanyin.sergiodj.net Received: from kwanyin.sergiodj.net (HELO kwanyin.sergiodj.net) (158.69.185.54) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 19 Nov 2019 16:22:28 +0000 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [binutils-gdb] Report GetLastError value when DebugActiveProcess fails From: gdb-buildbot@sergiodj.net To: gdb-testers@sourceware.org Message-Id: Date: Tue, 19 Nov 2019 16:22:00 -0000 X-SW-Source: 2019-q4/txt/msg02431.txt.bz2 *** TEST RESULTS FOR COMMIT c9739b6a06730b65df135766dec4c4d14d78bd38 *** commit c9739b6a06730b65df135766dec4c4d14d78bd38 Author: Tom Tromey AuthorDate: Wed Nov 6 09:43:52 2019 -0700 Commit: Tom Tromey CommitDate: Tue Nov 19 08:33:53 2019 -0700 Report GetLastError value when DebugActiveProcess fails When DebugActiveProcess fails, the error message is fairly generic: error (_("Can't attach to process.")); It would be more useful for diagnosing problems if the Windows error code was included in the message. This patch implements this. gdb/ChangeLog 2019-11-19 Tom Tromey * windows-nat.c (windows_nat_target::attach): Include GetLastError result in error when DebugActiveProcess fails. Change-Id: Ie1bf502a0d96bb7c09bd5b1c5e0c924ba58cd68c diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 80ec8f3522..0305d67bd6 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2019-11-19 Tom Tromey + + * windows-nat.c (windows_nat_target::attach): Include GetLastError + result in error when DebugActiveProcess fails. + 2019-11-18 Sergio Durigan Junior Pedro Alves diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c index 5901f63b28..fdc21f38bf 100644 --- a/gdb/windows-nat.c +++ b/gdb/windows-nat.c @@ -1983,7 +1983,8 @@ windows_nat_target::attach (const char *args, int from_tty) #endif if (!ok) - error (_("Can't attach to process.")); + error (_("Can't attach to process %u (error %u)"), + (unsigned) pid, (unsigned) GetLastError ()); DebugSetProcessKillOnExit (FALSE);