* gfortran.dg/ieee/rounding_1.f90: Rename from ieee_rounding_1.f90.
[official-gcc.git] / libsanitizer / lsan / lsan.cc
blobc1481f5fb9712f9182969bcf4ac026a1e7f4cacb
1 //=-- lsan.cc -------------------------------------------------------------===//
2 //
3 // This file is distributed under the University of Illinois Open Source
4 // License. See LICENSE.TXT for details.
5 //
6 //===----------------------------------------------------------------------===//
7 //
8 // This file is a part of LeakSanitizer.
9 // Standalone LSan RTL.
11 //===----------------------------------------------------------------------===//
13 #include "lsan.h"
15 #include "sanitizer_common/sanitizer_flags.h"
16 #include "sanitizer_common/sanitizer_stacktrace.h"
17 #include "lsan_allocator.h"
18 #include "lsan_common.h"
19 #include "lsan_thread.h"
21 bool lsan_inited;
22 bool lsan_init_is_running;
24 namespace __lsan {
26 static void InitializeCommonFlags() {
27 CommonFlags *cf = common_flags();
28 SetCommonFlagsDefaults(cf);
29 cf->external_symbolizer_path = GetEnv("LSAN_SYMBOLIZER_PATH");
30 cf->malloc_context_size = 30;
31 cf->detect_leaks = true;
33 ParseCommonFlagsFromString(cf, GetEnv("LSAN_OPTIONS"));
36 ///// Interface to the common LSan module. /////
37 bool WordIsPoisoned(uptr addr) {
38 return false;
41 } // namespace __lsan
43 using namespace __lsan; // NOLINT
45 extern "C" void __lsan_init() {
46 CHECK(!lsan_init_is_running);
47 if (lsan_inited)
48 return;
49 lsan_init_is_running = true;
50 SanitizerToolName = "LeakSanitizer";
51 InitializeCommonFlags();
52 InitializeAllocator();
53 InitTlsSize();
54 InitializeInterceptors();
55 InitializeThreadRegistry();
56 u32 tid = ThreadCreate(0, 0, true);
57 CHECK_EQ(tid, 0);
58 ThreadStart(tid, GetTid());
59 SetCurrentThread(tid);
61 Symbolizer::Init(common_flags()->external_symbolizer_path);
63 InitCommonLsan();
64 if (common_flags()->detect_leaks && common_flags()->leak_check_at_exit)
65 Atexit(DoLeakCheck);
66 lsan_inited = true;
67 lsan_init_is_running = false;