[asan] Support for %z to Printf()

At the moment, asan internal Printf() uses %l modifier for printing
values of size_t and related types. This works, because we control
both the implementation of Printf and all its uses, but can be a
little misleading.

This change adds support for %z to Printf(). All callers that print
sizes and pointers as integers are switched to %zu / %zx.

llvm-svn: 153177
This commit is contained in:
Evgeniy Stepanov 2012-03-21 11:32:46 +00:00
parent 3ffccb3802
commit 823085a8f4
8 changed files with 60 additions and 60 deletions

View File

@ -219,15 +219,15 @@ struct AsanChunk: public ChunkBase {
size_t offset; size_t offset;
Printf("%p is located ", addr); Printf("%p is located ", addr);
if (AddrIsInside(addr, access_size, &offset)) { if (AddrIsInside(addr, access_size, &offset)) {
Printf("%ld bytes inside of", offset); Printf("%zu bytes inside of", offset);
} else if (AddrIsAtLeft(addr, access_size, &offset)) { } else if (AddrIsAtLeft(addr, access_size, &offset)) {
Printf("%ld bytes to the left of", offset); Printf("%zu bytes to the left of", offset);
} else if (AddrIsAtRight(addr, access_size, &offset)) { } else if (AddrIsAtRight(addr, access_size, &offset)) {
Printf("%ld bytes to the right of", offset); Printf("%zu bytes to the right of", offset);
} else { } else {
Printf(" somewhere around (this is AddressSanitizer bug!)"); Printf(" somewhere around (this is AddressSanitizer bug!)");
} }
Printf(" %lu-byte region [%p,%p)\n", Printf(" %zu-byte region [%p,%p)\n",
used_size, beg(), beg() + used_size); used_size, beg(), beg() + used_size);
} }
}; };
@ -389,7 +389,7 @@ class MallocInfo {
ScopedLock lock(&mu_); ScopedLock lock(&mu_);
size_t malloced = 0; size_t malloced = 0;
Printf(" MallocInfo: in quarantine: %ld malloced: %ld; ", Printf(" MallocInfo: in quarantine: %zu malloced: %zu; ",
quarantine_.size() >> 20, malloced >> 20); quarantine_.size() >> 20, malloced >> 20);
for (size_t j = 1; j < kNumberOfSizeClasses; j++) { for (size_t j = 1; j < kNumberOfSizeClasses; j++) {
AsanChunk *i = free_lists_[j]; AsanChunk *i = free_lists_[j];
@ -398,7 +398,7 @@ class MallocInfo {
for (; i; i = i->next) { for (; i; i = i->next) {
t += i->Size(); t += i->Size();
} }
Printf("%ld:%ld ", j, t >> 20); Printf("%zu:%zu ", j, t >> 20);
} }
Printf("\n"); Printf("\n");
} }
@ -632,7 +632,7 @@ static uint8_t *Allocate(size_t alignment, size_t size, AsanStackTrace *stack) {
CHECK(IsAligned(size_to_allocate, REDZONE)); CHECK(IsAligned(size_to_allocate, REDZONE));
if (FLAG_v >= 2) { if (FLAG_v >= 2) {
Printf("Allocate align: %ld size: %ld class: %d real: %ld\n", Printf("Allocate align: %zu size: %zu class: %u real: %zu\n",
alignment, size, size_class, size_to_allocate); alignment, size, size_class, size_to_allocate);
} }
@ -912,7 +912,7 @@ inline size_t FakeStack::ComputeSizeClass(size_t alloc_size) {
size_t log = Log2(rounded_size); size_t log = Log2(rounded_size);
CHECK(alloc_size <= (1UL << log)); CHECK(alloc_size <= (1UL << log));
if (!(alloc_size > (1UL << (log-1)))) { if (!(alloc_size > (1UL << (log-1)))) {
Printf("alloc_size %ld log %ld\n", alloc_size, log); Printf("alloc_size %zu log %zu\n", alloc_size, log);
} }
CHECK(alloc_size > (1UL << (log-1))); CHECK(alloc_size > (1UL << (log-1)));
size_t res = log < kMinStackFrameSizeLog ? 0 : log - kMinStackFrameSizeLog; size_t res = log < kMinStackFrameSizeLog ? 0 : log - kMinStackFrameSizeLog;
@ -972,7 +972,7 @@ void FakeStack::AllocateOneSizeClass(size_t size_class) {
CHECK(ClassMmapSize(size_class) >= kPageSize); CHECK(ClassMmapSize(size_class) >= kPageSize);
uintptr_t new_mem = (uintptr_t)AsanMmapSomewhereOrDie( uintptr_t new_mem = (uintptr_t)AsanMmapSomewhereOrDie(
ClassMmapSize(size_class), __FUNCTION__); ClassMmapSize(size_class), __FUNCTION__);
// Printf("T%d new_mem[%ld]: %p-%p mmap %ld\n", // Printf("T%d new_mem[%zu]: %p-%p mmap %zu\n",
// asanThreadRegistry().GetCurrent()->tid(), // asanThreadRegistry().GetCurrent()->tid(),
// size_class, new_mem, new_mem + ClassMmapSize(size_class), // size_class, new_mem, new_mem + ClassMmapSize(size_class),
// ClassMmapSize(size_class)); // ClassMmapSize(size_class));
@ -1039,7 +1039,7 @@ size_t __asan_stack_malloc(size_t size, size_t real_stack) {
return real_stack; return real_stack;
} }
size_t ptr = t->fake_stack().AllocateStack(size, real_stack); size_t ptr = t->fake_stack().AllocateStack(size, real_stack);
// Printf("__asan_stack_malloc %p %ld %p\n", ptr, size, real_stack); // Printf("__asan_stack_malloc %p %zu %p\n", ptr, size, real_stack);
return ptr; return ptr;
} }

