[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
diff --git a/lib/asan/asan_stack.cc b/lib/asan/asan_stack.cc
index 4ec330d..45d30c1 100644
--- a/lib/asan/asan_stack.cc
+++ b/lib/asan/asan_stack.cc
@@ -33,7 +33,7 @@
     uptr pc = addr[i];
     char buff[4096];
     ASAN_USE_EXTERNAL_SYMBOLIZER((void*)pc, buff, sizeof(buff));
-    Printf("  #%zu 0x%zx %s\n", i, pc, buff);
+    AsanPrintf("  #%zu 0x%zx %s\n", i, pc, buff);
   }
 }
 
@@ -51,19 +51,19 @@
       for (AddressInfoList *entry = address_info_list; entry;
            entry = entry->next) {
         AddressInfo info = entry->info;
-        Printf("    #%zu 0x%zx %s:%d:%d\n", frame_num, pc,
-                                            (info.file) ? info.file : "",
-                                            info.line, info.column);
+        AsanPrintf("    #%zu 0x%zx %s:%d:%d\n", frame_num, pc,
+                                                (info.file) ? info.file : "",
+                                                info.line, info.column);
         frame_num++;
       }
       address_info_list->Clear();
     } else {
       if (proc_maps.GetObjectNameAndOffset(pc, &offset,
                                            filename, sizeof(filename))) {
-        Printf("    #%zu 0x%zx (%s+0x%zx)\n", frame_num, pc, filename,
-                                              offset);
+        AsanPrintf("    #%zu 0x%zx (%s+0x%zx)\n", frame_num, pc, filename,
+                                                  offset);
       } else {
-        Printf("    #%zu 0x%zx\n", frame_num, pc);
+        AsanPrintf("    #%zu 0x%zx\n", frame_num, pc);
       }
       frame_num++;
     }