[PATCH] D34669: [XRay][compiler-rt][NFC] Add example always/never instrument files.

Dean Michael Berris via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 27 21:45:01 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL306502: [XRay][compiler-rt][NFC] Add example always/never instrument files. (authored by dberris).

Repository:
  rL LLVM

https://reviews.llvm.org/D34669

Files:
  compiler-rt/trunk/lib/xray/xray_always_instrument.txt
  compiler-rt/trunk/lib/xray/xray_never_instrument.txt
  compiler-rt/trunk/test/xray/TestCases/always-never-instrument.cc


Index: compiler-rt/trunk/lib/xray/xray_always_instrument.txt
===================================================================
--- compiler-rt/trunk/lib/xray/xray_always_instrument.txt
+++ compiler-rt/trunk/lib/xray/xray_always_instrument.txt
@@ -0,0 +1,6 @@
+# List of function matchers common to C/C++ applications that make sense to
+# always instrument. You can use this as an argument to
+# -fxray-always-instrument=<path> along with your project-specific lists.
+
+# Always instrument the main function.
+fun:main
Index: compiler-rt/trunk/lib/xray/xray_never_instrument.txt
===================================================================
--- compiler-rt/trunk/lib/xray/xray_never_instrument.txt
+++ compiler-rt/trunk/lib/xray/xray_never_instrument.txt
@@ -0,0 +1,6 @@
+# List of function matchers common to C/C++ applications that make sense to
+# never instrument. You can use this as an argument to
+# -fxray-never-instrument=<path> along with your project-specific lists.
+
+# Never instrument any function whose symbol starts with __xray.
+fun:__xray*
Index: compiler-rt/trunk/test/xray/TestCases/always-never-instrument.cc
===================================================================
--- compiler-rt/trunk/test/xray/TestCases/always-never-instrument.cc
+++ compiler-rt/trunk/test/xray/TestCases/always-never-instrument.cc
@@ -0,0 +1,21 @@
+// Test that the always/never instrument lists apply.
+// RUN: echo "fun:main" > %tmp-always.txt
+// RUN: echo "fun:__xray*" > %tmp-never.txt
+// RUN: %clangxx_xray \
+// RUN:     -fxray-never-instrument=%tmp-never.txt \
+// RUN:     -fxray-always-instrument=%tmp-always.txt \
+// RUN:     %s -o %t
+// RUN: %llvm_xray extract -symbolize %t | \
+// RUN:    FileCheck %s --check-prefix NOINSTR
+// RUN: %llvm_xray extract -symbolize %t | \
+// RUN:    FileCheck %s --check-prefix ALWAYSINSTR
+
+// NOINSTR-NOT: {{.*__xray_NeverInstrumented.*}}
+int __xray_NeverInstrumented() {
+  return 0;
+}
+
+// ALWAYSINSTR: {{.*function-name:.*main.*}}
+int main(int argc, char *argv[]) {
+  return __xray_NeverInstrumented();
+}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34669.104346.patch
Type: text/x-patch
Size: 2082 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170628/513b97a0/attachment.bin>


More information about the llvm-commits mailing list