Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(853)

Unified Diff: base/debug/sanitizer_options.cc

Issue 272763005: Add default options for ThreadSanitizer on Linux. Enable deadlock detection by default. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698