public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] gdb, btrace: fix error diagnostics
@ 2024-03-11 11:34 Markus Metzger
0 siblings, 0 replies; only message in thread
From: Markus Metzger @ 2024-03-11 11:34 UTC (permalink / raw)
To: gdb-cvs
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=b792eb47f25f577ccef365fc9a5c20d55fad42d5
commit b792eb47f25f577ccef365fc9a5c20d55fad42d5
Author: Markus Metzger <markus.t.metzger@intel.com>
Date: Fri Feb 18 13:53:31 2022 +0100
gdb, btrace: fix error diagnostics
When we improved error messages in
cd393cec3ab gdb, btrace: improve error messages
we cleared the original errno. When the error reason can not be explained
in a more detailed error message, and we fall back to the default error
message, it now gives Success as error.
Restore the original errno to fix that.
Diff:
---
gdb/nat/linux-btrace.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/gdb/nat/linux-btrace.c b/gdb/nat/linux-btrace.c
index 50de2415589..f8352b62b8b 100644
--- a/gdb/nat/linux-btrace.c
+++ b/gdb/nat/linux-btrace.c
@@ -422,7 +422,8 @@ cpu_supports_bts (void)
static void
diagnose_perf_event_open_fail ()
{
- switch (errno)
+ int orig_errno = errno;
+ switch (orig_errno)
{
case EPERM:
case EACCES:
@@ -443,7 +444,7 @@ diagnose_perf_event_open_fail ()
break;
}
- error (_("Failed to start recording: %s"), safe_strerror (errno));
+ error (_("Failed to start recording: %s"), safe_strerror (orig_errno));
}
/* Get the linux version of a btrace_target_info. */
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-03-11 11:34 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-11 11:34 [binutils-gdb] gdb, btrace: fix error diagnostics Markus Metzger
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).