forked from OSchip/llvm-project
Fix -Wformat warnings reported by GCC.
Differential Revision: https://reviews.llvm.org/D113099
This commit is contained in:
parent
e7fdff403e
commit
629b40dafa
|
@ -522,7 +522,7 @@ struct Allocator {
|
|||
size > max_user_defined_malloc_size) {
|
||||
if (AllocatorMayReturnNull()) {
|
||||
Report("WARNING: AddressSanitizer failed to allocate 0x%zx bytes\n",
|
||||
(void*)size);
|
||||
size);
|
||||
return nullptr;
|
||||
}
|
||||
uptr malloc_limit =
|
||||
|
|
|
@ -251,7 +251,7 @@ static void PrintAccessAndVarIntersection(const StackVarDescr &var, uptr addr,
|
|||
}
|
||||
str.append("'");
|
||||
if (var.line > 0) {
|
||||
str.append(" (line %d)", var.line);
|
||||
str.append(" (line %zd)", var.line);
|
||||
}
|
||||
if (pos_descr) {
|
||||
Decorator d;
|
||||
|
@ -318,7 +318,8 @@ bool DescribeAddressIfGlobal(uptr addr, uptr access_size,
|
|||
}
|
||||
|
||||
void ShadowAddressDescription::Print() const {
|
||||
Printf("Address %p is located in the %s area.\n", addr, ShadowNames[kind]);
|
||||
Printf("Address %p is located in the %s area.\n", (void *)addr,
|
||||
ShadowNames[kind]);
|
||||
}
|
||||
|
||||
void GlobalAddressDescription::Print(const char *bug_type) const {
|
||||
|
@ -356,7 +357,7 @@ bool GlobalAddressDescription::PointsInsideTheSameVariable(
|
|||
void StackAddressDescription::Print() const {
|
||||
Decorator d;
|
||||
Printf("%s", d.Location());
|
||||
Printf("Address %p is located in stack of thread %s", addr,
|
||||
Printf("Address %p is located in stack of thread %s", (void *)addr,
|
||||
AsanThreadIdAndName(tid).c_str());
|
||||
|
||||
if (!frame_descr) {
|
||||
|
@ -469,7 +470,7 @@ AddressDescription::AddressDescription(uptr addr, uptr access_size,
|
|||
|
||||
void WildAddressDescription::Print() const {
|
||||
Printf("Address %p is a wild pointer inside of access range of size %p.\n",
|
||||
addr, access_size);
|
||||
(void *)addr, (void *)access_size);
|
||||
}
|
||||
|
||||
void PrintAddressDescription(uptr addr, uptr access_size,
|
||||
|
|
|
@ -46,10 +46,9 @@ void ErrorDeadlySignal::Print() {
|
|||
void ErrorDoubleFree::Print() {
|
||||
Decorator d;
|
||||
Printf("%s", d.Error());
|
||||
Report(
|
||||
"ERROR: AddressSanitizer: attempting %s on %p in thread %s:\n",
|
||||
scariness.GetDescription(), addr_description.addr,
|
||||
AsanThreadIdAndName(tid).c_str());
|
||||
Report("ERROR: AddressSanitizer: attempting %s on %p in thread %s:\n",
|
||||
scariness.GetDescription(), (void *)addr_description.addr,
|
||||
AsanThreadIdAndName(tid).c_str());
|
||||
Printf("%s", d.Default());
|
||||
scariness.Print();
|
||||
GET_STACK_TRACE_FATAL(second_free_stack->trace[0],
|
||||
|
@ -62,10 +61,9 @@ void ErrorDoubleFree::Print() {
|
|||
void ErrorNewDeleteTypeMismatch::Print() {
|
||||
Decorator d;
|
||||
Printf("%s", d.Error());
|
||||
Report(
|
||||
"ERROR: AddressSanitizer: %s on %p in thread %s:\n",
|
||||
scariness.GetDescription(), addr_description.addr,
|
||||
AsanThreadIdAndName(tid).c_str());
|
||||
Report("ERROR: AddressSanitizer: %s on %p in thread %s:\n",
|
||||
scariness.GetDescription(), (void *)addr_description.addr,
|
||||
AsanThreadIdAndName(tid).c_str());
|
||||
Printf("%s object passed to delete has wrong type:\n", d.Default());
|
||||
if (delete_size != 0) {
|
||||
Printf(
|
||||
|
@ -106,7 +104,7 @@ void ErrorFreeNotMalloced::Print() {
|
|||
Report(
|
||||
"ERROR: AddressSanitizer: attempting free on address "
|
||||
"which was not malloc()-ed: %p in thread %s\n",
|
||||
addr_description.Address(), AsanThreadIdAndName(tid).c_str());
|
||||
(void *)addr_description.Address(), AsanThreadIdAndName(tid).c_str());
|
||||
Printf("%s", d.Default());
|
||||
CHECK_GT(free_stack->size, 0);
|
||||
scariness.Print();
|
||||
|
@ -126,7 +124,7 @@ void ErrorAllocTypeMismatch::Print() {
|
|||
Printf("%s", d.Error());
|
||||
Report("ERROR: AddressSanitizer: %s (%s vs %s) on %p\n",
|
||||
scariness.GetDescription(), alloc_names[alloc_type],
|
||||
dealloc_names[dealloc_type], addr_description.Address());
|
||||
dealloc_names[dealloc_type], (void *)addr_description.Address());
|
||||
Printf("%s", d.Default());
|
||||
CHECK_GT(dealloc_stack->size, 0);
|
||||
scariness.Print();
|
||||
|
@ -145,7 +143,7 @@ void ErrorMallocUsableSizeNotOwned::Print() {
|
|||
Report(
|
||||
"ERROR: AddressSanitizer: attempting to call malloc_usable_size() for "
|
||||
"pointer which is not owned: %p\n",
|
||||
addr_description.Address());
|
||||
(void *)addr_description.Address());
|
||||
Printf("%s", d.Default());
|
||||
stack->Print();
|
||||
addr_description.Print();
|
||||
|
@ -158,7 +156,7 @@ void ErrorSanitizerGetAllocatedSizeNotOwned::Print() {
|
|||
Report(
|
||||
"ERROR: AddressSanitizer: attempting to call "
|
||||
"__sanitizer_get_allocated_size() for pointer which is not owned: %p\n",
|
||||
addr_description.Address());
|
||||
(void *)addr_description.Address());
|
||||
Printf("%s", d.Default());
|
||||
stack->Print();
|
||||
addr_description.Print();
|
||||
|
@ -298,9 +296,10 @@ void ErrorStringFunctionMemoryRangesOverlap::Print() {
|
|||
Report(
|
||||
"ERROR: AddressSanitizer: %s: memory ranges [%p,%p) and [%p, %p) "
|
||||
"overlap\n",
|
||||
bug_type, addr1_description.Address(),
|
||||
addr1_description.Address() + length1, addr2_description.Address(),
|
||||
addr2_description.Address() + length2);
|
||||
bug_type, (void *)addr1_description.Address(),
|
||||
(void *)(addr1_description.Address() + length1),
|
||||
(void *)addr2_description.Address(),
|
||||
(void *)(addr2_description.Address() + length2));
|
||||
Printf("%s", d.Default());
|
||||
scariness.Print();
|
||||
stack->Print();
|
||||
|
@ -329,10 +328,10 @@ void ErrorBadParamsToAnnotateContiguousContainer::Print() {
|
|||
" end : %p\n"
|
||||
" old_mid : %p\n"
|
||||
" new_mid : %p\n",
|
||||
beg, end, old_mid, new_mid);
|
||||
(void *)beg, (void *)end, (void *)old_mid, (void *)new_mid);
|
||||
uptr granularity = SHADOW_GRANULARITY;
|
||||
if (!IsAligned(beg, granularity))
|
||||
Report("ERROR: beg is not aligned by %d\n", granularity);
|
||||
Report("ERROR: beg is not aligned by %zu\n", granularity);
|
||||
stack->Print();
|
||||
ReportErrorSummary(scariness.GetDescription(), stack);
|
||||
}
|
||||
|
@ -341,7 +340,7 @@ void ErrorODRViolation::Print() {
|
|||
Decorator d;
|
||||
Printf("%s", d.Error());
|
||||
Report("ERROR: AddressSanitizer: %s (%p):\n", scariness.GetDescription(),
|
||||
global1.beg);
|
||||
(void *)global1.beg);
|
||||
Printf("%s", d.Default());
|
||||
InternalScopedString g1_loc;
|
||||
InternalScopedString g2_loc;
|
||||
|
@ -371,7 +370,8 @@ void ErrorInvalidPointerPair::Print() {
|
|||
Decorator d;
|
||||
Printf("%s", d.Error());
|
||||
Report("ERROR: AddressSanitizer: %s: %p %p\n", scariness.GetDescription(),
|
||||
addr1_description.Address(), addr2_description.Address());
|
||||
(void *)addr1_description.Address(),
|
||||
(void *)addr2_description.Address());
|
||||
Printf("%s", d.Default());
|
||||
GET_STACK_TRACE_FATAL(pc, bp);
|
||||
stack.Print();
|
||||
|
@ -575,7 +575,7 @@ void ErrorGeneric::Print() {
|
|||
Printf("%s", d.Error());
|
||||
uptr addr = addr_description.Address();
|
||||
Report("ERROR: AddressSanitizer: %s on address %p at pc %p bp %p sp %p\n",
|
||||
bug_descr, (void *)addr, pc, bp, sp);
|
||||
bug_descr, (void *)addr, (void *)pc, (void *)bp, (void *)sp);
|
||||
Printf("%s", d.Default());
|
||||
|
||||
Printf("%s%s of size %zu at %p thread %s%s\n", d.Access(),
|
||||
|
|
|
@ -85,10 +85,10 @@ static void ReportGlobal(const Global &g, const char *prefix) {
|
|||
Report(
|
||||
"%s Global[%p]: beg=%p size=%zu/%zu name=%s module=%s dyn_init=%zu "
|
||||
"odr_indicator=%p\n",
|
||||
prefix, &g, (void *)g.beg, g.size, g.size_with_redzone, g.name,
|
||||
prefix, (void *)&g, (void *)g.beg, g.size, g.size_with_redzone, g.name,
|
||||
g.module_name, g.has_dynamic_init, (void *)g.odr_indicator);
|
||||
if (g.location) {
|
||||
Report(" location (%p): name=%s[%p], %d %d\n", g.location,
|
||||
Report(" location (%p): name=%s[%p], %d %d\n", (void *)g.location,
|
||||
g.location->filename, g.location->filename, g.location->line_no,
|
||||
g.location->column_no);
|
||||
}
|
||||
|
@ -369,7 +369,8 @@ void __asan_register_globals(__asan_global *globals, uptr n) {
|
|||
global_registration_site_vector->push_back(site);
|
||||
if (flags()->report_globals >= 2) {
|
||||
PRINT_CURRENT_STACK();
|
||||
Printf("=== ID %d; %p %p\n", stack_id, &globals[0], &globals[n - 1]);
|
||||
Printf("=== ID %d; %p %p\n", stack_id, (void *)&globals[0],
|
||||
(void *)&globals[n - 1]);
|
||||
}
|
||||
for (uptr i = 0; i < n; i++) {
|
||||
if (SANITIZER_WINDOWS && globals[i].beg == 0) {
|
||||
|
|
|
@ -128,8 +128,8 @@ void AsanCheckIncompatibleRT() {}
|
|||
#else
|
||||
static int FindFirstDSOCallback(struct dl_phdr_info *info, size_t size,
|
||||
void *data) {
|
||||
VReport(2, "info->dlpi_name = %s\tinfo->dlpi_addr = %p\n",
|
||||
info->dlpi_name, info->dlpi_addr);
|
||||
VReport(2, "info->dlpi_name = %s\tinfo->dlpi_addr = %p\n", info->dlpi_name,
|
||||
(void *)info->dlpi_addr);
|
||||
|
||||
// Continue until the first dynamic library is found
|
||||
if (!info->dlpi_name || info->dlpi_name[0] == 0)
|
||||
|
|
|
@ -66,7 +66,7 @@ void AsanPoisonOrUnpoisonIntraObjectRedzone(uptr ptr, uptr size, bool poison) {
|
|||
uptr end = ptr + size;
|
||||
if (Verbosity()) {
|
||||
Printf("__asan_%spoison_intra_object_redzone [%p,%p) %zd\n",
|
||||
poison ? "" : "un", ptr, end, size);
|
||||
poison ? "" : "un", (void *)ptr, (void *)end, size);
|
||||
if (Verbosity() >= 2)
|
||||
PRINT_CURRENT_STACK();
|
||||
}
|
||||
|
|
|
@ -67,14 +67,14 @@ static void PrintZoneForPointer(uptr ptr, uptr zone_ptr,
|
|||
const char *zone_name) {
|
||||
if (zone_ptr) {
|
||||
if (zone_name) {
|
||||
Printf("malloc_zone_from_ptr(%p) = %p, which is %s\n",
|
||||
ptr, zone_ptr, zone_name);
|
||||
Printf("malloc_zone_from_ptr(%p) = %p, which is %s\n", (void *)ptr,
|
||||
(void *)zone_ptr, zone_name);
|
||||
} else {
|
||||
Printf("malloc_zone_from_ptr(%p) = %p, which doesn't have a name\n",
|
||||
ptr, zone_ptr);
|
||||
(void *)ptr, (void *)zone_ptr);
|
||||
}
|
||||
} else {
|
||||
Printf("malloc_zone_from_ptr(%p) = 0\n", ptr);
|
||||
Printf("malloc_zone_from_ptr(%p) = 0\n", (void *)ptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -435,9 +435,10 @@ static inline void CheckForInvalidPointerPair(void *p1, void *p2) {
|
|||
void ReportMacMzReallocUnknown(uptr addr, uptr zone_ptr, const char *zone_name,
|
||||
BufferedStackTrace *stack) {
|
||||
ScopedInErrorReport in_report;
|
||||
Printf("mz_realloc(%p) -- attempting to realloc unallocated memory.\n"
|
||||
"This is an unrecoverable problem, exiting now.\n",
|
||||
addr);
|
||||
Printf(
|
||||
"mz_realloc(%p) -- attempting to realloc unallocated memory.\n"
|
||||
"This is an unrecoverable problem, exiting now.\n",
|
||||
(void *)addr);
|
||||
PrintZoneForPointer(addr, zone_ptr, zone_name);
|
||||
stack->Print();
|
||||
DescribeAddressIfHeap(addr);
|
||||
|
|
|
@ -557,7 +557,8 @@ void UnpoisonStack(uptr bottom, uptr top, const char *type) {
|
|||
"False positive error reports may follow\n"
|
||||
"For details see "
|
||||
"https://github.com/google/sanitizers/issues/189\n",
|
||||
type, top, bottom, top - bottom, top - bottom);
|
||||
type, (void *)top, (void *)bottom, (void *)(top - bottom),
|
||||
top - bottom);
|
||||
return;
|
||||
}
|
||||
PoisonShadow(bottom, RoundUpTo(top - bottom, SHADOW_GRANULARITY), 0);
|
||||
|
|
|
@ -33,7 +33,7 @@ static void ProtectGap(uptr addr, uptr size) {
|
|||
"protect_shadow_gap=0:"
|
||||
" not protecting shadow gap, allocating gap's shadow\n"
|
||||
"|| `[%p, %p]` || ShadowGap's shadow ||\n",
|
||||
GapShadowBeg, GapShadowEnd);
|
||||
(void*)GapShadowBeg, (void*)GapShadowEnd);
|
||||
ReserveShadowMemoryRange(GapShadowBeg, GapShadowEnd,
|
||||
"unprotected gap shadow");
|
||||
return;
|
||||
|
@ -113,7 +113,7 @@ void InitializeShadowMemory() {
|
|||
"Shadow memory range interleaves with an existing memory mapping. "
|
||||
"ASan cannot proceed correctly. ABORTING.\n");
|
||||
Report("ASan shadow was supposed to be located in the [%p-%p] range.\n",
|
||||
shadow_start, kHighShadowEnd);
|
||||
(void*)shadow_start, (void*)kHighShadowEnd);
|
||||
MaybeReportLinuxPIEBug();
|
||||
DumpProcessMap();
|
||||
Die();
|
||||
|
|
|
@ -254,7 +254,7 @@ void AsanThread::Init(const InitOptions *options) {
|
|||
int local = 0;
|
||||
VReport(1, "T%d: stack [%p,%p) size 0x%zx; local=%p\n", tid(),
|
||||
(void *)stack_bottom_, (void *)stack_top_, stack_top_ - stack_bottom_,
|
||||
&local);
|
||||
(void *)&local);
|
||||
}
|
||||
|
||||
// Fuchsia doesn't use ThreadStart.
|
||||
|
@ -443,7 +443,7 @@ AsanThread *GetCurrentThread() {
|
|||
|
||||
void SetCurrentThread(AsanThread *t) {
|
||||
CHECK(t->context());
|
||||
VReport(2, "SetCurrentThread: %p for thread %p\n", t->context(),
|
||||
VReport(2, "SetCurrentThread: %p for thread %p\n", (void *)t->context(),
|
||||
(void *)GetThreadSelf());
|
||||
// Make sure we do not reset the current AsanThread.
|
||||
CHECK_EQ(0, AsanTSDGet());
|
||||
|
|
|
@ -188,7 +188,8 @@ void ScanRangeForPointers(uptr begin, uptr end,
|
|||
const char *region_type, ChunkTag tag) {
|
||||
CHECK(tag == kReachable || tag == kIndirectlyLeaked);
|
||||
const uptr alignment = flags()->pointer_alignment();
|
||||
LOG_POINTERS("Scanning %s range %p-%p.\n", region_type, begin, end);
|
||||
LOG_POINTERS("Scanning %s range %p-%p.\n", region_type, (void *)begin,
|
||||
(void *)end);
|
||||
uptr pp = begin;
|
||||
if (pp % alignment)
|
||||
pp = pp + alignment - pp % alignment;
|
||||
|
@ -207,13 +208,15 @@ void ScanRangeForPointers(uptr begin, uptr end,
|
|||
LOG_POINTERS(
|
||||
"%p is poisoned: ignoring %p pointing into chunk %p-%p of size "
|
||||
"%zu.\n",
|
||||
pp, p, chunk, chunk + m.requested_size(), m.requested_size());
|
||||
(void *)pp, p, (void *)chunk, (void *)(chunk + m.requested_size()),
|
||||
m.requested_size());
|
||||
continue;
|
||||
}
|
||||
|
||||
m.set_tag(tag);
|
||||
LOG_POINTERS("%p: found %p pointing into chunk %p-%p of size %zu.\n", pp, p,
|
||||
chunk, chunk + m.requested_size(), m.requested_size());
|
||||
LOG_POINTERS("%p: found %p pointing into chunk %p-%p of size %zu.\n",
|
||||
(void *)pp, p, (void *)chunk,
|
||||
(void *)(chunk + m.requested_size()), m.requested_size());
|
||||
if (frontier)
|
||||
frontier->push_back(chunk);
|
||||
}
|
||||
|
@ -281,7 +284,7 @@ static void ProcessThreads(SuspendedThreadsList const &suspended_threads,
|
|||
InternalMmapVector<uptr> registers;
|
||||
for (uptr i = 0; i < suspended_threads.ThreadCount(); i++) {
|
||||
tid_t os_id = static_cast<tid_t>(suspended_threads.GetThreadID(i));
|
||||
LOG_THREADS("Processing thread %d.\n", os_id);
|
||||
LOG_THREADS("Processing thread %llu.\n", os_id);
|
||||
uptr stack_begin, stack_end, tls_begin, tls_end, cache_begin, cache_end;
|
||||
DTLS *dtls;
|
||||
bool thread_found = GetThreadRangesLocked(os_id, &stack_begin, &stack_end,
|
||||
|
@ -290,14 +293,14 @@ static void ProcessThreads(SuspendedThreadsList const &suspended_threads,
|
|||
if (!thread_found) {
|
||||
// If a thread can't be found in the thread registry, it's probably in the
|
||||
// process of destruction. Log this event and move on.
|
||||
LOG_THREADS("Thread %d not found in registry.\n", os_id);
|
||||
LOG_THREADS("Thread %llu not found in registry.\n", os_id);
|
||||
continue;
|
||||
}
|
||||
uptr sp;
|
||||
PtraceRegistersStatus have_registers =
|
||||
suspended_threads.GetRegistersAndSP(i, ®isters, &sp);
|
||||
if (have_registers != REGISTERS_AVAILABLE) {
|
||||
Report("Unable to get registers from thread %d.\n", os_id);
|
||||
Report("Unable to get registers from thread %llu.\n", os_id);
|
||||
// If unable to get SP, consider the entire stack to be reachable unless
|
||||
// GetRegistersAndSP failed with ESRCH.
|
||||
if (have_registers == REGISTERS_UNAVAILABLE_FATAL) continue;
|
||||
|
@ -313,7 +316,8 @@ static void ProcessThreads(SuspendedThreadsList const &suspended_threads,
|
|||
}
|
||||
|
||||
if (flags()->use_stacks) {
|
||||
LOG_THREADS("Stack at %p-%p (SP = %p).\n", stack_begin, stack_end, sp);
|
||||
LOG_THREADS("Stack at %p-%p (SP = %p).\n", (void *)stack_begin,
|
||||
(void *)stack_end, (void *)sp);
|
||||
if (sp < stack_begin || sp >= stack_end) {
|
||||
// SP is outside the recorded stack range (e.g. the thread is running a
|
||||
// signal handler on alternate stack, or swapcontext was used).
|
||||
|
@ -327,7 +331,7 @@ static void ProcessThreads(SuspendedThreadsList const &suspended_threads,
|
|||
stack_begin += page_size;
|
||||
}
|
||||
LOG_THREADS("Skipped %d guard page(s) to obtain stack %p-%p.\n",
|
||||
skipped, stack_begin, stack_end);
|
||||
skipped, (void *)stack_begin, (void *)stack_end);
|
||||
} else {
|
||||
// Shrink the stack range to ignore out-of-scope values.
|
||||
stack_begin = sp;
|
||||
|
@ -339,7 +343,7 @@ static void ProcessThreads(SuspendedThreadsList const &suspended_threads,
|
|||
|
||||
if (flags()->use_tls) {
|
||||
if (tls_begin) {
|
||||
LOG_THREADS("TLS at %p-%p.\n", tls_begin, tls_end);
|
||||
LOG_THREADS("TLS at %p-%p.\n", (void *)tls_begin, (void *)tls_end);
|
||||
// If the tls and cache ranges don't overlap, scan full tls range,
|
||||
// otherwise, only scan the non-overlapping portions
|
||||
if (cache_begin == cache_end || tls_end < cache_begin ||
|
||||
|
@ -373,7 +377,8 @@ static void ProcessThreads(SuspendedThreadsList const &suspended_threads,
|
|||
uptr dtls_beg = dtv.beg;
|
||||
uptr dtls_end = dtls_beg + dtv.size;
|
||||
if (dtls_beg < dtls_end) {
|
||||
LOG_THREADS("DTLS %zu at %p-%p.\n", id, dtls_beg, dtls_end);
|
||||
LOG_THREADS("DTLS %d at %p-%p.\n", id, (void *)dtls_beg,
|
||||
(void *)dtls_end);
|
||||
ScanRangeForPointers(dtls_beg, dtls_end, frontier, "DTLS",
|
||||
kReachable);
|
||||
}
|
||||
|
@ -381,7 +386,7 @@ static void ProcessThreads(SuspendedThreadsList const &suspended_threads,
|
|||
} else {
|
||||
// We are handling a thread with DTLS under destruction. Log about
|
||||
// this and continue.
|
||||
LOG_THREADS("Thread %d has DTLS under destruction.\n", os_id);
|
||||
LOG_THREADS("Thread %llu has DTLS under destruction.\n", os_id);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -399,8 +404,9 @@ void ScanRootRegion(Frontier *frontier, const RootRegion &root_region,
|
|||
uptr intersection_end = Min(region_end, root_region.begin + root_region.size);
|
||||
if (intersection_begin >= intersection_end) return;
|
||||
LOG_POINTERS("Root region %p-%p intersects with mapped region %p-%p (%s)\n",
|
||||
root_region.begin, root_region.begin + root_region.size,
|
||||
region_begin, region_end,
|
||||
(void *)root_region.begin,
|
||||
(void *)(root_region.begin + root_region.size),
|
||||
(void *)region_begin, (void *)region_end,
|
||||
is_readable ? "readable" : "unreadable");
|
||||
if (is_readable)
|
||||
ScanRangeForPointers(intersection_begin, intersection_end, frontier, "ROOT",
|
||||
|
@ -460,8 +466,8 @@ static void IgnoredSuppressedCb(uptr chunk, void *arg) {
|
|||
if (idx >= suppressed.size() || m.stack_trace_id() != suppressed[idx])
|
||||
return;
|
||||
|
||||
LOG_POINTERS("Suppressed: chunk %p-%p of size %zu.\n", chunk,
|
||||
chunk + m.requested_size(), m.requested_size());
|
||||
LOG_POINTERS("Suppressed: chunk %p-%p of size %zu.\n", (void *)chunk,
|
||||
(void *)(chunk + m.requested_size()), m.requested_size());
|
||||
m.set_tag(kIgnored);
|
||||
}
|
||||
|
||||
|
@ -472,8 +478,8 @@ static void CollectIgnoredCb(uptr chunk, void *arg) {
|
|||
chunk = GetUserBegin(chunk);
|
||||
LsanMetadata m(chunk);
|
||||
if (m.allocated() && m.tag() == kIgnored) {
|
||||
LOG_POINTERS("Ignored: chunk %p-%p of size %zu.\n",
|
||||
chunk, chunk + m.requested_size(), m.requested_size());
|
||||
LOG_POINTERS("Ignored: chunk %p-%p of size %zu.\n", (void *)chunk,
|
||||
(void *)(chunk + m.requested_size()), m.requested_size());
|
||||
reinterpret_cast<Frontier *>(arg)->push_back(chunk);
|
||||
}
|
||||
}
|
||||
|
@ -617,8 +623,9 @@ static void ReportIfNotSuspended(ThreadContextBase *tctx, void *arg) {
|
|||
if (tctx->status == ThreadStatusRunning) {
|
||||
uptr i = InternalLowerBound(suspended_threads, tctx->os_id);
|
||||
if (i >= suspended_threads.size() || suspended_threads[i] != tctx->os_id)
|
||||
Report("Running thread %d was not suspended. False leaks are possible.\n",
|
||||
tctx->os_id);
|
||||
Report(
|
||||
"Running thread %llu was not suspended. False leaks are possible.\n",
|
||||
tctx->os_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -871,7 +878,7 @@ void LeakReport::PrintLeakedObjectsForLeak(uptr index) {
|
|||
u32 leak_id = leaks_[index].id;
|
||||
for (uptr j = 0; j < leaked_objects_.size(); j++) {
|
||||
if (leaked_objects_[j].leak_id == leak_id)
|
||||
Printf("%p (%zu bytes)\n", leaked_objects_[j].addr,
|
||||
Printf("%p (%zu bytes)\n", (void *)leaked_objects_[j].addr,
|
||||
leaked_objects_[j].size);
|
||||
}
|
||||
}
|
||||
|
@ -962,7 +969,7 @@ void __lsan_register_root_region(const void *begin, uptr size) {
|
|||
CHECK(root_regions);
|
||||
RootRegion region = {reinterpret_cast<uptr>(begin), size};
|
||||
root_regions->push_back(region);
|
||||
VReport(1, "Registered root region at %p of size %llu\n", begin, size);
|
||||
VReport(1, "Registered root region at %p of size %zu\n", begin, size);
|
||||
#endif // CAN_SANITIZE_LEAKS
|
||||
}
|
||||
|
||||
|
@ -979,13 +986,13 @@ void __lsan_unregister_root_region(const void *begin, uptr size) {
|
|||
uptr last_index = root_regions->size() - 1;
|
||||
(*root_regions)[i] = (*root_regions)[last_index];
|
||||
root_regions->pop_back();
|
||||
VReport(1, "Unregistered root region at %p of size %llu\n", begin, size);
|
||||
VReport(1, "Unregistered root region at %p of size %zu\n", begin, size);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!removed) {
|
||||
Report(
|
||||
"__lsan_unregister_root_region(): region at %p of size %llu has not "
|
||||
"__lsan_unregister_root_region(): region at %p of size %zu has not "
|
||||
"been registered.\n",
|
||||
begin, size);
|
||||
Die();
|
||||
|
|
|
@ -44,7 +44,7 @@ static atomic_uintptr_t number_of_live_dtls;
|
|||
static const uptr kDestroyedThread = -1;
|
||||
|
||||
static void DTLS_Deallocate(DTLS::DTVBlock *block) {
|
||||
VReport(2, "__tls_get_addr: DTLS_Deallocate %p\n", block);
|
||||
VReport(2, "__tls_get_addr: DTLS_Deallocate %p\n", (void *)block);
|
||||
UnmapOrDie(block, sizeof(DTLS::DTVBlock));
|
||||
atomic_fetch_sub(&number_of_live_dtls, 1, memory_order_relaxed);
|
||||
}
|
||||
|
@ -66,12 +66,13 @@ static DTLS::DTVBlock *DTLS_NextBlock(atomic_uintptr_t *cur) {
|
|||
}
|
||||
uptr num_live_dtls =
|
||||
atomic_fetch_add(&number_of_live_dtls, 1, memory_order_relaxed);
|
||||
VReport(2, "__tls_get_addr: DTLS_NextBlock %p %zd\n", &dtls, num_live_dtls);
|
||||
VReport(2, "__tls_get_addr: DTLS_NextBlock %p %zd\n", (void *)&dtls,
|
||||
num_live_dtls);
|
||||
return new_dtv;
|
||||
}
|
||||
|
||||
static DTLS::DTV *DTLS_Find(uptr id) {
|
||||
VReport(2, "__tls_get_addr: DTLS_Find %p %zd\n", &dtls, id);
|
||||
VReport(2, "__tls_get_addr: DTLS_Find %p %zd\n", (void *)&dtls, id);
|
||||
static constexpr uptr kPerBlock = ARRAY_SIZE(DTLS::DTVBlock::dtvs);
|
||||
DTLS::DTVBlock *cur = DTLS_NextBlock(&dtls.dtv_block);
|
||||
if (!cur)
|
||||
|
@ -82,7 +83,7 @@ static DTLS::DTV *DTLS_Find(uptr id) {
|
|||
|
||||
void DTLS_Destroy() {
|
||||
if (!common_flags()->intercept_tls_get_addr) return;
|
||||
VReport(2, "__tls_get_addr: DTLS_Destroy %p\n", &dtls);
|
||||
VReport(2, "__tls_get_addr: DTLS_Destroy %p\n", (void *)&dtls);
|
||||
DTLS::DTVBlock *block = (DTLS::DTVBlock *)atomic_exchange(
|
||||
&dtls.dtv_block, kDestroyedThread, memory_order_release);
|
||||
while (block) {
|
||||
|
@ -120,7 +121,7 @@ DTLS::DTV *DTLS_on_tls_get_addr(void *arg_void, void *res,
|
|||
VReport(2,
|
||||
"__tls_get_addr: %p {0x%zx,0x%zx} => %p; tls_beg: 0x%zx; sp: %p "
|
||||
"num_live_dtls %zd\n",
|
||||
arg, arg->dso_id, arg->offset, res, tls_beg, &tls_beg,
|
||||
(void *)arg, arg->dso_id, arg->offset, res, tls_beg, (void *)&tls_beg,
|
||||
atomic_load(&number_of_live_dtls, memory_order_relaxed));
|
||||
if (dtls.last_memalign_ptr == tls_beg) {
|
||||
tls_size = dtls.last_memalign_size;
|
||||
|
|
Loading…
Reference in New Issue