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 describes common flags available in all sanitizers. 11// 12//===----------------------------------------------------------------------===// 13#ifndef COMMON_FLAG 14#error "Define COMMON_FLAG prior to including this file!" 15#endif 16 17// COMMON_FLAG(Type, Name, DefaultValue, Description) 18// Supported types: bool, const char *, int, uptr. 19// Default value must be a compile-time constant. 20// Description must be a string literal. 21 22COMMON_FLAG( 23 bool, symbolize, true, 24 "If set, use the online symbolizer from common sanitizer runtime to turn " 25 "virtual addresses to file/line locations.") 26COMMON_FLAG( 27 const char *, external_symbolizer_path, 0, 28 "Path to external symbolizer. If empty, the tool will search $PATH for " 29 "the symbolizer.") 30COMMON_FLAG( 31 bool, allow_addr2line, false, 32 "If set, allows online symbolizer to run addr2line binary to symbolize " 33 "stack traces (addr2line will only be used if llvm-symbolizer binary is " 34 "unavailable.") 35COMMON_FLAG(const char *, strip_path_prefix, "", 36 "Strips this prefix from file paths in error reports.") 37COMMON_FLAG(bool, fast_unwind_on_check, false, 38 "If available, use the fast frame-pointer-based unwinder on " 39 "internal CHECK failures.") 40COMMON_FLAG(bool, fast_unwind_on_fatal, false, 41 "If available, use the fast frame-pointer-based unwinder on fatal " 42 "errors.") 43COMMON_FLAG(bool, fast_unwind_on_malloc, true, 44 "If available, use the fast frame-pointer-based unwinder on " 45 "malloc/free.") 46COMMON_FLAG(bool, handle_ioctl, false, "Intercept and handle ioctl requests.") 47COMMON_FLAG(int, malloc_context_size, 1, 48 "Max number of stack frames kept for each allocation/deallocation.") 49COMMON_FLAG( 50 const char *, log_path, "stderr", 51 "Write logs to \"log_path.pid\". The special values are \"stdout\" and " 52 "\"stderr\". The default is \"stderr\".") 53COMMON_FLAG( 54 int, verbosity, 0, 55 "Verbosity level (0 - silent, 1 - a bit of output, 2+ - more output).") 56COMMON_FLAG(bool, detect_leaks, true, "Enable memory leak detection.") 57COMMON_FLAG( 58 bool, leak_check_at_exit, true, 59 "Invoke leak checking in an atexit handler. Has no effect if " 60 "detect_leaks=false, or if __lsan_do_leak_check() is called before the " 61 "handler has a chance to run.") 62COMMON_FLAG(bool, allocator_may_return_null, false, 63 "If false, the allocator will crash instead of returning 0 on " 64 "out-of-memory.") 65COMMON_FLAG(bool, print_summary, true, 66 "If false, disable printing error summaries in addition to error " 67 "reports.") 68COMMON_FLAG(bool, check_printf, true, "Check printf arguments.") 69COMMON_FLAG(bool, handle_segv, SANITIZER_NEEDS_SEGV, 70 "If set, registers the tool's custom SEGV handler (both SIGBUS and " 71 "SIGSEGV on OSX).") 72COMMON_FLAG(bool, allow_user_segv_handler, false, 73 "If set, allows user to register a SEGV handler even if the tool " 74 "registers one.") 75COMMON_FLAG(bool, use_sigaltstack, true, 76 "If set, uses alternate stack for signal handling.") 77COMMON_FLAG(bool, detect_deadlocks, false, 78 "If set, deadlock detection is enabled.") 79COMMON_FLAG( 80 uptr, clear_shadow_mmap_threshold, 64 * 1024, 81 "Large shadow regions are zero-filled using mmap(NORESERVE) instead of " 82 "memset(). This is the threshold size in bytes.") 83COMMON_FLAG(const char *, color, "auto", 84 "Colorize reports: (always|never|auto).") 85COMMON_FLAG( 86 bool, legacy_pthread_cond, false, 87 "Enables support for dynamic libraries linked with libpthread 2.2.5.") 88COMMON_FLAG(bool, intercept_tls_get_addr, false, "Intercept __tls_get_addr.") 89COMMON_FLAG(bool, help, false, "Print the flag descriptions.") 90COMMON_FLAG(uptr, mmap_limit_mb, 0, 91 "Limit the amount of mmap-ed memory (excluding shadow) in Mb; " 92 "not a user-facing flag, used mosly for testing the tools") 93COMMON_FLAG(uptr, hard_rss_limit_mb, 0, 94 "Hard RSS limit in Mb." 95 " If non-zero, a background thread is spawned at startup" 96 " which periodically reads RSS and aborts the process if the" 97 " limit is reached") 98COMMON_FLAG(uptr, soft_rss_limit_mb, 0, 99 "Soft RSS limit in Mb." 100 " If non-zero, a background thread is spawned at startup" 101 " which periodically reads RSS. If the limit is reached" 102 " all subsequent malloc/new calls will fail or return NULL" 103 " (depending on the value of allocator_may_return_null)" 104 " until the RSS goes below the soft limit." 105 " This limit does not affect memory allocations other than" 106 " malloc/new.") 107COMMON_FLAG(bool, can_use_proc_maps_statm, true, 108 "If false, do not attempt to read /proc/maps/statm." 109 " Mostly useful for testing sanitizers.") 110COMMON_FLAG( 111 bool, coverage, false, 112 "If set, coverage information will be dumped at program shutdown (if the " 113 "coverage instrumentation was enabled at compile time).") 114COMMON_FLAG(bool, coverage_pcs, true, 115 "If set (and if 'coverage' is set too), the coverage information " 116 "will be dumped as a set of PC offsets for every module.") 117COMMON_FLAG(bool, coverage_order_pcs, false, 118 "If true, the PCs will be dumped in the order they've" 119 " appeared during the execution.") 120COMMON_FLAG(bool, coverage_bitset, false, 121 "If set (and if 'coverage' is set too), the coverage information " 122 "will also be dumped as a bitset to a separate file.") 123COMMON_FLAG(bool, coverage_counters, false, 124 "If set (and if 'coverage' is set too), the bitmap that corresponds" 125 " to coverage counters will be dumped.") 126COMMON_FLAG(bool, coverage_direct, SANITIZER_ANDROID, 127 "If set, coverage information will be dumped directly to a memory " 128 "mapped file. This way data is not lost even if the process is " 129 "suddenly killed.") 130COMMON_FLAG(const char *, coverage_dir, ".", 131 "Target directory for coverage dumps. Defaults to the current " 132 "directory.") 133COMMON_FLAG(bool, full_address_space, false, 134 "Sanitize complete address space; " 135 "by default kernel area on 32-bit platforms will not be sanitized") 136COMMON_FLAG(bool, print_suppressions, true, 137 "Print matched suppressions at exit.") 138COMMON_FLAG( 139 bool, disable_coredump, (SANITIZER_WORDSIZE == 64), 140 "Disable core dumping. By default, disable_core=1 on 64-bit to avoid " 141 "dumping a 16T+ core file. Ignored on OSes that don't dump core by" 142 "default and for sanitizers that don't reserve lots of virtual memory.") 143COMMON_FLAG(bool, use_madv_dontdump, true, 144 "If set, instructs kernel to not store the (huge) shadow " 145 "in core file.") 146COMMON_FLAG(bool, symbolize_inline_frames, true, 147 "Print inlined frames in stacktraces. Defaults to true.") 148COMMON_FLAG(const char *, stack_trace_format, "DEFAULT", 149 "Format string used to render stack frames. " 150 "See sanitizer_stacktrace_printer.h for the format description. " 151 "Use DEFAULT to get default format.") 152COMMON_FLAG(bool, no_huge_pages_for_shadow, true, 153 "If true, the shadow is not allowed to use huge pages. ") 154COMMON_FLAG(bool, strict_string_checks, false, 155 "If set check that string arguments are properly null-terminated") 156