blob: 11392041bd7df3738510dfbae65f9325fad9aea4 [file] [log] [blame]
Alexey Samsonov7ed1d2b2012-07-10 07:41:27 +00001//===-- asan_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 AddressSanitizer, an address sanity checker.
11//
12// ASan runtime flags.
13//===----------------------------------------------------------------------===//
14
15#ifndef ASAN_FLAGS_H
16#define ASAN_FLAGS_H
17
Evgeniy Stepanov250f2212013-01-30 13:12:08 +000018#include "sanitizer_common/sanitizer_internal_defs.h"
Alexey Samsonov7ed1d2b2012-07-10 07:41:27 +000019
Alexey Samsonov36ea94d2013-02-19 13:14:48 +000020// ASan flag values can be defined in four ways:
Alexey Samsonov7ed1d2b2012-07-10 07:41:27 +000021// 1) initialized with default values at startup.
Alexey Samsonov36ea94d2013-02-19 13:14:48 +000022// 2) overriden during compilation of ASan runtime by providing
23// compile definition ASAN_DEFAULT_OPTIONS.
24// 3) overriden from string returned by user-specified function
Alexey Samsonovb750c4c2012-07-25 10:40:57 +000025// __asan_default_options().
Alexey Samsonov36ea94d2013-02-19 13:14:48 +000026// 4) overriden from env variable ASAN_OPTIONS.
Alexey Samsonov7ed1d2b2012-07-10 07:41:27 +000027
Alexey Samsonov7ed1d2b2012-07-10 07:41:27 +000028namespace __asan {
29
30struct Flags {
Stephen Hines2d1fdb22014-05-28 23:58:16 -070031 // Flag descriptions are in asan_rtl.cc.
Alexey Samsonov7ed1d2b2012-07-10 07:41:27 +000032 int quarantine_size;
Alexey Samsonov7ed1d2b2012-07-10 07:41:27 +000033 int redzone;
Stephen Hines2d1fdb22014-05-28 23:58:16 -070034 int max_redzone;
Alexey Samsonov7ed1d2b2012-07-10 07:41:27 +000035 bool debug;
Alexey Samsonov7ed1d2b2012-07-10 07:41:27 +000036 int report_globals;
Kostya Serebryany3945c582012-08-21 14:10:25 +000037 bool check_initialization_order;
Alexey Samsonov7ed1d2b2012-07-10 07:41:27 +000038 bool replace_str;
Alexey Samsonov7ed1d2b2012-07-10 07:41:27 +000039 bool replace_intrin;
Alexey Samsonov7ed1d2b2012-07-10 07:41:27 +000040 bool mac_ignore_invalid_free;
Kostya Serebryany230e52f2013-09-18 10:35:12 +000041 bool detect_stack_use_after_return;
Stephen Hines2d1fdb22014-05-28 23:58:16 -070042 int min_uar_stack_size_log;
43 int max_uar_stack_size_log;
44 bool uar_noreserve;
Kostya Serebryany2a3619e2013-04-04 11:17:14 +000045 int max_malloc_fill_size, malloc_fill_byte;
Alexey Samsonov7ed1d2b2012-07-10 07:41:27 +000046 int exitcode;
Alexey Samsonov7ed1d2b2012-07-10 07:41:27 +000047 bool allow_user_poisoning;
Alexey Samsonov7ed1d2b2012-07-10 07:41:27 +000048 int sleep_before_dying;
Alexey Samsonov7ed1d2b2012-07-10 07:41:27 +000049 bool check_malloc_usable_size;
Alexey Samsonov7ed1d2b2012-07-10 07:41:27 +000050 bool unmap_shadow_on_exit;
Alexey Samsonov7ed1d2b2012-07-10 07:41:27 +000051 bool abort_on_error;
Kostya Serebryany95f630a2013-01-28 07:34:22 +000052 bool print_stats;
Kostya Serebryany95f630a2013-01-28 07:34:22 +000053 bool print_legend;
Alexey Samsonov7ed1d2b2012-07-10 07:41:27 +000054 bool atexit;
Alexey Samsonov7ed1d2b2012-07-10 07:41:27 +000055 bool disable_core;
Alexander Potapenkoeb8c46e2012-08-24 09:22:05 +000056 bool allow_reexec;
Alexey Samsonov71b42c92012-09-05 07:37:15 +000057 bool print_full_thread_history;
Kostya Serebryany73bad812012-12-20 11:54:21 +000058 bool poison_heap;
Kostya Serebryanycca8e782013-10-16 13:49:01 +000059 bool poison_partial;
Kostya Serebryanyfe6d9162012-12-21 08:53:59 +000060 bool alloc_dealloc_mismatch;
Alexander Potapenko8bd5e742013-02-28 14:09:30 +000061 bool strict_memcmp;
Alexey Samsonovdfeef672013-04-19 08:35:16 +000062 bool strict_init_order;
Stephen Hines2d1fdb22014-05-28 23:58:16 -070063 bool start_deactivated;
64 int detect_invalid_pointer_pairs;
65 bool detect_container_overflow;
66 int detect_odr_violation;
Alexey Samsonov7ed1d2b2012-07-10 07:41:27 +000067};
Alexander Potapenko8a1dd562012-07-25 09:18:43 +000068
Kostya Serebryany16cc10d2013-04-11 18:36:04 +000069extern Flags asan_flags_dont_use_directly;
70inline Flags *flags() {
71 return &asan_flags_dont_use_directly;
72}
Alexey Samsonov7ed1d2b2012-07-10 07:41:27 +000073void InitializeFlags(Flags *f, const char *env);
74
75} // namespace __asan
76
77#endif // ASAN_FLAGS_H