asan_flags.h revision 86277eb844c4983c81de62d7c050e92fe7155788
17ed1d2b699767dd1875994cb625d51a95b44221aAlexey Samsonov//===-- asan_flags.h -------------------------------------------*- C++ -*-===// 27ed1d2b699767dd1875994cb625d51a95b44221aAlexey Samsonov// 37ed1d2b699767dd1875994cb625d51a95b44221aAlexey Samsonov// The LLVM Compiler Infrastructure 47ed1d2b699767dd1875994cb625d51a95b44221aAlexey Samsonov// 57ed1d2b699767dd1875994cb625d51a95b44221aAlexey Samsonov// This file is distributed under the University of Illinois Open Source 67ed1d2b699767dd1875994cb625d51a95b44221aAlexey Samsonov// License. See LICENSE.TXT for details. 77ed1d2b699767dd1875994cb625d51a95b44221aAlexey Samsonov// 87ed1d2b699767dd1875994cb625d51a95b44221aAlexey Samsonov//===----------------------------------------------------------------------===// 97ed1d2b699767dd1875994cb625d51a95b44221aAlexey Samsonov// 107ed1d2b699767dd1875994cb625d51a95b44221aAlexey Samsonov// This file is a part of AddressSanitizer, an address sanity checker. 117ed1d2b699767dd1875994cb625d51a95b44221aAlexey Samsonov// 127ed1d2b699767dd1875994cb625d51a95b44221aAlexey Samsonov// ASan runtime flags. 137ed1d2b699767dd1875994cb625d51a95b44221aAlexey Samsonov//===----------------------------------------------------------------------===// 147ed1d2b699767dd1875994cb625d51a95b44221aAlexey Samsonov 157ed1d2b699767dd1875994cb625d51a95b44221aAlexey Samsonov#ifndef ASAN_FLAGS_H 167ed1d2b699767dd1875994cb625d51a95b44221aAlexey Samsonov#define ASAN_FLAGS_H 177ed1d2b699767dd1875994cb625d51a95b44221aAlexey Samsonov 18250f221ae0dee295098da8aa631977b6c2ebc99bEvgeniy Stepanov#include "sanitizer_common/sanitizer_internal_defs.h" 1986277eb844c4983c81de62d7c050e92fe7155788Stephen Hines#include "sanitizer_common/sanitizer_flag_parser.h" 207ed1d2b699767dd1875994cb625d51a95b44221aAlexey Samsonov 2136ea94dc39f0ed98663986f6c0409dfc0a5edeb5Alexey Samsonov// ASan flag values can be defined in four ways: 227ed1d2b699767dd1875994cb625d51a95b44221aAlexey Samsonov// 1) initialized with default values at startup. 2336ea94dc39f0ed98663986f6c0409dfc0a5edeb5Alexey Samsonov// 2) overriden during compilation of ASan runtime by providing 2436ea94dc39f0ed98663986f6c0409dfc0a5edeb5Alexey Samsonov// compile definition ASAN_DEFAULT_OPTIONS. 2536ea94dc39f0ed98663986f6c0409dfc0a5edeb5Alexey Samsonov// 3) overriden from string returned by user-specified function 26b750c4c8af128bdd63543f3715f2c147fc3e95bfAlexey Samsonov// __asan_default_options(). 2736ea94dc39f0ed98663986f6c0409dfc0a5edeb5Alexey Samsonov// 4) overriden from env variable ASAN_OPTIONS. 2886277eb844c4983c81de62d7c050e92fe7155788Stephen Hines// 5) overriden during ASan activation (for now used on Android only). 297ed1d2b699767dd1875994cb625d51a95b44221aAlexey Samsonov 307ed1d2b699767dd1875994cb625d51a95b44221aAlexey Samsonovnamespace __asan { 317ed1d2b699767dd1875994cb625d51a95b44221aAlexey Samsonov 327ed1d2b699767dd1875994cb625d51a95b44221aAlexey Samsonovstruct Flags { 3386277eb844c4983c81de62d7c050e92fe7155788Stephen Hines#define ASAN_FLAG(Type, Name, DefaultValue, Description) Type Name; 3486277eb844c4983c81de62d7c050e92fe7155788Stephen Hines#include "asan_flags.inc" 3586277eb844c4983c81de62d7c050e92fe7155788Stephen Hines#undef ASAN_FLAG 3686277eb844c4983c81de62d7c050e92fe7155788Stephen Hines 3786277eb844c4983c81de62d7c050e92fe7155788Stephen Hines void SetDefaults(); 387ed1d2b699767dd1875994cb625d51a95b44221aAlexey Samsonov}; 398a1dd56a284de3bb94ebcfaace49266bdf0d26c1Alexander Potapenko 4016cc10d9f4aeaec7e403102958dac475b08642ecKostya Serebryanyextern Flags asan_flags_dont_use_directly; 4116cc10d9f4aeaec7e403102958dac475b08642ecKostya Serebryanyinline Flags *flags() { 4216cc10d9f4aeaec7e403102958dac475b08642ecKostya Serebryany return &asan_flags_dont_use_directly; 4316cc10d9f4aeaec7e403102958dac475b08642ecKostya Serebryany} 4486277eb844c4983c81de62d7c050e92fe7155788Stephen Hines 4586277eb844c4983c81de62d7c050e92fe7155788Stephen Hinesvoid InitializeFlags(); 467ed1d2b699767dd1875994cb625d51a95b44221aAlexey Samsonov 477ed1d2b699767dd1875994cb625d51a95b44221aAlexey Samsonov} // namespace __asan 487ed1d2b699767dd1875994cb625d51a95b44221aAlexey Samsonov 497ed1d2b699767dd1875994cb625d51a95b44221aAlexey Samsonov#endif // ASAN_FLAGS_H 50