I'm using GCC 9.2 TSan to analyze my codebase's runtime multithreading behavior (using pthreads explicitly -- we started before C++11). I have a data race while a destroyed mutex is held, with the following (relatively unhelpful):
Mutex M974039071667323520 is already destroyed.
And no further information on where this mutex was created or where it was destroyed. TSan reports stack traces of the accessed heap location, where that heap memory was allocated and of the threads' creation, but no stack trace of where the mutexes were destroyed.
I'd like to add some debug output to places where I have possible candidates for these mutexes, but it wouldn't help me if I cannot correlate the debug statement mutex to the reported mutex in any way -- thus the question:
Is there a way to use ThreadSanitizer-reported mutex name M974039071667323520
in my own code?
From what I gathered in about 10min of grepping through gcc's libsanitizers/tsan/
codebase, it seems like an internal counter uid_gen_
is atomically incremented for each SyncVar
which would imply that it's a tsan's private value and there's no way to get that value in my code, is this correct?