diff options
-rw-r--r-- | BUILD.gn | 1 | ||||
-rw-r--r-- | gyp/bench.gyp | 1 | ||||
-rw-r--r-- | gyp/dm.gypi | 3 | ||||
-rw-r--r-- | tools/LsanSuppressions.cpp | 28 | ||||
-rw-r--r-- | tools/lsan.supp | 11 |
5 files changed, 32 insertions, 12 deletions
@@ -653,6 +653,7 @@ if (skia_enable_tools) { "src/images/SkForceLinking.cpp", "src/utils/SkMultiPictureDocumentReader.cpp", # TODO(halcanary): move to tools? "tools/CrashHandler.cpp", + "tools/LsanSuppressions.cpp", "tools/ProcStats.cpp", "tools/Resources.cpp", "tools/ThermalManager.cpp", diff --git a/gyp/bench.gyp b/gyp/bench.gyp index 551af143bf..3d5c329ef5 100644 --- a/gyp/bench.gyp +++ b/gyp/bench.gyp @@ -14,6 +14,7 @@ 'type': 'executable', 'sources': [ '../gm/gm.cpp', + '../tools/LsanSuppressions.cpp', ], 'includes': [ 'bench.gypi', diff --git a/gyp/dm.gypi b/gyp/dm.gypi index fab2f917ff..bc19ee4ddb 100644 --- a/gyp/dm.gypi +++ b/gyp/dm.gypi @@ -46,12 +46,13 @@ '../gm/gm.cpp', '../src/utils/SkMultiPictureDocumentReader.cpp', + '../tools/LsanSuppressions.cpp', '../tools/debugger/SkDebugCanvas.cpp', '../tools/debugger/SkDrawCommand.cpp', '../tools/debugger/SkJsonWriteBuffer.cpp', '../tools/debugger/SkObjectParser.cpp', - '../tools/debugger/SkOverdrawMode.h', '../tools/debugger/SkOverdrawMode.cpp', + '../tools/debugger/SkOverdrawMode.h', ], 'conditions': [ [ 'skia_gpu == 1', { diff --git a/tools/LsanSuppressions.cpp b/tools/LsanSuppressions.cpp new file mode 100644 index 0000000000..c81184f3b0 --- /dev/null +++ b/tools/LsanSuppressions.cpp @@ -0,0 +1,28 @@ +/* + * Copyright 2016 Google Inc. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#include "SkTypes.h" + +#if !defined(__has_feature) + #define __has_feature(x) 0 +#endif + +#if __has_feature(address_sanitizer) + +extern "C" { + + const char* __lsan_default_suppressions(); + const char* __lsan_default_suppressions() { + return "leak:libfontconfig\n" // FontConfig looks like it leaks, but it doesn't. + "leak:libGL.so\n" // For NVidia driver. + "leak:__strdup\n" // An eternal mystery, skia:2916. + ; + } + +} + +#endif diff --git a/tools/lsan.supp b/tools/lsan.supp index 8d46f5bd0e..b993fa508f 100644 --- a/tools/lsan.supp +++ b/tools/lsan.supp @@ -1,12 +1 @@ # Supressions for LSAN. -# tools/xsan_build address -C out/Debug -# ASAN_OPTIONS=detect_leaks=1 LSAN_OPTIONS=suppressions=tools/lsan.supp out/Debug/$FOO - -# Fontconfig -leak:libfontconfig - -# Nvidia driver -leak:libGL.so - -# Not clear what this is. skia:2916 -leak:__strdup |