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