View File

@ -74,13 +74,13 @@ bool DescribeAddrIfMyRedZone(const Global &g, uintptr_t addr) {
if (addr >= g.beg + g.size_with_redzone) return false; if (addr >= g.beg + g.size_with_redzone) return false;
Printf("%p is located ", addr); Printf("%p is located ", addr);
if (addr < g.beg) { if (addr < g.beg) {
Printf("%d bytes to the left", g.beg - addr); Printf("%zd bytes to the left", g.beg - addr);
} else if (addr >= g.beg + g.size) { } else if (addr >= g.beg + g.size) {
Printf("%d bytes to the right", addr - (g.beg + g.size)); Printf("%zd bytes to the right", addr - (g.beg + g.size));
} else { } else {
Printf("%d bytes inside", addr - g.beg); // Can it happen? Printf("%zd bytes inside", addr - g.beg); // Can it happen?
} }
Printf(" of global variable '%s' (0x%lx) of size %ld\n", Printf(" of global variable '%s' (0x%zx) of size %zu\n",
g.name, g.beg, g.size); g.name, g.beg, g.size);
PrintIfASCII(g); PrintIfASCII(g);
return true; return true;
@ -94,7 +94,7 @@ bool DescribeAddrIfGlobal(uintptr_t addr) {
for (ListOfGlobals *l = list_of_globals; l; l = l->next) { for (ListOfGlobals *l = list_of_globals; l; l = l->next) {
const Global &g = *l->g; const Global &g = *l->g;
if (FLAG_report_globals >= 2) if (FLAG_report_globals >= 2)
Printf("Search Global: beg=%p size=%ld name=%s\n", Printf("Search Global: beg=%p size=%zu name=%s\n",
g.beg, g.size, g.name); g.beg, g.size, g.name);
res |= DescribeAddrIfMyRedZone(g, addr); res |= DescribeAddrIfMyRedZone(g, addr);
} }
@ -117,7 +117,7 @@ static void RegisterGlobal(const Global *g) {
l->next = list_of_globals; l->next = list_of_globals;
list_of_globals = l; list_of_globals = l;
if (FLAG_report_globals >= 2) if (FLAG_report_globals >= 2)
Report("Added Global: beg=%p size=%ld name=%s\n", Report("Added Global: beg=%p size=%zu name=%s\n",
g->beg, g->size, g->name); g->beg, g->size, g->name);
} }

View File

@ -115,7 +115,7 @@ INTERCEPTOR(int, mallopt, int cmd, int value) {
INTERCEPTOR(int, posix_memalign, void **memptr, size_t alignment, size_t size) { INTERCEPTOR(int, posix_memalign, void **memptr, size_t alignment, size_t size) {
GET_STACK_TRACE_HERE_FOR_MALLOC; GET_STACK_TRACE_HERE_FOR_MALLOC;
// Printf("posix_memalign: %lx %ld\n", alignment, size); // Printf("posix_memalign: %zx %zu\n", alignment, size);
return asan_posix_memalign(memptr, alignment, size, &stack); return asan_posix_memalign(memptr, alignment, size, &stack);
} }

View File

@ -108,7 +108,7 @@ static inline int AppendPointer(char **buff, const char *buff_end,
static int VSNPrintf(char *buff, int buff_length, static int VSNPrintf(char *buff, int buff_length,
const char *format, va_list args) { const char *format, va_list args) {
static const char *kPrintfFormatsHelp = "Supported Printf formats: " static const char *kPrintfFormatsHelp = "Supported Printf formats: "
"%%[l]{d,u,x}; %%p; %%s"; "%%[z]{d,u,x}; %%p; %%s";
RAW_CHECK(format); RAW_CHECK(format);
RAW_CHECK(buff_length > 0); RAW_CHECK(buff_length > 0);
const char *buff_end = &buff[buff_length - 1]; const char *buff_end = &buff[buff_length - 1];
@ -117,28 +117,28 @@ static int VSNPrintf(char *buff, int buff_length,
for (; *cur; cur++) { for (; *cur; cur++) {
if (*cur == '%') { if (*cur == '%') {
cur++; cur++;
bool have_l = (*cur == 'l'); bool have_z = (*cur == 'z');
cur += have_l; cur += have_z;
int64_t dval; int64_t dval;
uint64_t uval, xval; uint64_t uval;
switch (*cur) { switch (*cur) {
case 'd': dval = have_l ? va_arg(args, intptr_t) case 'd': dval = have_z ? va_arg(args, intptr_t)
: va_arg(args, int); : va_arg(args, int);
result += AppendSignedDecimal(&buff, buff_end, dval); result += AppendSignedDecimal(&buff, buff_end, dval);
break; break;
case 'u': uval = have_l ? va_arg(args, uintptr_t) case 'u': uval = have_z ? va_arg(args, size_t)
: va_arg(args, unsigned int); : va_arg(args, unsigned);
result += AppendUnsigned(&buff, buff_end, uval, 10, 0); result += AppendUnsigned(&buff, buff_end, uval, 10, 0);
break; break;
case 'x': xval = have_l ? va_arg(args, uintptr_t) case 'x': uval = have_z ? va_arg(args, size_t)
: va_arg(args, unsigned int); : va_arg(args, unsigned);
result += AppendUnsigned(&buff, buff_end, xval, 16, 0); result += AppendUnsigned(&buff, buff_end, uval, 16, 0);
break; break;
case 'p': RAW_CHECK_MSG(!have_l, kPrintfFormatsHelp); case 'p': RAW_CHECK_MSG(!have_z, kPrintfFormatsHelp);
result += AppendPointer(&buff, buff_end, result += AppendPointer(&buff, buff_end,
va_arg(args, uintptr_t)); va_arg(args, uintptr_t));
break; break;
case 's': RAW_CHECK_MSG(!have_l, kPrintfFormatsHelp); case 's': RAW_CHECK_MSG(!have_z, kPrintfFormatsHelp);
result += AppendString(&buff, buff_end, va_arg(args, char*)); result += AppendString(&buff, buff_end, va_arg(args, char*));
break; break;
default: RAW_CHECK_MSG(false, kPrintfFormatsHelp); default: RAW_CHECK_MSG(false, kPrintfFormatsHelp);

View File

@ -66,9 +66,9 @@ void ShowStatsAndAbort() {
static void PrintBytes(const char *before, uintptr_t *a) { static void PrintBytes(const char *before, uintptr_t *a) {
uint8_t *bytes = (uint8_t*)a; uint8_t *bytes = (uint8_t*)a;
size_t byte_num = (__WORDSIZE) / 8; size_t byte_num = (__WORDSIZE) / 8;
Printf("%s%p:", before, (uintptr_t)a); Printf("%s%p:", before, (void*)a);
for (size_t i = 0; i < byte_num; i++) { for (size_t i = 0; i < byte_num; i++) {
Printf(" %lx%lx", bytes[i] >> 4, bytes[i] & 15); Printf(" %x%x", bytes[i] >> 4, bytes[i] & 15);
} }
Printf("\n"); Printf("\n");
} }
@ -122,7 +122,7 @@ void AsanDie() {
// ---------------------- mmap -------------------- {{{1 // ---------------------- mmap -------------------- {{{1
void OutOfMemoryMessageAndDie(const char *mem_type, size_t size) { void OutOfMemoryMessageAndDie(const char *mem_type, size_t size) {
Report("ERROR: AddressSanitizer failed to allocate " Report("ERROR: AddressSanitizer failed to allocate "
"0x%lx (%ld) bytes of %s\n", "0x%zx (%zd) bytes of %s\n",
size, size, mem_type); size, size, mem_type);
PRINT_CURRENT_STACK(); PRINT_CURRENT_STACK();
ShowStatsAndAbort(); ShowStatsAndAbort();
@ -173,14 +173,14 @@ static bool DescribeStackAddress(uintptr_t addr, uintptr_t access_size) {
internal_strncat(buf, frame_descr, internal_strncat(buf, frame_descr,
Min(kBufSize, Min(kBufSize,
static_cast<intptr_t>(name_end - frame_descr))); static_cast<intptr_t>(name_end - frame_descr)));
Printf("Address %p is located at offset %ld " Printf("Address %p is located at offset %zu "
"in frame <%s> of T%d's stack:\n", "in frame <%s> of T%d's stack:\n",
addr, offset, buf, t->tid()); addr, offset, buf, t->tid());
// Report the number of stack objects. // Report the number of stack objects.
char *p; char *p;
size_t n_objects = internal_simple_strtoll(name_end, &p, 10); size_t n_objects = internal_simple_strtoll(name_end, &p, 10);
CHECK(n_objects > 0); CHECK(n_objects > 0);
Printf(" This frame has %ld object(s):\n", n_objects); Printf(" This frame has %zu object(s):\n", n_objects);
// Report all objects in this frame. // Report all objects in this frame.
for (size_t i = 0; i < n_objects; i++) { for (size_t i = 0; i < n_objects; i++) {
size_t beg, size; size_t beg, size;
@ -197,7 +197,7 @@ static bool DescribeStackAddress(uintptr_t addr, uintptr_t access_size) {
buf[0] = 0; buf[0] = 0;
internal_strncat(buf, p, Min(kBufSize, len)); internal_strncat(buf, p, Min(kBufSize, len));
p += len; p += len;
Printf(" [%ld, %ld) '%s'\n", beg, beg + size, buf); Printf(" [%zu, %zu) '%s'\n", beg, beg + size, buf);
} }
Printf("HINT: this may be a false positive if your program uses " Printf("HINT: this may be a false positive if your program uses "
"some custom stack unwind mechanism\n" "some custom stack unwind mechanism\n"
@ -374,10 +374,10 @@ void __asan_report_error(uintptr_t pc, uintptr_t bp, uintptr_t sp,
} }
Report("ERROR: AddressSanitizer %s on address " Report("ERROR: AddressSanitizer %s on address "
"%p at pc 0x%lx bp 0x%lx sp 0x%lx\n", "%p at pc 0x%zx bp 0x%zx sp 0x%zx\n",
bug_descr, addr, pc, bp, sp); bug_descr, addr, pc, bp, sp);
Printf("%s of size %d at %p thread T%d\n", Printf("%s of size %zu at %p thread T%d\n",
access_size ? (is_write ? "WRITE" : "READ") : "ACCESS", access_size ? (is_write ? "WRITE" : "READ") : "ACCESS",
access_size, addr, curr_tid); access_size, addr, curr_tid);
@ -486,12 +486,12 @@ void __asan_init() {
MEM_TO_SHADOW(kLowShadowEnd), MEM_TO_SHADOW(kLowShadowEnd),
MEM_TO_SHADOW(kHighShadowBeg), MEM_TO_SHADOW(kHighShadowBeg),
MEM_TO_SHADOW(kHighShadowEnd)); MEM_TO_SHADOW(kHighShadowEnd));
Printf("red_zone=%ld\n", FLAG_redzone); Printf("red_zone=%zu\n", (size_t)FLAG_redzone);
Printf("malloc_context_size=%ld\n", (int)FLAG_malloc_context_size); Printf("malloc_context_size=%zu\n", (size_t)FLAG_malloc_context_size);
Printf("SHADOW_SCALE: %lx\n", SHADOW_SCALE); Printf("SHADOW_SCALE: %zx\n", (size_t)SHADOW_SCALE);
Printf("SHADOW_GRANULARITY: %lx\n", SHADOW_GRANULARITY); Printf("SHADOW_GRANULARITY: %zx\n", (size_t)SHADOW_GRANULARITY);
Printf("SHADOW_OFFSET: %lx\n", SHADOW_OFFSET); Printf("SHADOW_OFFSET: %zx\n", (size_t)SHADOW_OFFSET);
CHECK(SHADOW_SCALE >= 3 && SHADOW_SCALE <= 7); CHECK(SHADOW_SCALE >= 3 && SHADOW_SCALE <= 7);
} }

View File

@ -32,7 +32,7 @@ void AsanStackTrace::PrintStack(uintptr_t *addr, size_t size) {
uintptr_t pc = addr[i]; uintptr_t pc = addr[i];
char buff[4096]; char buff[4096];
ASAN_USE_EXTERNAL_SYMBOLIZER((void*)pc, buff, sizeof(buff)); ASAN_USE_EXTERNAL_SYMBOLIZER((void*)pc, buff, sizeof(buff));
Printf(" #%ld 0x%lx %s\n", i, pc, buff); Printf(" #%zu 0x%zx %s\n", i, pc, buff);
} }
} }
@ -46,9 +46,9 @@ void AsanStackTrace::PrintStack(uintptr_t *addr, size_t size) {
char filename[4096]; char filename[4096];
if (proc_maps.GetObjectNameAndOffset(pc, &offset, if (proc_maps.GetObjectNameAndOffset(pc, &offset,
filename, sizeof(filename))) { filename, sizeof(filename))) {
Printf(" #%ld 0x%lx (%s+0x%lx)\n", i, pc, filename, offset); Printf(" #%zu 0x%zx (%s+0x%zx)\n", i, pc, filename, offset);
} else { } else {
Printf(" #%ld 0x%lx\n", i, pc); Printf(" #%zu 0x%zx\n", i, pc);
} }
} }
} }
@ -104,19 +104,19 @@ size_t AsanStackTrace::CompressStack(AsanStackTrace *stack,
uintptr_t pc = stack->trace[i]; uintptr_t pc = stack->trace[i];
if (!pc) break; if (!pc) break;
if ((int64_t)pc < 0) break; if ((int64_t)pc < 0) break;
// Printf("C pc[%ld] %lx\n", i, pc); // Printf("C pc[%zu] %zx\n", i, pc);
if (prev_pc - pc < kMaxOffset || pc - prev_pc < kMaxOffset) { if (prev_pc - pc < kMaxOffset || pc - prev_pc < kMaxOffset) {
uintptr_t offset = (int64_t)(pc - prev_pc); uintptr_t offset = (int64_t)(pc - prev_pc);
offset |= (1U << 31); offset |= (1U << 31);
if (c_index >= size) break; if (c_index >= size) break;
// Printf("C co[%ld] offset %lx\n", i, offset); // Printf("C co[%zu] offset %zx\n", i, offset);
compressed[c_index++] = offset; compressed[c_index++] = offset;
} else { } else {
uintptr_t hi = pc >> 32; uintptr_t hi = pc >> 32;
uintptr_t lo = (pc << 32) >> 32; uintptr_t lo = (pc << 32) >> 32;
CHECK((hi & (1 << 31)) == 0); CHECK((hi & (1 << 31)) == 0);
if (c_index + 1 >= size) break; if (c_index + 1 >= size) break;
// Printf("C co[%ld] hi/lo: %lx %lx\n", c_index, hi, lo); // Printf("C co[%zu] hi/lo: %zx %zx\n", c_index, hi, lo);
compressed[c_index++] = hi; compressed[c_index++] = hi;
compressed[c_index++] = lo; compressed[c_index++] = lo;
} }
@ -134,7 +134,7 @@ size_t AsanStackTrace::CompressStack(AsanStackTrace *stack,
AsanStackTrace check_stack; AsanStackTrace check_stack;
UncompressStack(&check_stack, compressed, size); UncompressStack(&check_stack, compressed, size);
if (res < check_stack.size) { if (res < check_stack.size) {
Printf("res %ld check_stack.size %ld; c_size %ld\n", res, Printf("res %zu check_stack.size %zu; c_size %zu\n", res,
check_stack.size, size); check_stack.size, size);
} }
// |res| may be greater than check_stack.size, because // |res| may be greater than check_stack.size, because
@ -164,7 +164,7 @@ void AsanStackTrace::UncompressStack(AsanStackTrace *stack,
uint32_t x = compressed[i]; uint32_t x = compressed[i];
uintptr_t pc = 0; uintptr_t pc = 0;
if (x & (1U << 31)) { if (x & (1U << 31)) {
// Printf("U co[%ld] offset: %x\n", i, x); // Printf("U co[%zu] offset: %x\n", i, x);
// this is an offset // this is an offset
int32_t offset = x; int32_t offset = x;
offset = (offset << 1) >> 1; // remove the 31-byte and sign-extend. offset = (offset << 1) >> 1; // remove the 31-byte and sign-extend.
@ -175,12 +175,12 @@ void AsanStackTrace::UncompressStack(AsanStackTrace *stack,
if (i + 1 >= size) break; if (i + 1 >= size) break;
uintptr_t hi = x; uintptr_t hi = x;
uintptr_t lo = compressed[i+1]; uintptr_t lo = compressed[i+1];
// Printf("U co[%ld] hi/lo: %lx %lx\n", i, hi, lo); // Printf("U co[%zu] hi/lo: %zx %zx\n", i, hi, lo);
i++; i++;
pc = (hi << 32) | lo; pc = (hi << 32) | lo;
if (!pc) break; if (!pc) break;
} }
// Printf("U pc[%ld] %lx\n", stack->size, pc); // Printf("U pc[%zu] %zx\n", stack->size, pc);
stack->trace[stack->size++] = pc; stack->trace[stack->size++] = pc;
prev_pc = pc; prev_pc = pc;
} }

View File

@ -30,26 +30,26 @@ static void PrintMallocStatsArray(const char *prefix,
Printf("%s", prefix); Printf("%s", prefix);
for (size_t i = 0; i < kNumberOfSizeClasses; i++) { for (size_t i = 0; i < kNumberOfSizeClasses; i++) {
if (!array[i]) continue; if (!array[i]) continue;
Printf("%ld:%ld; ", i, array[i]); Printf("%zu:%zu; ", i, array[i]);
} }
Printf("\n"); Printf("\n");
} }
void AsanStats::Print() { void AsanStats::Print() {
Printf("Stats: %ldM malloced (%ldM for red zones) by %ld calls\n", Printf("Stats: %zuM malloced (%zuM for red zones) by %zu calls\n",
malloced>>20, malloced_redzones>>20, mallocs); malloced>>20, malloced_redzones>>20, mallocs);
Printf("Stats: %ldM realloced by %ld calls\n", realloced>>20, reallocs); Printf("Stats: %zuM realloced by %zu calls\n", realloced>>20, reallocs);
Printf("Stats: %ldM freed by %ld calls\n", freed>>20, frees); Printf("Stats: %zuM freed by %zu calls\n", freed>>20, frees);
Printf("Stats: %ldM really freed by %ld calls\n", Printf("Stats: %zuM really freed by %zu calls\n",
really_freed>>20, real_frees); really_freed>>20, real_frees);
Printf("Stats: %ldM (%ld full pages) mmaped in %ld calls\n", Printf("Stats: %zuM (%zu full pages) mmaped in %zu calls\n",
mmaped>>20, mmaped / kPageSize, mmaps); mmaped>>20, mmaped / kPageSize, mmaps);
PrintMallocStatsArray(" mmaps by size class: ", mmaped_by_size); PrintMallocStatsArray(" mmaps by size class: ", mmaped_by_size);
PrintMallocStatsArray(" mallocs by size class: ", malloced_by_size); PrintMallocStatsArray(" mallocs by size class: ", malloced_by_size);
PrintMallocStatsArray(" frees by size class: ", freed_by_size); PrintMallocStatsArray(" frees by size class: ", freed_by_size);
PrintMallocStatsArray(" rfrees by size class: ", really_freed_by_size); PrintMallocStatsArray(" rfrees by size class: ", really_freed_by_size);
Printf("Stats: malloc large: %ld small slow: %ld\n", Printf("Stats: malloc large: %zu small slow: %zu\n",
malloc_large, malloc_small_slow); malloc_large, malloc_small_slow);
} }

View File

@ -73,7 +73,7 @@ void AsanThread::Init() {
ClearShadowForThreadStack(); ClearShadowForThreadStack();
if (FLAG_v >= 1) { if (FLAG_v >= 1) {
int local = 0; int local = 0;
Report("T%d: stack [%p,%p) size 0x%lx; local=%p\n", Report("T%d: stack [%p,%p) size 0x%zx; local=%p\n",
tid(), stack_bottom_, stack_top_, tid(), stack_bottom_, stack_top_,
stack_top_ - stack_bottom_, &local); stack_top_ - stack_bottom_, &local);
} }