[compiler-rt] r235798 - [asan] Print SHADOW_SCALE and SHADOW_GRANULARITY as decimal values.

Daniel Sanders daniel.sanders at imgtec.com
Sat Apr 25 03:57:37 PDT 2015


Author: dsanders
Date: Sat Apr 25 05:57:35 2015
New Revision: 235798

URL: http://llvm.org/viewvc/llvm-project?rev=235798&view=rev
Log:
[asan] Print SHADOW_SCALE and SHADOW_GRANULARITY as decimal values.

Summary:
During the review of http://reviews.llvm.org/D9199 where I had originally
changed the debug_mapping.cc test to accept hexadecimal values, we realized
that SHADOW_SCALE and SHADOW_GRANULARITY ought to be printed as decimal values.
This patch makes that change.

This patch also adds a '0x' prefix to the SHADOW_OFFSET to make it clear that
it is hexadecimal while the other two are decimal.

Reviewers: kcc, timurrrr, samsonov

Reviewed By: timurrrr, samsonov

Subscribers: samsonov, llvm-commits, sagar

Differential Revision: http://reviews.llvm.org/D9224

Modified:
    compiler-rt/trunk/lib/asan/asan_rtl.cc
    compiler-rt/trunk/test/asan/TestCases/debug_mapping.cc

Modified: compiler-rt/trunk/lib/asan/asan_rtl.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_rtl.cc?rev=235798&r1=235797&r2=235798&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_rtl.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_rtl.cc Sat Apr 25 05:57:35 2015
@@ -347,9 +347,9 @@ static void PrintAddressSpaceLayout() {
   Printf("malloc_context_size=%zu\n",
          (uptr)common_flags()->malloc_context_size);
 
-  Printf("SHADOW_SCALE: %zx\n", (uptr)SHADOW_SCALE);
-  Printf("SHADOW_GRANULARITY: %zx\n", (uptr)SHADOW_GRANULARITY);
-  Printf("SHADOW_OFFSET: %zx\n", (uptr)SHADOW_OFFSET);
+  Printf("SHADOW_SCALE: %d\n", (int)SHADOW_SCALE);
+  Printf("SHADOW_GRANULARITY: %d\n", (int)SHADOW_GRANULARITY);
+  Printf("SHADOW_OFFSET: 0x%zx\n", (uptr)SHADOW_OFFSET);
   CHECK(SHADOW_SCALE >= 3 && SHADOW_SCALE <= 7);
   if (kMidMemBeg)
     CHECK(kMidShadowBeg > kLowShadowEnd &&

Modified: compiler-rt/trunk/test/asan/TestCases/debug_mapping.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/debug_mapping.cc?rev=235798&r1=235797&r2=235798&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/debug_mapping.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/debug_mapping.cc Sat Apr 25 05:57:35 2015
@@ -8,14 +8,14 @@
 
 // printed because of verbosity=1
 // CHECK: SHADOW_SCALE: [[SCALE:[0-9]+]]
-// CHECK: SHADOW_OFFSET: [[OFFSET:[0-9a-f]+]]
+// CHECK: SHADOW_OFFSET: [[OFFSET:0x[0-9a-f]+]]
 
 int main() {
   size_t scale, offset;
   __asan_get_shadow_mapping(&scale, &offset);
 
-  fprintf(stderr, "scale: %lx\n", scale);
-  fprintf(stderr, "offset: %lx\n", offset);
+  fprintf(stderr, "scale: %d\n", (int)scale);
+  fprintf(stderr, "offset: 0x%lx\n", offset);
 
   // CHECK: scale: [[SCALE]]
   // CHECK: offset: [[OFFSET]]





More information about the llvm-commits mailing list