Index: compiler-rt/trunk/lib/xray/xray_fdr_logging.cc =================================================================== --- compiler-rt/trunk/lib/xray/xray_fdr_logging.cc +++ compiler-rt/trunk/lib/xray/xray_fdr_logging.cc @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -200,8 +201,8 @@ auto &NewBuffer = *reinterpret_cast(&Records[0]); NewBuffer.Type = RecordType::Metadata; NewBuffer.RecordKind = MetadataRecord::RecordKinds::NewBuffer; - pid_t Pid = getpid(); - std::memcpy(&NewBuffer.Data, &Pid, sizeof(pid_t)); + pid_t Tid = syscall(SYS_gettid); + std::memcpy(&NewBuffer.Data, &Tid, sizeof(pid_t)); } // Also write the WalltimeMarker record.