[PATCH] make pthread checker track pthread_mutex_unlock, pthread_mutex_destroy and pthread_mutex_init

Jordan Rose jordan_rose at apple.com
Mon Mar 31 20:48:22 PDT 2014


All of these look good. Committed (with minor formatting changes) in r205274-6!

If you're interested in further improving the lock checker, adding path notes using a BugReporterVisitor, like MallocChecker does, would go a long way. Bonus points if you factor out the common infrastructure between the two.

Jordan


On Mar 30, 2014, at 22:57 , Daniel Fahlgren <daniel at fahlgren.se> wrote:

> Hi,
> 
> Here are three patches for the pthread lock checker. The first detects
> if a lock is unlocked twice. The second patch will make the checker warn
> if a lock is destroyed twice or destroyed while being locked. The third
> patch will warn if we initialize an already initialized mutex.
> 
> The first patch will use a set to track if a lock is already unlocked.
> The set is changed in patch two to a map to have better knowledge about
> the state of the lock.
> 
> The third patch does not track lck_mtx_init. The reason for that is that
> I haven't found a good description on if is allowed to reinit a
> destroyed lock, what happens if you call lck_mtx_init twice etc.
> 
> Any comments?
> 
> Cheers,
> Daniel
> <0001-Add-support-to-detect-double-unlock.patch><0002-Warn-if-a-destroyed-lock-is-used.patch><0003-Track-pthread_mutex_init.patch>




More information about the cfe-commits mailing list