summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/xray/xray_interface.cc
Commit message (Collapse)AuthorAgeFilesLines
* compiler-rt: Rename .cc file in lib/xray to .cppNico Weber2019-08-011-480/+0
| | | | | | Like r367463, but for xray. llvm-svn: 367546
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* [XRay] Support for FuchsiaPetr Hosek2018-11-221-4/+37
| | | | | | | | This extends XRay to support Fuchsia. Differential Revision: https://reviews.llvm.org/D52162 llvm-svn: 347443
* [XRay][compiler-rt] Remove __sanitizer:: from namespace __xray (NFC)Dean Michael Berris2018-06-051-45/+45
| | | | | | | This is a non-functional change that removes the full qualification of functions in __sanitizer:: being used in __xray. llvm-svn: 333983
* Remove 'noexcept's that do not match between header and source file.Richard Smith2018-04-241-3/+3
| | | | | | This code is ill-formed, but under -fno-exceptions compilers generally accept it (at least, prior to C++17). This allows this code to be built by Clang in C++17 mode. llvm-svn: 330765
* Implement trampoline and handler for typed xray event tracing.Keith Wyss2018-04-171-6/+53
| | | | | | | | | | | | | | Summary: Compiler-rt support first before defining the __xray_typedevent() lowering in llvm. I'm looking for some early feedback before I touch much more code. Reviewers: dberris Subscribers: delcypher, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D43668 llvm-svn: 330218
* [XRay][compiler-rt] Coalesce calls to mprotect to reduce patching overheadDean Michael Berris2017-12-141-129/+183
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Before this change, XRay would conservatively patch sections of the code one sled at a time. Upon testing/profiling, this turns out to take an inordinate amount of time and cycles. For an instrumented clang binary, the cycles spent both in the patching/unpatching routine constituted 4% of the cycles -- this didn't count the time spent in the kernel while performing the mprotect calls in quick succession. With this change, we're coalescing the number of calls to mprotect from being linear to the number of instrumentation points, to now being a lower constant when patching all the sleds through `__xray_patch()` or `__xray_unpatch()`. In the case of calling `__xray_patch_function()` or `__xray_unpatch_function()` we're now doing an mprotect call once for all the sleds for that function (reduction of at least 2x calls to mprotect). Reviewers: kpw, eizan Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D41153 llvm-svn: 320664
* [XRay][compiler-rt] Return the pointer associated with the function instead ↵Dean Michael Berris2017-08-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | of the sled Summary: XRay has erroneously been returning the address of the first sled in the instrumentation map for a function id instead of the (runtime-relocated) functison address. This causes confusion and issues for applications where: - The first sled in the function may not be an entry sled (due to re-ordering or some other reason). - The caller attempts to find a symbol associated with the pointer at runtime, because the sled may not be exactly where the function's known address is (in case of inlined functions or those that have an external definition for symbols). This fixes http://llvm.org/PR34340. Reviewers: eizan Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D37202 llvm-svn: 311871
* [XRay][compiler-rt][NFC] Add a name for argument to __xray_set_handler_arg1(...)Dean Michael Berris2017-06-191-2/+2
| | | | | | | Just makes the interface consistent with the other functions in include/xray/xray_interface.h. llvm-svn: 305658
* [XRay][compiler-rt] Add __xray_remove_customevent_handler(...)Dean Michael Berris2017-05-221-0/+5
| | | | | | | This change adds __xray_remove_customevent_handler(...) to be consistent with other APIs that add/remove handlers. llvm-svn: 303526
* [XRay] Fix __xray_function_address on PPC reguarding local entry points.Tim Shen2017-05-171-1/+8
| | | | | | | | | | Reviewers: echristo, dberris Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D33266 llvm-svn: 303302
* [XRay][compiler-rt] Runtime changes to support custom event loggingDean Michael Berris2017-05-121-1/+20
| | | | | | | | | | | | | | | | | | | | Summary: This change implements support for the custom event logging sleds and intrinsics at runtime. For now it only supports handling the sleds in x86_64, with the implementations for other architectures stubbed out to do nothing. NOTE: Work in progress, uploaded for exposition/exploration purposes. Depends on D27503, D30018, and D33032. Reviewers: echristo, javed.absar, timshen Subscribers: mehdi_amini, nemanjai, llvm-commits Differential Revision: https://reviews.llvm.org/D30630 llvm-svn: 302857
* [XRay][compiler-rt] Add function id utilities for XRayDean Michael Berris2017-05-051-1/+13
| | | | | | | | | | | | | | | | | | | | | | | | Summary: This change allows us to provide users and implementers of XRay handlers a means of converting XRay function id's to addresses. This, in combination with the facilities provided in D32695, allows users to find out: - How many function id's there are defined in the current binary. - Get the address of the function associated with this function id. - Patch only specific functions according to their requirements. While we don't directly provide symbolization support in XRay, having the function's address lets users determine this information easily either during runtime, or offline with tools like 'addr2line'. Reviewers: dblaikie, echristo, pelikan Subscribers: kpw, llvm-commits Differential Revision: https://reviews.llvm.org/D32846 llvm-svn: 302210
* [XRay][compiler-rt] Support patching/unpatching specific functionsDean Michael Berris2017-05-041-33/+96
| | | | | | | | | | | | | | | | | | Summary: This change allows us to patch/unpatch specific functions using the function ID. This is useful in cases where implementations might want to do coverage-style, or more fine-grained control of which functions to patch or un-patch at runtime. Depends on D32693. Reviewers: dblaikie, echristo, kpw Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D32695 llvm-svn: 302112
* [XRay][compiler-rt] Use sanitizer_common's atomic opsDean Michael Berris2017-03-271-25/+34
| | | | | | | | | | | Instead of std::atomic APIs for atomic operations, we instead use APIs include with sanitizer_common. This allows us to, at runtime, not have to depend on potentially dynamically provided implementations of these atomic operations. Fixes http://llvm.org/PR32274. llvm-svn: 298833
* [XRay] [compiler-rt] Allow logging the first argument of a function call.Dean Michael Berris2017-03-061-1/+20
| | | | | | | | | | | | | | | | | | | 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
* Re-commit r295017, since we have a potential fix of the tests, r295248, landed.Tim Shen2017-02-151-0/+2
| | | | | | Differential Revision: https://reviews.llvm.org/D29742 llvm-svn: 295251
* [Compiler-rt][XRAY][MIPS] Support xray on mips/mipsel/mips64/mips64elSagar Thakur2017-02-151-0/+4
| | | | | | | | | Summary: Adds support for xray on mips/mipsel/mips64/mips64el. Reviewed by sdardis, dberris Differential: D27699 llvm-svn: 295166
* Revert r295017 "Re-commit r294826 and r294781, with a fix on the cmake file ↵Tim Shen2017-02-141-2/+0
| | | | | | to only" llvm-svn: 295097
* Re-commit r294826 and r294781, with a fix on the cmake file to onlyTim Shen2017-02-141-0/+2
| | | | | | | | | | | | | compile on powerpc64le. I cannot locally reproduce this test failure: http://lab.llvm.org:8011/builders/sanitizer-ppc64le-linux/builds/1363/steps/test%20standalone%20compiler-rt/logs/stdio Let's see how the buildbot goes. Differential Revision: https://reviews.llvm.org/D29742 llvm-svn: 295017
* This reverts commits r294826 and r294781 as they break linking on powerpc.Vitaly Buka2017-02-111-2/+0
| | | | | | | | | | Revert "Fix -Wsign-compare - this might not be quite right, but preserves behavior" Revert "[XRay] Implement powerpc64le xray." This reverts commit r294826. This reverts commit r294781. llvm-svn: 294842
* [XRay] Implement powerpc64le xray.Tim Shen2017-02-101-0/+2
| | | | | | | | | | | | | | | | | | Summary: powerpc64 big-endian is not supported, but I believe that most logic can be shared, except for xray_powerpc64.cc. Also add a function InvalidateInstructionCache to xray_util.h, which is copied from llvm/Support/Memory.cpp. I'm not sure if I need to add a unittest, and I don't know how. Reviewers: dberris, echristo, iteratee, kbarton, hfinkel Subscribers: mehdi_amini, nemanjai, mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D29742 llvm-svn: 294781
* [XRay][compiler-rt][NFC] Turn ProudCase functions to humbleCase functionsDean Michael Berris2017-02-071-6/+6
| | | | | | | | | | | | | | | Summary: As pointed out in casual reading of the XRay codebase, that we had some interesting named functions that didn't quite follow the LLVM coding conventions. Reviewers: chandlerc, dblaikie Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D29625 llvm-svn: 294373
* [XRay][AArch64] Attempt to fix unstable test ↵Serge Rogatch2016-12-051-2/+2
| | | | | | | | | | | | | | XRay-aarch64-linux::patching-unpatching.cc Summary: Currently test XRay-aarch64-linux::patching-unpatching.cc sometimes passes, sometimes fails. This is an attempt to fix it by handling better the situations when both `__arm__` and `__aarch64__` are defined. Reviewers: dberris, rengolin Subscribers: llvm-commits, iid_iunknown, aemerson, rengolin, dberris Differential Revision: https://reviews.llvm.org/D27421 llvm-svn: 288729
* [XRay][compiler-rt] Add newlines to error messages (NFC).Dean Michael Berris2016-11-231-2/+2
| | | | | | | This goes through all the calls to `Report(...)` to make sure that each one would have a newline at the end of the message for readability. llvm-svn: 287736
* [XRay] Support AArch64 in compiler-rtDean Michael Berris2016-11-211-0/+2
| | | | | | | | | | | | | | | | | | This patch adds XRay support in compiler-rt for AArch64 targets. This patch is one of a series: LLVM: https://reviews.llvm.org/D26412 Clang: https://reviews.llvm.org/D26415 Author: rSerge Reviewers: rengolin, dberris Subscribers: aemerson, mgorny, llvm-commits, iid_iunknown Differential Revision: https://reviews.llvm.org/D26413 llvm-svn: 287517
* [XRay][compiler-rt] Disable XRay instrumentation of the XRay runtime.Dean Michael Berris2016-11-161-16/+28
| | | | | | | | | | | | | | | | | | | | | Summary: Adds a CMake check for whether the compiler used to build the XRay library supports XRay-instrumentation. If the compiler we're using does support the `-fxray-instrument` flag (i.e. recently-built Clang), we define the XRAY_NEVER_INSTRUMENT macro that then makes sure that the XRay runtime functions never get XRay-instrumented. This prevents potential weirdness involved with building the XRay library with a Clang that supports XRay-instrumentation, and is attempting to XRay-instrument the build of compiler-rt. Reviewers: majnemer, rSerge, echristo Subscribers: mehdi_amini, llvm-commits, mgorny Differential Revision: https://reviews.llvm.org/D26597 llvm-svn: 287068
* [compiler-rt][XRay] Support tail call sledsDean Michael Berris2016-10-131-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This change depends on D23986 which adds tail call-specific sleds. For now we treat them first as normal exits, and in the future leave room for implementing this as a different kind of log entry. The reason for deferring the change is so that we can keep the naive logging implementation more accurate without additional complexity for reading the log. The accuracy is gained in effectively interpreting call stacks like: A() B() C() Which when tail-call merged will end up not having any exit entries for A() nor B(), but effectively in turn can be reasoned about as: A() B() C() Although we lose the fact that A() had called B() then had called C() with the naive approach, a later iteration that adds the explicit tail call entries would be a change in the log format and thus necessitate a version change for the header. We can do this later to have a chance at releasing some tools (in D21987) that are able to handle the naive log format, then support higher version numbers of the log format too. Reviewers: echristo, kcc, rSerge, majnemer Subscribers: mehdi_amini, llvm-commits, dberris Differential Revision: https://reviews.llvm.org/D23988 llvm-svn: 284178
* [compiler-rt][XRay][NFC] clang-format XRay sourcesDean Michael Berris2016-10-061-9/+10
| | | | llvm-svn: 283421
* [XRay] ARM 32-bit no-Thumb support in compiler-rtDean Michael Berris2016-09-201-111/+30
| | | | | | | | | | | | This is a port of XRay to ARM 32-bit, without Thumb support yet. This is one of 3 commits to different repositories of XRay ARM port. The other 2 are: https://reviews.llvm.org/D23931 (LLVM) https://reviews.llvm.org/D23932 (Clang test) Differential Revision: https://reviews.llvm.org/D23933 llvm-svn: 281971
* Revert "[XRay] ARM 32-bit no-Thumb support in compiler-rt"Renato Golin2016-09-081-30/+111
| | | | | | This reverts commit r280890, as the related LLVM commit broke the thumb bots. llvm-svn: 280969
* [XRay] ARM 32-bit no-Thumb support in compiler-rtDean Michael Berris2016-09-081-111/+30
| | | | | | | | | | | | | This is a port of XRay to ARM 32-bit, without Thumb support yet. This is one of 3 commits to different repositories of XRay ARM port. The other 2 are: 1. https://reviews.llvm.org/D23931 (LLVM) 2. https://reviews.llvm.org/D23932 (Clang test) Differential Revision: https://reviews.llvm.org/D23933 llvm-svn: 280890
* [compiler-rt][XRay] Implement __xray_unpatch() and __xray_remove_handler()Dean Michael Berris2016-08-081-13/+38
| | | | | | | | | | | | | | | | | | Summary: We also add one test (and the XRay testing infrastructure) to exercise the patching and unpatching code. This uses the XRay API exported through the headers as well, installing a custom log handler. Depends on D23101 for the updated emitted code alignment for the return/entry sleds. Reviewers: rSerge, echristo, rnk Subscribers: tberghammer, danalbert, srhines, mehdi_amini, llvm-commits Differential Revision: https://reviews.llvm.org/D23154 llvm-svn: 277971
* [compiler-rt][XRay] Address follow-up comments to initial interface and ↵Dean Michael Berris2016-07-291-4/+40
| | | | | | | | | | | | | | | | | | initialisation code This addresses some comments from D21612, which contains the following changes: - Update __xray_patch() and __xray_unpatch() API documentation to not imply asynchrony. - Introduce a scope cleanup mechanism to make sure we can roll-back changes to the XRayPatching global atomic. - Introduce a few more comments for potential extension points for other platforms (for the implementation details of patching and un-patching). Reviewers: eugenis, rnk, kcc, echristo, majnemer Subscribers: llvm-commits, mehdi_amini Differential Revision: https://reviews.llvm.org/D22911 llvm-svn: 277124
* Use RAII for ensuring that mprotect calls are undoneDean Michael Berris2016-07-271-8/+38
| | | | | | | | | | | | Summary: This fixes an mprotect leak identified in D21612. Reviewers: echristo, rSerge Subscribers: mehdi_amini, llvm-commits Differential Revision: https://reviews.llvm.org/D22757 llvm-svn: 276833
* [compiler-rt][XRay] re-submitting r276117, with fixes for build breakage due ↵Dean Michael Berris2016-07-211-0/+179
| | | | | | | | | | | | | | | | | | | | | | | to extraneous and missing dependencies and attempts to build on unsupported OSes Summary: This is a fixed-up version of D21612, to address failure identified post-commit. Original commit description: This patch implements the initialisation and patching routines for the XRay runtime, along with the necessary trampolines for function entry/exit handling. For now we only define the basic hooks for allowing an implementation to define a handler that gets run on function entry/exit. We expose a minimal API for controlling the behaviour of the runtime (patching, cleanup, and setting the handler to invoke when instrumenting). Fixes include: - Gating XRay build to only Linux x86_64 and with the right dependencies in case it is the only library being built - Including <cstddef> to fix std::size_t issue Reviewers: kcc, rnk, echristo Subscribers: mehdi_amini, llvm-commits Differential Revision: https://reviews.llvm.org/D22611 llvm-svn: 276251
* Revert r276117 "[XRay] Basic initialization and flag definition for XRay ↵Hans Wennborg2016-07-201-179/+0
| | | | | | | | | | | | | | | | | | | | | | | runtime" and also the follow-up "[xray] Only build xray on Linux for now" Two build errors were reported on the llvm-commits list: [ 88%] Building CXX object lib/xray/CMakeFiles/clang_rt.xray-x86_64.dir/xray_flags.cc.o /mnt/b/sanitizer-buildbot1/sanitizer-x86_64-linux/build/llvm/projects/compiler-rt/lib/xray/xray_init.cc:23:10: fatal error: 'llvm/Support/ELF.h' file not found #include "llvm/Support/ELF.h" ^ and In file included from /w/src/llvm.org/projects/compiler-rt/lib/xray/xray_interface.cc:16: /w/src/llvm.org/projects/compiler-rt/lib/xray/xray_interface_internal.h:36:8: error: no type named 'size_t' in namespace 'std' std::size_t Entries; ~~~~~^ llvm-svn: 276186
* [compiler-rt] [XRay] Basic initialization and flag definition for XRay runtimeDean Michael Berris2016-07-201-0/+179
Summary: This patch implements the initialisation and patching routines for the XRay runtime, along with the necessary trampolines for function entry/exit handling. For now we only define the basic hooks for allowing an implementation to define a handler that gets run on function entry/exit. We expose a minimal API for controlling the behaviour of the runtime (patching, cleanup, and setting the handler to invoke when instrumenting). Depends on D19904 Reviewers: echristo, kcc, rnk Subscribers: rnk, mehdi_amini, llvm-commits Differential Revision: https://reviews.llvm.org/D21612 llvm-svn: 276117
OpenPOWER on IntegriCloud