1

For some reason I can't use Helgrind to detect misuses of the POSIX pthreads API (for example, unlocking a non-locked mutex, deallocation of memory that contains a locked mutex and so on). I tried to find another tool but actually failed. As I found out, Dr. Memory can't be used for detection thread errors, and Thread Sanitizer is able to detect only data races. Is it really so? Could you please recommend me some other tools for that?

WildWind03
  • 301
  • 3
  • 14
  • If it is about locking mutexes, you can try to make a decorator around your mutex. Where in its destructor, you can check its state, when it is locked, try to print a message. Race conditions is the hardest to find, so Helgrind and ThreadSanitizers are useful. – user9335240 Feb 17 '18 at 06:45
  • Why can't you use Helgrind? – Johan Walles Nov 19 '20 at 14:33

1 Answers1

0

Thread Sanitizer does detect the things you mentioned (unlocks of an unlocked mutex, destruction of a locked mutex), and several more bugs like thread leaks.

kuba
  • 7,329
  • 1
  • 36
  • 41