[compiler-rt] Log errno (or fuchsia equivalent) on map failures (PR #95391)
Roland McGrath via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 25 17:55:19 PDT 2024
================
@@ -16,4 +19,13 @@ void die(const char *Message) {
__sanitizer_log_write(Message, strlen(Message));
__builtin_trap();
}
+
+void dieWithErrorCode(const char *Message, int64_t ErrorCode) {
+ size_t buffer_size = strlen(Message) + 48;
+ char *buffer = static_cast<char *>(alloca(buffer_size));
+ snprintf(buffer, buffer_size, "%s (Error Code: %" PRId64 ")", Message,
----------------
frobtech wrote:
This could use `zx_status_get_string(static_cast<zx_status_t>(ErrorCode))` to yield a canonical string instead of just the number, but the number is fine too. (Note that this is the `ZX_ERR_FOO` name, equivalent to the POSIX `EFOO` name as used in C programs, not the human-readable text like `strerror`).
https://github.com/llvm/llvm-project/pull/95391
More information about the llvm-commits
mailing list