[compiler-rt] r342164 - [hwasan] use a single Printf per line when printing a report (more friendly to android logging)

Kostya Serebryany via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 13 12:14:22 PDT 2018


Author: kcc
Date: Thu Sep 13 12:14:22 2018
New Revision: 342164

URL: http://llvm.org/viewvc/llvm-project?rev=342164&view=rev
Log:
[hwasan] use a single Printf per line when printing a report (more friendly to android logging)

Modified:
    compiler-rt/trunk/lib/hwasan/hwasan_report.cc

Modified: compiler-rt/trunk/lib/hwasan/hwasan_report.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/hwasan/hwasan_report.cc?rev=342164&r1=342163&r2=342164&view=diff
==============================================================================
--- compiler-rt/trunk/lib/hwasan/hwasan_report.cc (original)
+++ compiler-rt/trunk/lib/hwasan/hwasan_report.cc Thu Sep 13 12:14:22 2018
@@ -192,14 +192,17 @@ static void PrintTagsAroundAddr(tag_t *t
       RoundDownTo(reinterpret_cast<uptr>(tag_ptr), row_len));
   tag_t *beg_row = center_row_beg - row_len * (num_rows / 2);
   tag_t *end_row = center_row_beg + row_len * (num_rows / 2);
+  InternalScopedString s(GetPageSizeCached());
   for (tag_t *row = beg_row; row < end_row; row += row_len) {
-    Printf("%s", row == center_row_beg ? "=>" : "  ");
+    s.append("%s", row == center_row_beg ? "=>" : "  ");
     for (uptr i = 0; i < row_len; i++) {
-      Printf("%s", row + i == tag_ptr ? "[" : " ");
-      Printf("%02x", row[i]);
-      Printf("%s", row + i == tag_ptr ? "]" : " ");
+      s.append("%s", row + i == tag_ptr ? "[" : " ");
+      s.append("%02x", row[i]);
+      s.append("%s", row + i == tag_ptr ? "]" : " ");
     }
-    Printf("%s\n", row == center_row_beg ? "<=" : "  ");
+    s.append("%s\n", row == center_row_beg ? "<=" : "  ");
+    Printf("%s", s.data());
+    s.clear();
   }
 }
 




More information about the llvm-commits mailing list