Index: base/debug/sanitizer_options.cc |
diff --git a/base/debug/sanitizer_options.cc b/base/debug/sanitizer_options.cc |
index 41f82b9840b59f118b575b82742e10cd446406ef..10024721574b5240ac7bef249c530d976a0fd902 100644 |
--- a/base/debug/sanitizer_options.cc |
+++ b/base/debug/sanitizer_options.cc |
@@ -70,3 +70,21 @@ const char *__asan_default_options() { |
} |
#endif // OS_LINUX || OS_MACOSX |
#endif // ADDRESS_SANITIZER |
+ |
+#if defined(THREAD_SANITIZER) && defined(OS_LINUX) |
+// Default options for ThreadSanitizer in various configurations: |
+// detect_deadlocks=1 - enable deadlock (lock inversion) detection. |
+// second_deadlock_stack=1 - more verbose deadlock reports. |
+const char kTsanDefaultOptions[] = "detect_deadlocks=1 second_deadlock_stack=1"; |
+ |
+extern "C" |
+__attribute__((no_sanitize_thread)) |
+__attribute__((visibility("default"))) |
+// The function isn't referenced from the executable itself. Make sure it isn't |
+// stripped by the linker. |
+__attribute__((used)) |
+const char *__tsan_default_options() { |
+ return kTsanDefaultOptions; |
+} |
+ |
+#endif // THREAD_SANITIZER && OS_LINUX |