From 1692877d4338eb1db9f697ced3e6fc9760c07332 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: (cherry picked from commit e0588d2110a2eeac6d3456ff8e0bbf64f43e91db) --- os/backtrace.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/os/backtrace.c b/os/backtrace.c index 659126a6a..59fb9aef3 100644 --- a/os/backtrace.c +++ b/os/backtrace.c @@ -92,13 +92,13 @@ print_registers(int frame, unw_cursor_t cursor) ErrorFSigSafe("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) { ErrorFSigSafe("unw_get_reg(%s) failed: %s [%d]\n", regs[i].name, unw_strerror(ret), ret); } else { - ErrorFSigSafe(" %s: 0x%" PRIx64 "\n", regs[i].name, val); + ErrorFSigSafe(" %s: 0x%" PRIxPTR "\n", regs[i].name, val); } } }