diff options
Diffstat (limited to 'compiler-rt/lib/sanitizer_common/sanitizer_posix.cc')
| -rw-r--r-- | compiler-rt/lib/sanitizer_common/sanitizer_posix.cc | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_posix.cc b/compiler-rt/lib/sanitizer_common/sanitizer_posix.cc index 5438aca9468..4d2c033c5ab 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_posix.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_posix.cc @@ -198,10 +198,15 @@ char *FindPathToBinary(const char *name) { } void MaybeOpenReportFile() { - if (!log_to_file || (report_fd_pid == internal_getpid())) return; + if (!log_to_file) return; + uptr pid = internal_getpid(); + // If in tracer, use the parent's file. + if (pid == stoptheworld_tracer_pid) + pid = stoptheworld_tracer_ppid; + if (report_fd_pid == pid) return; InternalScopedBuffer<char> report_path_full(4096); internal_snprintf(report_path_full.data(), report_path_full.size(), - "%s.%d", report_path_prefix, internal_getpid()); + "%s.%d", report_path_prefix, pid); uptr openrv = OpenFile(report_path_full.data(), true); if (internal_iserror(openrv)) { report_fd = kStderrFd; @@ -214,7 +219,7 @@ void MaybeOpenReportFile() { internal_close(report_fd); } report_fd = openrv; - report_fd_pid = internal_getpid(); + report_fd_pid = pid; } void RawWrite(const char *buffer) { |

