Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Sourceware to Gerrit sync (Code Review)" <gerrit@gnutoolchain-gerrit.osci.io>
To: Tom Tromey <tromey@sourceware.org>, gdb-patches@sourceware.org
Subject: [pushed] Report GetLastError value when DebugActiveProcess fails
Date: Tue, 19 Nov 2019 15:38:00 -0000	[thread overview]
Message-ID: <20191119153807.6E8D72816F@gnutoolchain-gerrit.osci.io> (raw)
In-Reply-To: <gerrit.1573749658000.Ie1bf502a0d96bb7c09bd5b1c5e0c924ba58cd68c@gnutoolchain-gerrit.osci.io>

The original change was created by Tom Tromey.

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/629
......................................................................

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  <tromey@adacore.com>

	* windows-nat.c (windows_nat_target::attach): Include GetLastError
	result in error when DebugActiveProcess fails.

Change-Id: Ie1bf502a0d96bb7c09bd5b1c5e0c924ba58cd68c
---
M gdb/ChangeLog
M gdb/windows-nat.c
2 files changed, 7 insertions(+), 1 deletion(-)



diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 80ec8f3..0305d67 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2019-11-19  Tom Tromey  <tromey@adacore.com>
+
+	* windows-nat.c (windows_nat_target::attach): Include GetLastError
+	result in error when DebugActiveProcess fails.
+
 2019-11-18  Sergio Durigan Junior  <sergiodj@redhat.com>
 	    Pedro Alves  <palves@redhat.com>
 
diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index 5901f63..fdc21f3 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -1983,7 +1983,8 @@
 #endif
 
   if (!ok)
-    error (_("Can't attach to process."));
+    error (_("Can't attach to process %u (error %u)"),
+	   (unsigned) pid, (unsigned) GetLastError ());
 
   DebugSetProcessKillOnExit (FALSE);
 

-- 
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: Ie1bf502a0d96bb7c09bd5b1c5e0c924ba58cd68c
Gerrit-Change-Number: 629
Gerrit-PatchSet: 2
Gerrit-Owner: Tom Tromey <tromey@sourceware.org>
Gerrit-Reviewer: Tom Tromey <tromey@sourceware.org>
Gerrit-MessageType: newpatchset


  parent reply	other threads:[~2019-11-19 15:38 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-14 16:41 [review] " Tom Tromey (Code Review)
2019-11-14 16:54 ` Eli Zaretskii
2019-11-14 16:58   ` Tom Tromey
2019-11-19 15:33 ` Tom Tromey (Code Review)
2019-11-19 15:38 ` Sourceware to Gerrit sync (Code Review) [this message]
2019-11-19 15:38 ` [pushed] " Sourceware to Gerrit sync (Code Review)

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=20191119153807.6E8D72816F@gnutoolchain-gerrit.osci.io \
    --to=gerrit@gnutoolchain-gerrit.osci.io \
    --cc=gdb-patches@sourceware.org \
    --cc=noreply@gnutoolchain-gerrit.osci.io \
    --cc=tromey@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