summaryrefslogtreecommitdiff
path: root/lib/asan/asan_globals.cc
diff options
context:
space:
mode:
authorAlexey Samsonov <samsonov@google.com>2012-06-06 13:11:29 +0000
committerAlexey Samsonov <samsonov@google.com>2012-06-06 13:11:29 +0000
commite954101f6602ac181a2c3accfbbad0ae51b0bf7c (patch)
tree59996ca17d614af49772a8c83e378e6829ebb212 /lib/asan/asan_globals.cc
parente4309e8141382372465ea065e86d8f946aa99c38 (diff)
[Sanitizer]: Introduce a common internal printf function. For now, also use tool-specific wrappers TsanPrintf (its output is controlled by TSan flags) and AsanPrintf (which copies its results to the ASan-private buffer). Supported formats: %[z]{d,u,x}, %s, %p. Re-write all format strings in TSan according to this format (this should have no effect on 64-bit platforms).
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@158065 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/asan/asan_globals.cc')
-rw-r--r--lib/asan/asan_globals.cc18
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/asan/asan_globals.cc b/lib/asan/asan_globals.cc
index 4c3ab95e0..1309e449c 100644
--- a/lib/asan/asan_globals.cc
+++ b/lib/asan/asan_globals.cc
@@ -66,22 +66,22 @@ void PrintIfASCII(const Global &g) {
if (!isascii(*(char*)p)) return;
}
if (*(char*)(g.beg + g.size - 1) != 0) return;
- Printf(" '%s' is ascii string '%s'\n", g.name, (char*)g.beg);
+ AsanPrintf(" '%s' is ascii string '%s'\n", g.name, (char*)g.beg);
}
bool DescribeAddrIfMyRedZone(const Global &g, uptr addr) {
if (addr < g.beg - kGlobalAndStackRedzone) return false;
if (addr >= g.beg + g.size_with_redzone) return false;
- Printf("%p is located ", (void*)addr);
+ AsanPrintf("%p is located ", (void*)addr);
if (addr < g.beg) {
- Printf("%zd bytes to the left", g.beg - addr);
+ AsanPrintf("%zd bytes to the left", g.beg - addr);
} else if (addr >= g.beg + g.size) {
- Printf("%zd bytes to the right", addr - (g.beg + g.size));
+ AsanPrintf("%zd bytes to the right", addr - (g.beg + g.size));
} else {
- Printf("%zd bytes inside", addr - g.beg); // Can it happen?
+ AsanPrintf("%zd bytes inside", addr - g.beg); // Can it happen?
}
- Printf(" of global variable '%s' (0x%zx) of size %zu\n",
- g.name, g.beg, g.size);
+ AsanPrintf(" of global variable '%s' (0x%zx) of size %zu\n",
+ g.name, g.beg, g.size);
PrintIfASCII(g);
return true;
}
@@ -94,8 +94,8 @@ bool DescribeAddrIfGlobal(uptr addr) {
for (ListOfGlobals *l = list_of_globals; l; l = l->next) {
const Global &g = *l->g;
if (FLAG_report_globals >= 2)
- Printf("Search Global: beg=%p size=%zu name=%s\n",
- (void*)g.beg, g.size, (char*)g.name);
+ AsanPrintf("Search Global: beg=%p size=%zu name=%s\n",
+ (void*)g.beg, g.size, (char*)g.name);
res |= DescribeAddrIfMyRedZone(g, addr);
}
return res;