diff options
author | Luis Machado <luis.machado@linaro.org> | 2021-10-01 13:25:47 -0300 |
---|---|---|
committer | Luis Machado <luis.machado@linaro.org> | 2021-10-01 13:31:55 -0300 |
commit | beed8c1dbde20642e023694754032ccba812a97f (patch) | |
tree | 4ac5bc7f720c9090a8d5d2030a48f155f68fb6c8 | |
parent | dd6f2df79d002a1f76b38d75732f7b3534c2df4a (diff) | |
download | gdb-beed8c1dbde20642e023694754032ccba812a97f.zip gdb-beed8c1dbde20642e023694754032ccba812a97f.tar.gz gdb-beed8c1dbde20642e023694754032ccba812a97f.tar.bz2 |
Fix build failure for 32-bit targets
When building master GDB, I ran into the following:
binutils-gdb/gdb/bt-utils.c: In function 'int libbacktrace_print(void*, uintptr_t, const char*, int, const char*)':
binutils-gdb/gdb/bt-utils.c:93:44: error: format '%lx' expects argument of type 'long unsigned int', but argument 4 has type 'uintptr_t {aka unsigned int}' [-Werror=format=]
snprintf (buf, sizeof (buf), "0x%lx ", pc);
Fix this by using %PRIxPTR as opposed to %lx.
-rw-r--r-- | gdb/bt-utils.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/gdb/bt-utils.c b/gdb/bt-utils.c index 79e6e09..dfe429e 100644 --- a/gdb/bt-utils.c +++ b/gdb/bt-utils.c @@ -90,7 +90,7 @@ libbacktrace_print (void *data, uintptr_t pc, const char *filename, files. We are also careful to ensure we don't overflow this buffer. */ char buf[20]; - snprintf (buf, sizeof (buf), "0x%lx ", pc); + snprintf (buf, sizeof (buf), "0x%" PRIxPTR " ", pc); buf[sizeof (buf) - 1] = '\0'; sig_write (buf); sig_write (function == nullptr ? "???" : function); |