1 // Make sure we're aligning the stack properly when lowering the custom event 2 // calls. 3 // 4 // RUN: %clangxx_xray -std=c++11 %s -o %t 5 // RUN: XRAY_OPTIONS="patch_premain=false verbosity=1" \ 6 // RUN: %run %t 2>&1 7 // REQUIRES: x86_64-target-arch 8 // REQUIRES: built-in-llvm-tree 9 #include <xmmintrin.h> 10 #include <stdio.h> 11 #include "xray/xray_interface.h" 12 f(__m128 * i)13[[clang::xray_never_instrument]] __attribute__((weak)) __m128 f(__m128 *i) { 14 return *i; 15 } 16 foo()17[[clang::xray_always_instrument]] void foo() { 18 __xray_customevent(0, 0); 19 __m128 v = {}; 20 f(&v); 21 } 22 bar()23[[clang::xray_always_instrument]] void bar() { 24 __xray_customevent(0, 0); 25 } 26 printer(void * ptr,size_t size)27void printer(void* ptr, size_t size) { 28 printf("handler called\n"); 29 __m128 v = {}; 30 f(&v); 31 } 32 main(int argc,char * argv[])33int main(int argc, char* argv[]) { 34 __xray_set_customevent_handler(printer); 35 __xray_patch(); 36 foo(); // CHECK: handler called 37 bar(); // CHECK: handler called 38 __xray_unpatch(); 39 __xray_remove_customevent_handler(); 40 foo(); 41 bar(); 42 } 43