1//===-- asan_flags.h -------------------------------------------*- C++ -*-===//
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 AddressSanitizer, an address sanity checker.
9//
10// ASan runtime flags.
11//===----------------------------------------------------------------------===//
12
13#ifndef ASAN_FLAGS_H
14#define ASAN_FLAGS_H
15
16#include "sanitizer_common/sanitizer_internal_defs.h"
17
18// ASan flag values can be defined in four ways:
19// 1) initialized with default values at startup.
20// 2) overriden during compilation of ASan runtime by providing
21//    compile definition ASAN_DEFAULT_OPTIONS.
22// 3) overriden from string returned by user-specified function
23//    __asan_default_options().
24// 4) overriden from env variable ASAN_OPTIONS.
25
26namespace __asan {
27
28struct Flags {
29  // Flag descriptions are in asan_rtl.cc.
30  int  quarantine_size;
31  int  redzone;
32  int  max_redzone;
33  bool debug;
34  int  report_globals;
35  bool check_initialization_order;
36  bool replace_str;
37  bool replace_intrin;
38  bool mac_ignore_invalid_free;
39  bool detect_stack_use_after_return;
40  int min_uar_stack_size_log;
41  int max_uar_stack_size_log;
42  bool uar_noreserve;
43  int max_malloc_fill_size, malloc_fill_byte;
44  int  exitcode;
45  bool allow_user_poisoning;
46  int  sleep_before_dying;
47  bool check_malloc_usable_size;
48  bool unmap_shadow_on_exit;
49  bool abort_on_error;
50  bool print_stats;
51  bool print_legend;
52  bool atexit;
53  bool allow_reexec;
54  bool print_full_thread_history;
55  bool poison_heap;
56  bool poison_partial;
57  bool poison_array_cookie;
58  bool alloc_dealloc_mismatch;
59  bool new_delete_type_mismatch;
60  bool strict_memcmp;
61  bool strict_init_order;
62  bool start_deactivated;
63  int detect_invalid_pointer_pairs;
64  bool detect_container_overflow;
65  int detect_odr_violation;
66  bool dump_instruction_bytes;
67};
68
69extern Flags asan_flags_dont_use_directly;
70inline Flags *flags() {
71  return &asan_flags_dont_use_directly;
72}
73void InitializeFlags(Flags *f, const char *env);
74
75}  // namespace __asan
76
77#endif  // ASAN_FLAGS_H
78