MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / InitializeFlags

Function InitializeFlags

system/lib/compiler-rt/lib/lsan/lsan.cpp:56–104  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

54using namespace __lsan;
55
56static void InitializeFlags() {
57 // Set all the default values.
58 SetCommonFlagsDefaults();
59 {
60 CommonFlags cf;
61 cf.CopyFrom(*common_flags());
62#if !SANITIZER_EMSCRIPTEN
63 // getenv on emscripten uses malloc, which we can't when using LSan.
64 // You can't run external symbolizers anyway.
65 cf.external_symbolizer_path = GetEnv("LSAN_SYMBOLIZER_PATH");
66#endif
67 cf.malloc_context_size = 30;
68 cf.intercept_tls_get_addr = true;
69 cf.detect_leaks = true;
70 cf.exitcode = 23;
71 OverrideCommonFlags(cf);
72 }
73
74 Flags *f = flags();
75 f->SetDefaults();
76
77 FlagParser parser;
78 RegisterLsanFlags(&parser, f);
79 RegisterCommonFlags(&parser);
80
81 // Override from user-specified string.
82 const char *lsan_default_options = __lsan_default_options();
83 parser.ParseString(lsan_default_options);
84#if SANITIZER_EMSCRIPTEN
85 char *options = _emscripten_sanitizer_get_option("LSAN_OPTIONS");
86 parser.ParseString(options);
87 free(options);
88#else
89 parser.ParseString(GetEnv("LSAN_OPTIONS"));
90#endif // SANITIZER_EMSCRIPTEN
91
92#if SANITIZER_EMSCRIPTEN
93 if (common_flags()->malloc_context_size <= 1)
94 StackTrace::snapshot_stack = false;
95#endif // SANITIZER_EMSCRIPTEN
96
97 InitializeCommonFlags();
98
99 if (Verbosity()) ReportUnrecognizedFlags();
100
101 if (common_flags()->help) parser.PrintFlagDescriptions();
102
103 __sanitizer_set_report_path(common_flags()->log_path);
104}
105
106extern "C" void __lsan_init() {
107 CHECK(!lsan_init_is_running);

Callers 1

__lsan_initFunction · 0.70

Calls 15

SetCommonFlagsDefaultsFunction · 0.85
common_flagsFunction · 0.85
OverrideCommonFlagsFunction · 0.85
RegisterLsanFlagsFunction · 0.85
RegisterCommonFlagsFunction · 0.85
__lsan_default_optionsFunction · 0.85
InitializeCommonFlagsFunction · 0.85
VerbosityFunction · 0.85
ReportUnrecognizedFlagsFunction · 0.85
CopyFromMethod · 0.80
ParseStringMethod · 0.80

Tested by

no test coverage detected