summaryrefslogtreecommitdiffstats
path: root/compiler-rt/include/xray/xray_interface.h
diff options
context:
space:
mode:
authorDean Michael Berris <dberris@google.com>2017-03-06 07:25:41 +0000
committerDean Michael Berris <dberris@google.com>2017-03-06 07:25:41 +0000
commita814c94163cc12df9c7b533cec22ea7cc4c20688 (patch)
treeb957784bcb79019169a85adb3d175636c523afab /compiler-rt/include/xray/xray_interface.h
parent418da3fe80230c26afaa29db0787f709c67c74c3 (diff)
downloadbcm5719-llvm-a814c94163cc12df9c7b533cec22ea7cc4c20688.tar.gz
bcm5719-llvm-a814c94163cc12df9c7b533cec22ea7cc4c20688.zip
[XRay] [compiler-rt] Allow logging the first argument of a function call.
Summary: Functions with the LOG_ARGS_ENTRY sled kind at their beginning will be handled in a way to (optionally) pass their first call argument to your logging handler. For practical and performance reasons, only the first argument is supported, and only up to 64 bits. Reviewers: javed.absar, dberris Reviewed By: dberris Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D29703 llvm-svn: 297000
Diffstat (limited to 'compiler-rt/include/xray/xray_interface.h')
-rw-r--r--compiler-rt/include/xray/xray_interface.h19
1 files changed, 18 insertions, 1 deletions
diff --git a/compiler-rt/include/xray/xray_interface.h b/compiler-rt/include/xray/xray_interface.h
index 9e712b1fa2a..52a7e1d9e94 100644
--- a/compiler-rt/include/xray/xray_interface.h
+++ b/compiler-rt/include/xray/xray_interface.h
@@ -18,7 +18,13 @@
extern "C" {
-enum XRayEntryType { ENTRY = 0, EXIT = 1, TAIL = 2 };
+// Synchronize this with AsmPrinter::SledKind in LLVM.
+enum XRayEntryType {
+ ENTRY = 0,
+ EXIT = 1,
+ TAIL = 2,
+ LOG_ARGS_ENTRY = 3,
+};
// Provide a function to invoke for when instrumentation points are hit. This is
// a user-visible control surface that overrides the default implementation. The
@@ -60,6 +66,17 @@ extern XRayPatchingStatus __xray_patch();
// Reverses the effect of __xray_patch(). See XRayPatchingStatus for possible
// result values.
extern XRayPatchingStatus __xray_unpatch();
+
+// Use XRay to log the first argument of each (instrumented) function call.
+// When this function exits, all threads will have observed the effect and
+// start logging their subsequent affected function calls (if patched).
+//
+// Returns 1 on success, 0 on error.
+extern int __xray_set_handler_arg1(void (*)(int32_t, XRayEntryType, uint64_t));
+
+// Disables the XRay handler used to log first arguments of function calls.
+// Returns 1 on success, 0 on error.
+extern int __xray_remove_handler_arg1();
}
#endif
OpenPOWER on IntegriCloud