make tsan errors more useful

Change-Id: I7dc400f7b456fb74941e9e0b3b0bae44fbdfced2
diff --git a/aos/build/build.py b/aos/build/build.py
index 5a3c544..725de33 100755
--- a/aos/build/build.py
+++ b/aos/build/build.py
@@ -455,6 +455,11 @@
         r['MSAN_SYMBOLIZER_PATH'] = SYMBOLIZER_PATH
       elif self.sanitizer() == 'thread':
         r['TSAN_OPTIONS'] = 'external_symbolizer_path=' + SYMBOLIZER_PATH
+        # This is apparently the default for newer versions, which disagrees
+        # with documentation, so just turn it on explicitly.
+        r['TSAN_OPTIONS'] += ':detect_deadlocks=1'
+        # Print more useful stacks for mutex locking order problems.
+        r['TSAN_OPTIONS'] += ':second_deadlock_stack=1'
 
       r['CCACHE_COMPRESS'] = 'yes'
       r['CCACHE_DIR'] = os.path.abspath(os.path.join(aos_path(), '..', 'output',