[PATCH] D34051: [XRay][compiler-rt] Add test for logging the implicit "this" argument for C++ member functions.

Dean Michael Berris via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 9 05:16:26 PDT 2017


dberris updated this revision to Diff 102016.
dberris retitled this revision from "Add test for logging the implicit "this" argument for C++ member functions." to "[XRay][compiler-rt] Add test for logging the implicit "this" argument for C++ member functions.".
dberris edited the summary of this revision.
dberris added a dependency: D34052: [XRay][clang] Support capturing the implicit `this` argument to C++ class member functions.
dberris added a comment.

Retitle, update dependency.


https://reviews.llvm.org/D34051

Files:
  test/xray/TestCases/Linux/arg1-logging-implicit-this.cc


Index: test/xray/TestCases/Linux/arg1-logging-implicit-this.cc
===================================================================
--- /dev/null
+++ test/xray/TestCases/Linux/arg1-logging-implicit-this.cc
@@ -0,0 +1,31 @@
+// Intercept the implicit 'this' argument of class member functions.
+//
+// RUN: %clangxx_xray -g -std=c++11 %s -o %t
+// RUN: rm log-args-this-* || true
+// RUN: XRAY_OPTIONS="patch_premain=true verbosity=1 xray_logfile_base=log-args-this-" %run %t
+//
+// XFAIL: arm || aarch64 || mips
+// UNSUPPORTED: powerpc64le
+#include "xray/xray_interface.h"
+#include <cassert>
+
+class A {
+ public:
+  [[clang::xray_always_instrument, clang::xray_log_args(1)]] void f() {
+    // does nothing.
+  }
+};
+
+volatile uint64_t captured = 0;
+
+void handler(int32_t, XRayEntryType, uint64_t arg1) {
+  captured = arg1;
+}
+
+int main() {
+  __xray_set_handler_arg1(handler);
+  A instance;
+  instance.f();
+  __xray_remove_handler_arg1();
+  assert(captured == (uint64_t)&instance);
+}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34051.102016.patch
Type: text/x-patch
Size: 1002 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170609/fede4c9d/attachment.bin>


More information about the llvm-commits mailing list