public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] Report GetLastError value when DebugActiveProcess fails
@ 2019-11-19 15:36 Tom Tromey
  0 siblings, 0 replies; only message in thread
From: Tom Tromey @ 2019-11-19 15:36 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=c9739b6a06730b65df135766dec4c4d14d78bd38

commit c9739b6a06730b65df135766dec4c4d14d78bd38
Author: Tom Tromey <tromey@adacore.com>
Date:   Wed Nov 6 09:43:52 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  <tromey@adacore.com>
    
    	* windows-nat.c (windows_nat_target::attach): Include GetLastError
    	result in error when DebugActiveProcess fails.
    
    Change-Id: Ie1bf502a0d96bb7c09bd5b1c5e0c924ba58cd68c

Diff:
---
 gdb/ChangeLog     | 5 +++++
 gdb/windows-nat.c | 3 ++-
 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 @@ 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);


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-11-19 15:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-19 15:36 [binutils-gdb] Report GetLastError value when DebugActiveProcess fails Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).