Summary: Currently, we assume that applications built with XRay would like to have the instrumentation sleds patched before main starts. This patch changes the default so that we do not patch the instrumentation sleds before main. This default is more helpful for deploying applications in environments where changing the current default is harder (i.e. on remote machines, or work-pool-like systems). This default (not to patch pre-main) makes it easier to selectively run applications with XRay instrumentation enabled, than with the current state. Reviewers: echristo, timshen Subscribers: mehdi_amini, llvm-commits Differential Revision: https://reviews.llvm.org/D30396 llvm-svn: 296445
34 lines
817 B
C++
34 lines
817 B
C++
// Test to check if we handle pic code properly.
|
|
|
|
// RUN: %clangxx_xray -fxray-instrument -std=c++11 -fpic %s -o %t
|
|
// RUN: XRAY_OPTIONS="patch_premain=true verbosity=1 xray_logfile_base=pic-test-logging-" %run %t 2>&1 | FileCheck %s
|
|
// After all that, clean up the output xray log.
|
|
//
|
|
// RUN: rm pic-test-logging-*
|
|
|
|
#include <cstdio>
|
|
|
|
[[clang::xray_always_instrument]]
|
|
unsigned short foo (unsigned b);
|
|
|
|
[[clang::xray_always_instrument]]
|
|
unsigned short bar (unsigned short a)
|
|
{
|
|
printf("bar() is always instrumented!\n");
|
|
return foo(a);
|
|
}
|
|
|
|
unsigned short foo (unsigned b)
|
|
{
|
|
printf("foo() is always instrumented!\n");
|
|
return b + b + 5;
|
|
}
|
|
|
|
int main ()
|
|
{
|
|
// CHECK: XRay: Log file in 'pic-test-logging-{{.*}}'
|
|
bar(10);
|
|
// CHECK: bar() is always instrumented!
|
|
// CHECK-NEXT: foo() is always instrumented!
|
|
}
|