From: José Fonseca Date: Mon, 13 May 2013 15:44:35 +0000 (+0100) Subject: Merge branch 'backtrace' X-Git-Url: https://git.cworth.org/git?a=commitdiff_plain;h=1c803f585d1722fa0809c18c023ba8cf29106f88;p=apitrace Merge branch 'backtrace' Conflicts: common/trace_writer_local.cpp --- 1c803f585d1722fa0809c18c023ba8cf29106f88 diff --cc common/trace_writer_local.cpp index d2ff3b5,6cea2fa..c5a5c44 --- a/common/trace_writer_local.cpp +++ b/common/trace_writer_local.cpp @@@ -138,21 -134,7 +139,21 @@@ static uintptr_t next_thread_num = 1 static OS_THREAD_SPECIFIC_PTR(void) thread_num; +void LocalWriter::checkProcessId(void) { + if (m_file->isOpened() && + os::getCurrentProcessId() != pid) { + // We are a forked child process that inherited the trace file, so + // create a new file. We can't call any method of the current + // file, as it may cause it to flush and corrupt the parent's + // trace, so we effectively leak the old file object. + m_file = File::createSnappy(); + // Don't want to open the same file again + os::unsetEnvironment("TRACE_FILE"); + open(); + } +} + - unsigned LocalWriter::beginEnter(const FunctionSig *sig) { + unsigned LocalWriter::beginEnter(const FunctionSig *sig, bool fake) { mutex.lock(); ++acquired;