gdb, btrace: fix error diagnostics
Checks
Context |
Check |
Description |
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 |
success
|
Testing passed
|
linaro-tcwg-bot/tcwg_gdb_build--master-arm |
success
|
Testing passed
|
linaro-tcwg-bot/tcwg_gdb_check--master-arm |
success
|
Testing passed
|
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 |
success
|
Testing passed
|
Commit Message
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.
---
gdb/nat/linux-btrace.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
Comments
On 07/03/2024 16:01, Markus Metzger wrote:
> 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.
Hi!
LGTM, Reviewed-By: Guinevere Larsen <blarsen@redhat.com>
>>>>> Markus Metzger <markus.t.metzger@intel.com> writes:
> 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.
Thank you. This looks good to me.
Approved-By: Tom Tromey <tom@tromey.com>
Tom
@@ -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. */