Constraint Solving For Diagnosing Concurrency Bugs