Bug 1693862 [wpt PR 27525] - [Credentialless] WPT fetch, a=testonly
[gecko.git] / mfbt / TsanOptions.h
blob36bd692468da990887a55648be686888ea3253dc
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 /* Default options for ThreadSanitizer. */
9 #ifndef mozilla_TsanOptions_h
10 #define mozilla_TsanOptions_h
12 #include "mozilla/Compiler.h"
14 #ifndef _MSC_VER // Not supported by clang-cl yet
17 // When running with ThreadSanitizer, we need to explicitly set some
18 // options specific to our codebase to prevent errors during runtime.
19 // To override these, set the TSAN_OPTIONS environment variable.
21 // Currently, these are:
23 // abort_on_error=1 - Causes TSan to abort instead of using exit().
24 // halt_on_error=1 - Causes TSan to stop on the first race detected.
26 // report_signal_unsafe=0 - Required to avoid TSan deadlocks when
27 // receiving external signals (e.g. SIGINT manually on console).
29 // allocator_may_return_null=1 - Tell TSan to return NULL when an allocation
30 // fails instead of aborting the program. This allows us to handle failing
31 // allocations the same way we would handle them with a regular allocator and
32 // also uncovers potential bugs that might occur in these situations.
34 extern "C" const char* __tsan_default_options() {
35 return "halt_on_error=1:abort_on_error=1:report_signal_unsafe=0"
36 ":allocator_may_return_null=1";
39 // These are default suppressions for external libraries that probably
40 // every application would want to include if it potentially loads external
41 // libraries like GTK/X and hence their dependencies.
42 # define MOZ_TSAN_DEFAULT_EXTLIB_SUPPRESSIONS \
43 "called_from_lib:libatk-1\n" \
44 "called_from_lib:libcairo.so\n" \
45 "called_from_lib:libcairo-gobject\n" \
46 "called_from_lib:libdconfsettings\n" \
47 "called_from_lib:libgdk-3\n" \
48 "called_from_lib:libgdk_pixbuf\n" \
49 "called_from_lib:libgdk-x11\n" \
50 "called_from_lib:libgio-2\n" \
51 "called_from_lib:libglib-1\n" \
52 "called_from_lib:libglib-2\n" \
53 "called_from_lib:libgobject\n" \
54 "called_from_lib:libgtk-3\n" \
55 "called_from_lib:libgtk-x11\n" \
56 "called_from_lib:libgvfscommon\n" \
57 "called_from_lib:libgvfsdbus\n" \
58 "called_from_lib:libibus-1\n" \
59 "called_from_lib:libogg.so\n" \
60 "called_from_lib:libpangocairo\n" \
61 "called_from_lib:libpangoft2\n" \
62 "called_from_lib:pango-basic-fc\n" \
63 "called_from_lib:libpixman-1\n" \
64 "called_from_lib:libpulse.so\n" \
65 "called_from_lib:libpulsecommon\n" \
66 "called_from_lib:libsecret-1\n" \
67 "called_from_lib:libunity-gtk3-parser\n" \
68 "called_from_lib:libvorbis.so\n" \
69 "called_from_lib:libvorbisfile\n" \
70 "called_from_lib:libX11.so\n" \
71 "called_from_lib:libX11-xcb\n" \
72 "called_from_lib:libXau\n" \
73 "called_from_lib:libxcb.so\n" \
74 "called_from_lib:libXcomposite\n" \
75 "called_from_lib:libXcursor\n" \
76 "called_from_lib:libXdamage\n" \
77 "called_from_lib:libXdmcp\n" \
78 "called_from_lib:libXext\n" \
79 "called_from_lib:libXfixes\n" \
80 "called_from_lib:libXi.so\n" \
81 "called_from_lib:libXrandr\n" \
82 "called_from_lib:libXrender\n" \
83 "called_from_lib:libXss\n"
85 #endif // _MSC_VER
87 #endif /* mozilla_TsanOptions_h */