Skip to content

Commit 4b08be7

Browse files
committed
Revert "[Profile] Remove duplicate file locks when enabled continuous mode and online merging."
This reverts commit 985486d. This seems to cause malformed profdata: crbug.com/1469456
1 parent b63ac56 commit 4b08be7

File tree

3 files changed

+9
-159
lines changed

3 files changed

+9
-159
lines changed

compiler-rt/lib/profile/InstrProfilingFile.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -424,10 +424,13 @@ static void createProfileDir(const char *Filename) {
424424
* its instrumented shared libraries dump profile data into their own data file.
425425
*/
426426
static FILE *openFileForMerging(const char *ProfileFileName, int *MergeDone) {
427-
FILE *ProfileFile = getProfileFile();
427+
FILE *ProfileFile = NULL;
428428
int rc;
429429

430-
if (!ProfileFile) {
430+
ProfileFile = getProfileFile();
431+
if (ProfileFile) {
432+
lprofLockFileHandle(ProfileFile);
433+
} else {
431434
createProfileDir(ProfileFileName);
432435
ProfileFile = lprofOpenFileEx(ProfileFileName);
433436
}
@@ -478,6 +481,9 @@ static int writeFile(const char *OutputName) {
478481

479482
if (OutputFile == getProfileFile()) {
480483
fflush(OutputFile);
484+
if (doMerging()) {
485+
lprofUnlockFileHandle(OutputFile);
486+
}
481487
} else {
482488
fclose(OutputFile);
483489
}

compiler-rt/test/profile/ContinuousSyncMode/online-merging-windows.c

Lines changed: 0 additions & 156 deletions
This file was deleted.

compiler-rt/test/profile/ContinuousSyncMode/runtime-counter-relocation.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// REQUIRES: linux || windows
1+
// REQUIRES: linux
22

33
// RUN: %clang -fprofile-instr-generate -fcoverage-mapping -mllvm -runtime-counter-relocation=true -o %t.exe %s
44
// RUN: echo "garbage" > %t.profraw

0 commit comments

Comments
 (0)