4 #ifndef __SANITIZER_COMMON_PRINT_ADDRESS_H__
5 # define __SANITIZER_COMMON_PRINT_ADDRESS_H__
7 void print_address(const char *str
, int n
, ...) {
8 fprintf(stderr
, "%s", str
);
12 void *p
= va_arg(ap
, void *);
13 #if defined(__x86_64__) || defined(__aarch64__) || defined(__powerpc64__) || \
14 defined(__s390x__) || (defined(__riscv) && __riscv_xlen == 64) || \
15 defined(__loongarch_lp64)
16 // On FreeBSD, the %p conversion specifier works as 0x%x and thus does not
17 // match to the format used in the diagnotic message.
18 fprintf(stderr
, "0x%012lx ", (unsigned long) p
);
19 #elif defined(__i386__) || defined(__arm__)
20 fprintf(stderr
, "0x%08lx ", (unsigned long) p
);
21 #elif defined(__mips64)
22 fprintf(stderr
, "0x%010lx ", (unsigned long) p
);
25 fprintf(stderr
, "\n");
28 #endif // __SANITIZER_COMMON_PRINT_ADDRESS_H__