From e0588d2110a2eeac6d3456ff8e0bbf64f43e91db Mon Sep 17 00:00:00 2001 From: Doug Johnson Date: Tue, 14 Jan 2025 22:52:01 +0000 Subject: [PATCH] os: backtrace: Fix -Wincompatible-pointer-types compiler error on 32-bit targets MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ``` ../os/backtrace.c: In function ‘print_registers’: ../os/backtrace.c:94:52: error: passing argument 3 of ‘_ULarm_get_reg’ from incompatible pointer type [-Wincompatible-pointer-types] 94 | ret = unw_get_reg(&cursor, regs[i].regnum, &val); | ^~~~ | | | uint64_t * {aka long long unsigned int *} ``` Switched to libunwind's un_word_t type and PRIxPTR fprintf fmt specification Part-of: --- os/backtrace.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/os/backtrace.c b/os/backtrace.c index 421d9fae4..aaa27d29e 100644 --- a/os/backtrace.c +++ b/os/backtrace.c @@ -90,13 +90,13 @@ print_registers(int frame, unw_cursor_t cursor) ErrorF("Registers at frame #%d:\n", frame); for (i = 0; i < num_regs; i++) { - uint64_t val; + unw_word_t val; ret = unw_get_reg(&cursor, regs[i].regnum, &val); if (ret < 0) { ErrorF("unw_get_reg(%s) failed: %s [%d]\n", regs[i].name, unw_strerror(ret), ret); } else { - ErrorF(" %s: 0x%" PRIx64 "\n", regs[i].name, val); + ErrorF(" %s: 0x%" PRIxPTR "\n", regs[i].name, val); } } }