summaryrefslogtreecommitdiff
path: root/lib/xray/xray_basic_logging.cc
Commit message (Collapse)AuthorAgeFilesLines
* [xray] Disable alignas() for thread_local objects on NetBSDMichal Gorny2018-12-231-1/+1
| | | | | | | | | | | | | | | | Disable enforcing alignas() for structs that are used as thread_local data on NetBSD. The NetBSD ld.so implementation is buggy and does not enforce correct alignment; however, clang seems to take it for granted and generates instructions that segv on wrongly aligned objects. Therefore, disable those alignas() statements on NetBSD until we can establish a better fix. Apparently, std::aligned_storage<> does not have any real effect at the moment, so we can leave it as-is. Differential Revision: https://reviews.llvm.org/D56000 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@350029 91177308-0d34-0410-b5e6-96231b3b80d8
* [XRay] Support for FuchsiaPetr Hosek2018-11-221-0/+2
| | | | | | | | This extends XRay to support Fuchsia. Differential Revision: https://reviews.llvm.org/D52162 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@347443 91177308-0d34-0410-b5e6-96231b3b80d8
* [XRay] Use fully qualified name for LogWriterPetr Hosek2018-10-161-1/+1
| | | | | | This avoids the build error in newer versions of GCC. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@344579 91177308-0d34-0410-b5e6-96231b3b80d8
* [XRay] Encapsulate all FD log related logic into a classPetr Hosek2018-10-161-33/+33
| | | | | | | | | | This abstracts away the file descriptor related logic which makes it easier to port XRay to platform that don't use file descriptors or file system for writing the log data, such as Fuchsia. Differential Revision: https://reviews.llvm.org/D52161 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@344578 91177308-0d34-0410-b5e6-96231b3b80d8
* [XRay] Guard local variables with `static` and struct with unnamed namespacesFangrui Song2018-09-281-5/+7
| | | | | | | | | | | | | | | | | Summary: This is for coding standard conformance, and for fixing an ODR violation issue: __xray::ThreadLocalData is defined twice and differently in xray_fdr_logging.cc and xray_basic_logging.cc Reviewers: dberris, mboerger, eizan Reviewed By: dberris Subscribers: delcypher, jfb, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D52639 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@343289 91177308-0d34-0410-b5e6-96231b3b80d8
* [XRay] Remove the deprecated __xray_log_init APIPetr Hosek2018-09-151-38/+33
| | | | | | | | | This API has been deprecated three months ago and shouldn't be used anymore, all clients should migrate to the new string based API. Differential Revision: https://reviews.llvm.org/D51606 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@342318 91177308-0d34-0410-b5e6-96231b3b80d8
* Test commitHenry Zhu2018-07-161-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@337176 91177308-0d34-0410-b5e6-96231b3b80d8
* [XRay][compiler-rt] Add PID field to llvm-xray tool and add PID metadata ↵Dean Michael Berris2018-07-131-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | record entry in FDR mode Summary: llvm-xray changes: - account-mode - process-id {...} shows after thread-id - convert-mode - process {...} shows after thread - parses FDR and basic mode pid entries - Checks version number for FDR log parsing. Basic logging changes: - Update header version from 2 -> 3 FDR logging changes: - Update header version from 2 -> 3 - in writeBufferPreamble, there is an additional PID Metadata record (after thread id record and tsc record) Test cases changes: - fdr-mode.cc, fdr-single-thread.cc, fdr-thread-order.cc modified to catch process id output in the log. Reviewers: dberris Reviewed By: dberris Subscribers: hiraditya, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D49153 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@336974 91177308-0d34-0410-b5e6-96231b3b80d8
* [XRay] basic mode PID and TID always fetchDean Michael Berris2018-07-111-6/+6
| | | | | | | | | | | | | | Summary: XRayRecords now includes a PID field. Basic handlers fetch pid and tid each time they are called instead of caching the value. Added a testcase that calls fork and checks if the child TID is different from the parent TID to verify that the processes' TID are different in the trace. Reviewers: dberris, Maknee Reviewed By: dberris, Maknee Subscribers: kpw, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D49025 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@336769 91177308-0d34-0410-b5e6-96231b3b80d8
* [XRay][compiler-rt] Remove reliance on C++ ABI featuresDean Michael Berris2018-06-081-49/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This fixes http://llvm.org/PR32274. This change adds a test to ensure that we're able to link XRay modes and the runtime to binaries that don't need to depend on the C++ standard library or a C++ ABI library. In particular, we ensure that this will work with C programs compiled+linked with XRay. To make the test pass, we need to change a few things in the XRay runtime implementations to remove the reliance on C++ ABI features. In particular, we change the thread-safe function-local-static initialisation to use pthread_* instead of the C++ features that ensure non-trivial thread-local/function-local-static initialisation. Depends on D47696. Reviewers: dblaikie, jfb, kpw, eizan Reviewed By: kpw Subscribers: echristo, eizan, kpw, mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D46998 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@334262 91177308-0d34-0410-b5e6-96231b3b80d8
* [XRay][compiler-rt] Refactor recursion guard for Basic and FDR ModeDean Michael Berris2018-06-061-7/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This change extracts the recursion guard implementation from FDR Mode and updates it to do the following: - Do the atomic operation correctly to be signal-handler safe. - Make it usable in both FDR and Basic Modes. Before this change, the recursion guard relied on an unsynchronised read and write on a volatile thread-local. A signal handler could then run in between the read and the write, and then be able to run instrumented code as part of the signal handling. Using an atomic exchange instead fixes that by doing a proper mutual exclusion even in the presence of signal handling. Reviewers: kpw, eizan, jfb Reviewed By: eizan Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D47696 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@334064 91177308-0d34-0410-b5e6-96231b3b80d8
* [XRay][compiler-rt] Remove __xray:: in some places (NFC)Dean Michael Berris2018-06-051-11/+11
| | | | | | | This is a cosmetic change to remove unnecessary full-qualifications of types/functions that are already in the __xray:: namespace. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@334000 91177308-0d34-0410-b5e6-96231b3b80d8
* [XRay][compiler-rt] Remove __sanitizer:: from namespace __xray (NFC)Dean Michael Berris2018-06-051-27/+27
| | | | | | | This is a non-functional change that removes the full qualification of functions in __sanitizer:: being used in __xray. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@333983 91177308-0d34-0410-b5e6-96231b3b80d8
* [XRay][compiler-rt] Support string-based config for Basic mode.Dean Michael Berris2018-05-041-0/+505
Summary: This addresses http://llvm.org/PR36790. This change allows the XRay Basic Mode implementation to use the string-based initialization routine provided through `__xray_log_init_mode(...)`. In the process, we've also deprecated some flags defined for the `XRAY_OPTIONS` environment variable. We then introduce another environment variable that can control the XRay Basic Mode implementation through `XRAY_BASIC_OPTIONS`. We also rename files from `xray_inmemory_log` to `xray_basic_logging` to be more in line with the mode implementation. Depends on D46174. Reviewers: echristo, kpw, pelikan, eizan Reviewed By: kpw Subscribers: mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D46246 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@331507 91177308-0d34-0410-b5e6-96231b3b80d8