diff options
author | Dean Michael Berris <dberris@google.com> | 2017-03-06 07:25:41 +0000 |
---|---|---|
committer | Dean Michael Berris <dberris@google.com> | 2017-03-06 07:25:41 +0000 |
commit | 10dfe2dbc7c64b7f1a9a6f060f8f1f5940febb29 (patch) | |
tree | a80d244cf381c2b20f2ce2fd7498045b8392b038 /include | |
parent | 5e8e96ad29fb885ac3ee4bdf17040e5017b8f2eb (diff) |
[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
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@297000 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/xray/xray_interface.h | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/include/xray/xray_interface.h b/include/xray/xray_interface.h index 9e712b1fa..52a7e1d9e 100644 --- a/include/xray/xray_interface.h +++ b/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 |