When a program is forked with code coverage enabled, all the counters are flushed.
To avoid data race, a critical section has been added around __gcov_flush (https://reviews.llvm.org/D70910) but when forking the mutex is just duplicated and if it was in a locked state (in the parent process) then it's locked in the child process which leads to a deadlock when the child is trying to flush counters.
This patch aims to initialize the mutex in the child process when forking.
So a custom fork (__gcov_fork) is called from instrumented code and the mutex is then initialized in the child process.
Details
Details
- Reviewers
marco-c
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
- Build Status
Buildable 45784 Build 47854: arc lint + arc unit