Detecting Concurrency Anomalies in Transactional Memory Programs