1 // Make sure that we're aligning the stack properly to support handlers that
2 // expect 16-byte alignment of the stack.
4 // RUN: %clangxx_xray -std=c++11 %s -o %t
5 // RUN: XRAY_OPTIONS="patch_premain=false verbosity=1" \
7 // REQUIRES: x86_64-target-arch
8 // REQUIRES: built-in-llvm-tree
9 #include "xray/xray_interface.h"
11 #include <xmmintrin.h>
13 [[clang::xray_never_instrument
]] __attribute__((weak
)) __m128
f(__m128
*i
) {
17 [[clang::xray_always_instrument
]] __attribute__((noinline
)) void noarg() {
22 [[ clang::xray_always_instrument
, clang::xray_log_args(1) ]]
23 __attribute__((noinline
)) void arg1(int) {
28 [[clang::xray_always_instrument
]] __attribute__((noinline
))
29 void no_alignment() {}
31 [[clang::xray_never_instrument
]] void noarg_handler(int32_t,
33 printf("noarg handler called\n");
38 [[clang::xray_never_instrument
]] void arg1_handler(int32_t, XRayEntryType
,
40 printf("arg1 handler called\n");
45 int main(int argc
, char *argv
[]) {
46 __xray_set_handler(noarg_handler
);
47 __xray_set_handler_arg1(arg1_handler
);
49 noarg(); // CHECK: noarg handler called
50 arg1(argc
); // CHECK: arg1 handler called
53 __xray_remove_handler();
54 __xray_remove_handler_arg1();