* [review] Report GetLastError value when DebugActiveProcess fails
@ 2019-11-14 16:41 Tom Tromey (Code Review)
2019-11-14 16:54 ` Eli Zaretskii
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Tom Tromey (Code Review) @ 2019-11-14 16:41 UTC (permalink / raw)
To: gdb-patches
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-14 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 719574f..f709df7 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2019-11-14 Tom Tromey <tromey@adacore.com>
+
+ * windows-nat.c (windows_nat_target::attach): Include GetLastError
+ result in error when DebugActiveProcess fails.
+
2019-11-14 Simon Marchi <simon.marchi@polymtl.ca>
* unittests/vec-utils-selftests.c (unordered_remove_tests::obj):
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: 1
Gerrit-Owner: Tom Tromey <tromey@sourceware.org>
Gerrit-MessageType: newchange
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [review] Report GetLastError value when DebugActiveProcess fails
2019-11-14 16:41 [review] Report GetLastError value when DebugActiveProcess fails 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)
` (2 subsequent siblings)
3 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2019-11-14 16:54 UTC (permalink / raw)
To: tromey, gdb-patches
> Date: Thu, 14 Nov 2019 11:40:58 -0500
> From: "Tom Tromey (Code Review)" <gerrit@gnutoolchain-gerrit.osci.io>
>
> --- 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 ());
Why not show the text that corresponds to the error code? A lone code
is not very descriptive, IME.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [review] Report GetLastError value when DebugActiveProcess fails
2019-11-14 16:54 ` Eli Zaretskii
@ 2019-11-14 16:58 ` Tom Tromey
0 siblings, 0 replies; 6+ messages in thread
From: Tom Tromey @ 2019-11-14 16:58 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: tromey, gdb-patches
>>>>> "Eli" == Eli Zaretskii <eliz@gnu.org> writes:
>> Date: Thu, 14 Nov 2019 11:40:58 -0500
>> From: "Tom Tromey (Code Review)" <gerrit@gnutoolchain-gerrit.osci.io>
>>
>> --- 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 ());
Eli> Why not show the text that corresponds to the error code? A lone code
Eli> is not very descriptive, IME.
I plan to do that in the future. I didn't do it yet because there's no
convenient way to do it (there's a helper function in gdbserver but not
gdb; but maybe we're going to use some gnulib thing instead?); and
because doing a good job would mean fixing all such calls in
windows-nat.c.
Meanwhile, I needed this one.
Tom
^ permalink raw reply [flat|nested] 6+ messages in thread
* [review] Report GetLastError value when DebugActiveProcess fails
2019-11-14 16:41 [review] Report GetLastError value when DebugActiveProcess fails Tom Tromey (Code Review)
2019-11-14 16:54 ` Eli Zaretskii
@ 2019-11-19 15:33 ` Tom Tromey (Code Review)
2019-11-19 15:38 ` [pushed] " Sourceware to Gerrit sync (Code Review)
2019-11-19 15:38 ` Sourceware to Gerrit sync (Code Review)
3 siblings, 0 replies; 6+ messages in thread
From: Tom Tromey (Code Review) @ 2019-11-19 15:33 UTC (permalink / raw)
To: gdb-patches
Tom Tromey has posted comments on this change.
Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/629
......................................................................
Patch Set 1:
I'm checking this in now.
--
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: Ie1bf502a0d96bb7c09bd5b1c5e0c924ba58cd68c
Gerrit-Change-Number: 629
Gerrit-PatchSet: 1
Gerrit-Owner: Tom Tromey <tromey@sourceware.org>
Gerrit-Reviewer: Tom Tromey <tromey@sourceware.org>
Gerrit-Comment-Date: Tue, 19 Nov 2019 15:33:41 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
^ permalink raw reply [flat|nested] 6+ messages in thread
* [pushed] Report GetLastError value when DebugActiveProcess fails
2019-11-14 16:41 [review] Report GetLastError value when DebugActiveProcess fails Tom Tromey (Code Review)
2019-11-14 16:54 ` Eli Zaretskii
2019-11-19 15:33 ` Tom Tromey (Code Review)
@ 2019-11-19 15:38 ` Sourceware to Gerrit sync (Code Review)
2019-11-19 15:38 ` Sourceware to Gerrit sync (Code Review)
3 siblings, 0 replies; 6+ messages in thread
From: Sourceware to Gerrit sync (Code Review) @ 2019-11-19 15:38 UTC (permalink / raw)
To: Tom Tromey, gdb-patches
Sourceware to Gerrit sync has submitted this change.
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: merged
^ permalink raw reply [flat|nested] 6+ messages in thread
* [pushed] Report GetLastError value when DebugActiveProcess fails
2019-11-14 16:41 [review] Report GetLastError value when DebugActiveProcess fails Tom Tromey (Code Review)
` (2 preceding siblings ...)
2019-11-19 15:38 ` [pushed] " Sourceware to Gerrit sync (Code Review)
@ 2019-11-19 15:38 ` Sourceware to Gerrit sync (Code Review)
3 siblings, 0 replies; 6+ messages in thread
From: Sourceware to Gerrit sync (Code Review) @ 2019-11-19 15:38 UTC (permalink / raw)
To: Tom Tromey, gdb-patches
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
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2019-11-19 15:38 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-14 16:41 [review] Report GetLastError value when DebugActiveProcess fails 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 ` [pushed] " Sourceware to Gerrit sync (Code Review)
2019-11-19 15:38 ` Sourceware to Gerrit sync (Code Review)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox