https://github.com/RossComputerGuy updated https://github.com/llvm/llvm-project/pull/129084
>From 9357008872e3b12b3601a45d4fd5453dfa779ff3 Mon Sep 17 00:00:00 2001 From: Tristan Ross <tristan.r...@midstall.com> Date: Thu, 27 Feb 2025 09:10:22 -0800 Subject: [PATCH] [libunwind] Add unw_strerror function Co-authored-by: Randy Eckenrode <ra...@largeandhighquality.com> --- libunwind/include/libunwind.h | 2 ++ libunwind/src/libunwind.cpp | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/libunwind/include/libunwind.h b/libunwind/include/libunwind.h index b2dae8feed9a3..839aa3dcf31c5 100644 --- a/libunwind/include/libunwind.h +++ b/libunwind/include/libunwind.h @@ -131,6 +131,8 @@ extern int unw_is_signal_frame(unw_cursor_t *) LIBUNWIND_AVAIL; extern int unw_get_proc_name(unw_cursor_t *, char *, size_t, unw_word_t *) LIBUNWIND_AVAIL; //extern int unw_get_save_loc(unw_cursor_t*, int, unw_save_loc_t*); +extern const char *unw_strerror(int) LIBUNWIND_AVAIL; + extern unw_addr_space_t unw_local_addr_space; #ifdef __cplusplus diff --git a/libunwind/src/libunwind.cpp b/libunwind/src/libunwind.cpp index cf39ec5f7dbdf..5bb40ff795bb9 100644 --- a/libunwind/src/libunwind.cpp +++ b/libunwind/src/libunwind.cpp @@ -260,6 +260,41 @@ _LIBUNWIND_HIDDEN int __unw_is_signal_frame(unw_cursor_t *cursor) { } _LIBUNWIND_WEAK_ALIAS(__unw_is_signal_frame, unw_is_signal_frame) +_LIBUNWIND_HIDDEN const char *__unw_strerror(int error_code) { + switch (error_code) { + case UNW_ESUCCESS: + return "no error"; + case UNW_EUNSPEC: + return "unspecified (general) error"; + case UNW_ENOMEM: + return "out of memory"; + case UNW_EBADREG: + return "bad register number"; + case UNW_EREADONLYREG: + return "attempt to write read-only register"; + case UNW_ESTOPUNWIND: + return "stop unwinding"; + case UNW_EINVALIDIP: + return "invalid IP"; + case UNW_EBADFRAME: + return "bad frame"; + case UNW_EINVAL: + return "unsupported operation or bad value"; + case UNW_EBADVERSION: + return "unwind info has unsupported version"; + case UNW_ENOINFO: + return "no unwind info found"; +#if defined(_LIBUNWIND_TARGET_AARCH64) && !defined(_LIBUNWIND_IS_NATIVE_ONLY) + case UNW_ECROSSRASIGNING: + return "cross unwind with return address signing"; +#endif + default: + return "unknown error occurred"; + } +} +} +_LIBUNWIND_WEAK_ALIAS(__unw_strerror, unw_strerror) + #ifdef _AIX _LIBUNWIND_EXPORT uintptr_t __unw_get_data_rel_base(unw_cursor_t *cursor) { _LIBUNWIND_TRACE_API("unw_get_data_rel_base(cursor=%p)", _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits