1 // Intercept the implicit 'this' argument of class member functions. 2 // 3 // RUN: %clangxx_xray -g -std=c++11 %s -o %t 4 // RUN: rm -f log-args-this-* 5 // RUN: XRAY_OPTIONS="patch_premain=true verbosity=1 xray_logfile_base=log-args-this-" %run %t 6 // 7 // XFAIL: FreeBSD || arm || aarch64 || mips 8 // UNSUPPORTED: powerpc64le 9 #include "xray/xray_interface.h" 10 #include <cassert> 11 12 class A { 13 public: f()14 [[clang::xray_always_instrument, clang::xray_log_args(1)]] void f() { 15 // does nothing. 16 } 17 }; 18 19 volatile uint64_t captured = 0; 20 handler(int32_t,XRayEntryType,uint64_t arg1)21void handler(int32_t, XRayEntryType, uint64_t arg1) { 22 captured = arg1; 23 } 24 main()25int main() { 26 __xray_set_handler_arg1(handler); 27 A instance; 28 instance.f(); 29 __xray_remove_handler_arg1(); 30 assert(captured == (uint64_t)&instance); 31 } 32