This extends XRay to support Fuchsia.
Details
Diff Detail
- Repository
- rCRT Compiler Runtime
Event Timeline
LGTM -- while I think there might be an opportunity for further cleaning up and isolating the platform-specific bits into different files/directories, in the meantime I suspect adding these preprocessor directives is sufficient.
compiler-rt/lib/xray/xray_allocator.h | ||
---|---|---|
54 | Need _zx_handle_close(Vmo); here (before the error check but after the use). | |
96 | Be consistent: either "VMO" or "VM object" in all messages. | |
104 | Need _zx_handle_close(Vmo); here (before the error check but after the use). | |
106 | s/%d/%zu/ | |
131 | It wouldn't hurt to just define internal_munmap this way for Fuchsia if it reduces the #if load. | |
compiler-rt/lib/xray/xray_buffer_queue.cc | ||
19 | These are unused in this file. Just use #if !SANITIZER_FUCHSIA around the #include "sanitizer_common/sanitizer_posix.h" | |
compiler-rt/lib/xray/xray_init.cc | ||
20 ↗ | (On Diff #165709) | unused |
compiler-rt/lib/xray/xray_interface.cc | ||
291 | Just make MProtectHelper do this itself. | |
compiler-rt/lib/xray/xray_profile_collector.cc | ||
21 ↗ | (On Diff #165709) | unused |
compiler-rt/lib/xray/xray_utils.cc | ||
43 | I'd use inline constexpr const char* ProfileSinkName = "llvm-xray";. | |
59 | You can save the syscall when Offset % PAGE_SIZE == (Offset + TotalBytes) % PAGE_SIZE. | |
75 | Comment: // Nothing to do here since WriteAll writes directly into the VMO. | |
78 | Since this is just for the PID, I'd move it down next to where that's used and change the comment to say "Get the KOID of the current process to use in the VMO name." | |
84 | I think it's more useful if this message says zx_object_get_info(_zx_process_self(), ZX_INFO_HANDLE_BASIC) failed: %s. | |
103 | ... and LogWriter needs to hold onto it. | |
107 | s/VMO/& handle/ | |
111 | // Publish the VMO that receives the logging. Note the VMO's contents can grow and change after publication. The contents won't be read out until after the process exits. | |
115 | Put "{{{dumpfile:%s:%s}}}" into a macro in sanitizer_symbolizer_fuchsia.h and make sanitizer_coverage_fuchsia.cc and this both use it. | |
126 | Comment after #else and #endif below. | |
compiler-rt/lib/xray/xray_x86_64.cc | ||
112 | This shouldn't be here. On Fuchsia, all of this logic to read the TSC and so forth should not be used. |
compiler-rt/lib/xray/xray_utils.cc | ||
---|---|---|
43 | compiler-rt uses C++11 but inline constexpr is a C++17 construct. |
compiler-rt/lib/xray/xray_allocator.h | ||
---|---|---|
56 | This needs to be outside (before) the if. | |
106 | ditto | |
compiler-rt/lib/xray/xray_utils.cc | ||
41–42 | dead | |
43 | Since this is not inside a class, I don't think inline actually makes a difference. The advice to use a string literal rather than a const array stands. | |
45 | This function is actually dead. Just remove it. | |
compiler-rt/lib/xray/xray_x86_64.cc | ||
113 | Drop the cast. zx_ticks_t is just uint64_t and if it changed so this conversion did something, we'd want the warnings about it. |
Need _zx_handle_close(Vmo); here (before the error check but after the use).