1 //===-- lsan_testlib.cc ---------------------------------------------------===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 // 10 // This file is a part of LeakSanitizer. 11 // Standalone LSan tool as a shared library, to be used with LD_PRELOAD. 12 // 13 //===----------------------------------------------------------------------===// 14 /* Usage: 15 clang++ ../sanitizer_common/sanitizer_*.cc ../interception/interception_*.cc \ 16 lsan*.cc tests/lsan_testlib.cc -I. -I.. -g -ldl -lpthread -fPIC -shared -O2 \ 17 -o lsan.so 18 LD_PRELOAD=./lsan.so /your/app 19 */ 20 #include "lsan.h" 21 22 __attribute__((constructor)) 23 void constructor() { 24 __lsan::Init(); 25 } 26