blob: 142f187c19edd6f32f161dc4ed0da676702e0620 [file] [log] [blame]
Sergey Matveev3bc65b12013-05-21 12:49:33 +00001//===-- 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:
15clang++ ../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
18LD_PRELOAD=./lsan.so /your/app
19*/
20#include "lsan_common.h"
21#include "lsan.h"
22
23__attribute__((constructor))
24void constructor() {
25 __lsan::Init();
26}
27
28__attribute__((destructor))
29void destructor() {
30 __lsan::DoLeakCheck();
31}