ThreadSanitizer is a tool that detects data races. It consists of a compiler instrumentation module and a run-time library. Typical slowdown introduced by ThreadSanitizer is about 5x-15x. Typical memory overhead introduced by ThreadSanitizer is about 5x-10x.
UBSan is integrated with gcc and clang and can be enabled via a meson option: -Db_sanitize=thread. Signed-off-by: Dengdui Huang <huangdeng...@huawei.com> --- config/meson.build | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/config/meson.build b/config/meson.build index f31fef216c..dca1e2b5a4 100644 --- a/config/meson.build +++ b/config/meson.build @@ -519,6 +519,20 @@ if get_option('b_sanitize') == 'address' or get_option('b_sanitize') == 'address endif endif +if get_option('b_sanitize') == 'thread' + if is_windows + error('TSan is not supported on windows') + endif + + if cc.get_id() == 'gcc' + tsan_dep = cc.find_library('tsan', required: true) + if (not cc.links('int main(int argc, char *argv[]) { return 0; }', + dependencies: tsan_dep)) + error('broken dependency, "libtsan"') + endif + endif +endif + if get_option('default_library') == 'both' error( ''' Unsupported value "both" for "default_library" option. -- 2.33.0