1 //===-- asan_flags.h -------------------------------------------*- C++ -*-===//
3 // This file is distributed under the University of Illinois Open Source
4 // License. See LICENSE.TXT for details.
6 //===----------------------------------------------------------------------===//
8 // This file is a part of AddressSanitizer, an address sanity checker.
10 // ASan runtime flags.
11 //===----------------------------------------------------------------------===//
16 #include "sanitizer/common_interface_defs.h"
18 // ASan flag values can be defined in three ways:
19 // 1) initialized with default values at startup.
20 // 2) overriden from string returned by user-specified function
21 // __asan_default_options().
22 // 3) overriden from env variable ASAN_OPTIONS.
27 // Size (in bytes) of quarantine used to detect use-after-free errors.
28 // Lower value may reduce memory usage but increase the chance of
31 // If set, uses in-process symbolizer from common sanitizer runtime.
33 // Verbosity level (0 - silent, 1 - a bit of output, 2+ - more output).
35 // Size (in bytes) of redzones around heap objects.
36 // Requirement: redzone >= 32, is a power of two.
38 // If set, prints some debugging information and does additional checks.
40 // Controls the way to handle globals (0 - don't detect buffer overflow
41 // on globals, 1 - detect buffer overflow, 2 - print data about registered
44 // If set, attempts to catch initialization order issues.
45 bool check_initialization_order
;
46 // Max number of stack frames kept for each allocation.
47 int malloc_context_size
;
48 // If set, uses custom wrappers and replacements for libc string functions
49 // to find more errors.
51 // If set, uses custom wrappers for memset/memcpy/memmove intinsics.
53 // Used on Mac only. See comments in asan_mac.cc and asan_malloc_mac.cc.
54 bool replace_cfallocator
;
56 bool mac_ignore_invalid_free
;
57 // ASan allocator flag. See asan_allocator.cc.
59 // ASan allocator flag. Sets the maximal size of allocation request
60 // that would return memory filled with zero bytes.
61 int max_malloc_fill_size
;
62 // Override exit status if something was reported.
64 // If set, user may manually mark memory regions as poisoned or unpoisoned.
65 bool allow_user_poisoning
;
66 // Number of seconds to sleep between printing an error report and
67 // terminating application. Useful for debug purposes (when one needs
68 // to attach gdb, for example).
69 int sleep_before_dying
;
70 // If set, registers ASan custom segv handler.
72 // If set, uses alternate stack for signal handling.
74 // Allow the users to work around the bug in Nvidia drivers prior to 295.*.
75 bool check_malloc_usable_size
;
76 // If set, explicitly unmaps (huge) shadow at exit.
77 bool unmap_shadow_on_exit
;
78 // If set, calls abort() instead of _exit() after printing an error report.
80 // If set, prints ASan exit stats even after program terminates successfully.
82 // By default, disable core dumper on 64-bit - it makes little sense
85 // Allow the tool to re-exec the program. This may interfere badly with the
88 // Strips this prefix from file paths in error reports.
89 const char *strip_path_prefix
;
90 // If set, prints not only thread creation stacks for threads in error report,
91 // but also thread creation stacks for threads that created those threads,
92 // etc. up to main thread.
93 bool print_full_thread_history
;
94 // ASan will write logs to "log_path.pid" instead of stderr.
99 void InitializeFlags(Flags
*f
, const char *env
);
101 } // namespace __asan
103 #endif // ASAN_FLAGS_H