diff options
author | Dean Michael Berris <dberris@google.com> | 2017-06-28 04:44:36 +0000 |
---|---|---|
committer | Dean Michael Berris <dberris@google.com> | 2017-06-28 04:44:36 +0000 |
commit | 261d97332dfcf92692fa316c1e43b568b73ce3b3 (patch) | |
tree | 91605bb3d72cbdd5abd6cc3fe2e0af0e5a0d5b47 | |
parent | c4ce2293b0d55fa803270c6c00d6fbe2ebc9ade2 (diff) | |
download | bcm5719-llvm-261d97332dfcf92692fa316c1e43b568b73ce3b3.tar.gz bcm5719-llvm-261d97332dfcf92692fa316c1e43b568b73ce3b3.zip |
[XRay][compiler-rt][NFC] Add example always/never instrument files.
Summary:
This change introduces two files that show exaples of the
always/never instrument files that can be provided to clang. We don't
add these as defaults yet in clang, which we can do later on (in a
separate change).
We also add a test that makes sure that these apply in the compiler-rt
project tests, and that changes in clang don't break the expectations in
compiler-rt.
Reviewers: pelikan, kpw
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D34669
llvm-svn: 306502
-rw-r--r-- | compiler-rt/lib/xray/xray_always_instrument.txt | 6 | ||||
-rw-r--r-- | compiler-rt/lib/xray/xray_never_instrument.txt | 6 | ||||
-rw-r--r-- | compiler-rt/test/xray/TestCases/always-never-instrument.cc | 21 |
3 files changed, 33 insertions, 0 deletions
diff --git a/compiler-rt/lib/xray/xray_always_instrument.txt b/compiler-rt/lib/xray/xray_always_instrument.txt new file mode 100644 index 00000000000..151ed703dd5 --- /dev/null +++ b/compiler-rt/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 diff --git a/compiler-rt/lib/xray/xray_never_instrument.txt b/compiler-rt/lib/xray/xray_never_instrument.txt new file mode 100644 index 00000000000..7fa48dda7e1 --- /dev/null +++ b/compiler-rt/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* diff --git a/compiler-rt/test/xray/TestCases/always-never-instrument.cc b/compiler-rt/test/xray/TestCases/always-never-instrument.cc new file mode 100644 index 00000000000..990ee3eff0f --- /dev/null +++ b/compiler-rt/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(); +} |