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,
22    const char *name, const char *descr);
23void ParseFlag(const char *env, int *flag,
24    const char *name, const char *descr);
25void ParseFlag(const char *env, uptr *flag,
26    const char *name, const char *descr);
27void ParseFlag(const char *env, const char **flag,
28    const char *name, const char *descr);
29
30struct CommonFlags {
31  bool symbolize;
32  const char *external_symbolizer_path;
33  bool allow_addr2line;
34  const char *strip_path_prefix;
35  bool fast_unwind_on_fatal;
36  bool fast_unwind_on_malloc;
37  bool handle_ioctl;
38  int malloc_context_size;
39  const char *log_path;
40  int  verbosity;
41  bool detect_leaks;
42  bool leak_check_at_exit;
43  bool allocator_may_return_null;
44  bool print_summary;
45  bool check_printf;
46  bool handle_segv;
47  bool allow_user_segv_handler;
48  bool use_sigaltstack;
49  bool detect_deadlocks;
50  uptr clear_shadow_mmap_threshold;
51  const char *color;
52  bool legacy_pthread_cond;
53  bool intercept_tls_get_addr;
54  bool help;
55  uptr mmap_limit_mb;
56  bool coverage;
57  bool coverage_direct;
58  const char *coverage_dir;
59  bool full_address_space;
60};
61
62inline CommonFlags *common_flags() {
63  extern CommonFlags common_flags_dont_use;
64  return &common_flags_dont_use;
65}
66
67void SetCommonFlagsDefaults(CommonFlags *f);
68void ParseCommonFlagsFromString(CommonFlags *f, const char *str);
69void PrintFlagDescriptions();
70
71}  // namespace __sanitizer
72
73#endif  // SANITIZER_FLAGS_H
74