Say I have a multithreaded application and I run it with the same inputs. Is it enough to instrument every load and stores to detect write-write and write-read data races? I mean from the logged load and store addresses, if we can see which thread did which load and which thread did which store, we can detect write-read and write-write data race by noticing the overlapped addresses. Or am I missing something?
Share
You are missing a lot. As Pubby said, if you see read, then write in T1, and later read, then write in T2, you can’t say anything about absence of races. You need to know about locks involved.
You may want to use a tool, such as Google’s ThreadSanitizer instead.
Update:
Your comments here and on other answers appear to show that you don’t understand what a race is.
Your approach may expose some of the races, yes. It is guaranteed to not cover most of them (which will make the exercise futile).