diff options
author | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2012-03-21 11:32:46 +0000 |
---|---|---|
committer | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2012-03-21 11:32:46 +0000 |
commit | 739eb7984139d457216623347ae3b7a706c0aadf (patch) | |
tree | 1c61a916805bdaff0363e40a3b147c14b791e900 /lib/asan/asan_globals.cc | |
parent | 2962f26071ebef1d5fec52b5569e5ae7aae45c9b (diff) |
[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.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@153177 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/asan/asan_globals.cc')
-rw-r--r-- | lib/asan/asan_globals.cc | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/asan/asan_globals.cc b/lib/asan/asan_globals.cc index f53bf38db..427df143d 100644 --- a/lib/asan/asan_globals.cc +++ b/lib/asan/asan_globals.cc @@ -74,13 +74,13 @@ bool DescribeAddrIfMyRedZone(const Global &g, uintptr_t addr) { if (addr >= g.beg + g.size_with_redzone) return false; Printf("%p is located ", addr); 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) { - Printf("%d bytes to the right", addr - (g.beg + g.size)); + Printf("%zd bytes to the right", addr - (g.beg + g.size)); } 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); PrintIfASCII(g); return true; @@ -94,7 +94,7 @@ bool DescribeAddrIfGlobal(uintptr_t 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=%ld name=%s\n", + Printf("Search Global: beg=%p size=%zu name=%s\n", g.beg, g.size, g.name); res |= DescribeAddrIfMyRedZone(g, addr); } @@ -117,7 +117,7 @@ static void RegisterGlobal(const Global *g) { l->next = list_of_globals; list_of_globals = l; 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); } |