2012-07-09 21:21:39 +08:00
|
|
|
//===-- sanitizer_flags.h ---------------------------------------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file is a part of ThreadSanitizer/AddressSanitizer runtime.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef SANITIZER_FLAGS_H
|
|
|
|
#define SANITIZER_FLAGS_H
|
|
|
|
|
2012-07-10 17:17:06 +08:00
|
|
|
#include "sanitizer_internal_defs.h"
|
2012-07-09 21:21:39 +08:00
|
|
|
|
|
|
|
namespace __sanitizer {
|
|
|
|
|
2017-05-20 06:37:16 +08:00
|
|
|
enum HandleSignalMode {
|
|
|
|
kHandleSignalNo,
|
|
|
|
kHandleSignalYes,
|
2017-05-26 07:42:33 +08:00
|
|
|
kHandleSignalExclusive,
|
2017-05-20 06:37:16 +08:00
|
|
|
};
|
|
|
|
|
2013-05-06 19:27:58 +08:00
|
|
|
struct CommonFlags {
|
2015-01-06 10:44:05 +08:00
|
|
|
#define COMMON_FLAG(Type, Name, DefaultValue, Description) Type Name;
|
|
|
|
#include "sanitizer_flags.inc"
|
|
|
|
#undef COMMON_FLAG
|
2014-12-20 05:40:04 +08:00
|
|
|
|
|
|
|
void SetDefaults();
|
2015-01-03 05:28:37 +08:00
|
|
|
void CopyFrom(const CommonFlags &other);
|
2013-05-06 19:27:58 +08:00
|
|
|
};
|
|
|
|
|
2014-12-20 05:40:04 +08:00
|
|
|
// Functions to get/set global CommonFlags shared by all sanitizer runtimes:
|
|
|
|
extern CommonFlags common_flags_dont_use;
|
2015-01-03 05:28:37 +08:00
|
|
|
inline const CommonFlags *common_flags() {
|
2014-01-31 19:20:55 +08:00
|
|
|
return &common_flags_dont_use;
|
2013-05-06 19:27:58 +08:00
|
|
|
}
|
|
|
|
|
2014-12-20 05:40:04 +08:00
|
|
|
inline void SetCommonFlagsDefaults() {
|
|
|
|
common_flags_dont_use.SetDefaults();
|
|
|
|
}
|
|
|
|
|
2015-01-03 05:28:37 +08:00
|
|
|
// This function can only be used to setup tool-specific overrides for
|
|
|
|
// CommonFlags defaults. Generally, it should only be used right after
|
|
|
|
// SetCommonFlagsDefaults(), but before ParseCommonFlagsFromString(), and
|
|
|
|
// only during the flags initialization (i.e. before they are used for
|
|
|
|
// the first time).
|
|
|
|
inline void OverrideCommonFlags(const CommonFlags &cf) {
|
|
|
|
common_flags_dont_use.CopyFrom(cf);
|
|
|
|
}
|
|
|
|
|
2016-01-16 08:31:29 +08:00
|
|
|
void SubstituteForFlagValue(const char *s, char *out, uptr out_size);
|
|
|
|
|
2015-01-15 23:13:43 +08:00
|
|
|
class FlagParser;
|
|
|
|
void RegisterCommonFlags(FlagParser *parser,
|
|
|
|
CommonFlags *cf = &common_flags_dont_use);
|
2015-07-22 07:03:13 +08:00
|
|
|
void RegisterIncludeFlags(FlagParser *parser, CommonFlags *cf);
|
2016-03-19 03:28:07 +08:00
|
|
|
|
|
|
|
// Should be called after parsing all flags. Sets up common flag values
|
|
|
|
// and perform initializations common to all sanitizers (e.g. setting
|
|
|
|
// verbosity).
|
|
|
|
void InitializeCommonFlags(CommonFlags *cf = &common_flags_dont_use);
|
2012-07-09 21:21:39 +08:00
|
|
|
} // namespace __sanitizer
|
|
|
|
|
|
|
|
#endif // SANITIZER_FLAGS_H
|