]> git.proxmox.com Git - rustc.git/blob - src/compiler-rt/test/sanitizer_common/print_address.h
New upstream version 1.19.0+dfsg1
[rustc.git] / src / compiler-rt / test / sanitizer_common / print_address.h
1 #include <stdio.h>
2 #include <stdarg.h>
3
4 void print_address(const char *str, int n, ...) {
5 fprintf(stderr, "%s", str);
6 va_list ap;
7 va_start(ap, n);
8 while (n--) {
9 void *p = va_arg(ap, void *);
10 #if defined(__x86_64__) || defined(__aarch64__) || defined(__powerpc64__)
11 // On FreeBSD, the %p conversion specifier works as 0x%x and thus does not
12 // match to the format used in the diagnotic message.
13 fprintf(stderr, "0x%012lx ", (unsigned long) p);
14 #elif defined(__mips64)
15 fprintf(stderr, "0x%010lx ", (unsigned long) p);
16 #endif
17 }
18 fprintf(stderr, "\n");
19 }