tsan: fix flags parsing
[blocksruntime.git] / lib / sanitizer_common / sanitizer_flags.h
blobffc69fe18e4b30c4dde24d6971eef17797bab8c0
1 //===-- sanitizer_flags.h ---------------------------------------*- C++ -*-===//
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 ThreadSanitizer/AddressSanitizer runtime.
12 //===----------------------------------------------------------------------===//
14 #ifndef SANITIZER_FLAGS_H
15 #define SANITIZER_FLAGS_H
17 #include "sanitizer_internal_defs.h"
19 namespace __sanitizer {
21 void ParseFlag(const char *env, bool *flag, const char *name);
22 void ParseFlag(const char *env, int *flag, const char *name);
23 void ParseFlag(const char *env, const char **flag, const char *name);
25 struct CommonFlags {
26 // If set, use the online symbolizer from common sanitizer runtime.
27 bool symbolize;
28 // Path to external symbolizer. If it is NULL, symbolizer will be looked for
29 // in PATH. If it is empty, external symbolizer will not be started.
30 const char *external_symbolizer_path;
31 // Strips this prefix from file paths in error reports.
32 const char *strip_path_prefix;
33 // Use fast (frame-pointer-based) unwinder on fatal errors (if available).
34 bool fast_unwind_on_fatal;
35 // Use fast (frame-pointer-based) unwinder on malloc/free (if available).
36 bool fast_unwind_on_malloc;
37 // Intercept and handle ioctl requests.
38 bool handle_ioctl;
39 // Max number of stack frames kept for each allocation/deallocation.
40 int malloc_context_size;
41 // Write logs to "log_path.pid".
42 // The special values are "stdout" and "stderr".
43 // The default is "stderr".
44 const char *log_path;
45 // Verbosity level (0 - silent, 1 - a bit of output, 2+ - more output).
46 int verbosity;
47 // Enable memory leak detection.
48 bool detect_leaks;
49 // Invoke leak checking in an atexit handler. Has no effect if
50 // detect_leaks=false, or if __lsan_do_leak_check() is called before the
51 // handler has a chance to run.
52 bool leak_check_at_exit;
53 // If false, the allocator will crash instead of returning 0 on out-of-memory.
54 bool allocator_may_return_null;
55 // If false, disable printing error summaries in addition to error reports.
56 bool print_summary;
59 inline CommonFlags *common_flags() {
60 static CommonFlags f;
61 return &f;
64 void SetCommonFlagsDefaults(CommonFlags *f);
65 void ParseCommonFlagsFromString(CommonFlags *f, const char *str);
67 } // namespace __sanitizer
69 #endif // SANITIZER_FLAGS_H