[compiler-rt] r290074 - [XRay] [compiler-rt] Fix format string; sanitizers' internal printf() doesn't support %ld.

Dean Michael Berris via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 18 16:47:41 PST 2016


Author: dberris
Date: Sun Dec 18 18:47:40 2016
New Revision: 290074

URL: http://llvm.org/viewvc/llvm-project?rev=290074&view=rev
Log:
[XRay] [compiler-rt] Fix format string; sanitizers' internal printf() doesn't support %ld.

Summary:
Getting rid of the distance number altogether because:
- a person knowledgeable enough to know what the message means will also
  know how to do hexadecimal math (with the help of a calculator)
- numbers outside INT_MIN - INT_MAX are hard to comprehend anyway

This unbreaks the case when you dynamically link a library with XRay and
it exits pre-main() with a not very informative static string.

Author: pelikan

Reviewers: dberris

Subscribers: llvm-commits, mehdi_amini

Differential Revision: https://reviews.llvm.org/D27894

Modified:
    compiler-rt/trunk/lib/xray/xray_x86_64.cc

Modified: compiler-rt/trunk/lib/xray/xray_x86_64.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/xray/xray_x86_64.cc?rev=290074&r1=290073&r2=290074&view=diff
==============================================================================
--- compiler-rt/trunk/lib/xray/xray_x86_64.cc (original)
+++ compiler-rt/trunk/lib/xray/xray_x86_64.cc Sun Dec 18 18:47:40 2016
@@ -43,10 +43,8 @@ bool patchFunctionEntry(const bool Enabl
   int64_t TrampolineOffset = reinterpret_cast<int64_t>(__xray_FunctionEntry) -
                              (static_cast<int64_t>(Sled.Address) + 11);
   if (TrampolineOffset < MinOffset || TrampolineOffset > MaxOffset) {
-    Report("XRay Entry trampoline (%p) too far from sled (%p); distance = "
-           "%ld\n",
-           __xray_FunctionEntry, reinterpret_cast<void *>(Sled.Address),
-           TrampolineOffset);
+    Report("XRay Entry trampoline (%p) too far from sled (%p)\n",
+           __xray_FunctionEntry, reinterpret_cast<void *>(Sled.Address));
     return false;
   }
   if (Enable) {
@@ -90,10 +88,8 @@ bool patchFunctionExit(const bool Enable
   int64_t TrampolineOffset = reinterpret_cast<int64_t>(__xray_FunctionExit) -
                              (static_cast<int64_t>(Sled.Address) + 11);
   if (TrampolineOffset < MinOffset || TrampolineOffset > MaxOffset) {
-    Report("XRay Exit trampoline (%p) too far from sled (%p); distance = "
-           "%ld\n",
-           __xray_FunctionExit, reinterpret_cast<void *>(Sled.Address),
-           TrampolineOffset);
+    Report("XRay Exit trampoline (%p) too far from sled (%p)\n",
+           __xray_FunctionExit, reinterpret_cast<void *>(Sled.Address));
     return false;
   }
   if (Enable) {
@@ -120,10 +116,8 @@ bool patchFunctionTailExit(const bool En
       reinterpret_cast<int64_t>(__xray_FunctionTailExit) -
       (static_cast<int64_t>(Sled.Address) + 11);
   if (TrampolineOffset < MinOffset || TrampolineOffset > MaxOffset) {
-    Report("XRay Exit trampoline (%p) too far from sled (%p); distance = "
-           "%ld\n",
-           __xray_FunctionExit, reinterpret_cast<void *>(Sled.Address),
-           TrampolineOffset);
+    Report("XRay Exit trampoline (%p) too far from sled (%p)\n",
+           __xray_FunctionExit, reinterpret_cast<void *>(Sled.Address));
     return false;
   }
   if (Enable) {




More information about the llvm-commits mailing list