aboutsummaryrefslogtreecommitdiff
path: root/lib/sanitizer_common/sanitizer_flags.cc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sanitizer_common/sanitizer_flags.cc')
-rw-r--r--lib/sanitizer_common/sanitizer_flags.cc35
1 files changed, 31 insertions, 4 deletions
diff --git a/lib/sanitizer_common/sanitizer_flags.cc b/lib/sanitizer_common/sanitizer_flags.cc
index b7218e5ad212..924ed4bc014f 100644
--- a/lib/sanitizer_common/sanitizer_flags.cc
+++ b/lib/sanitizer_common/sanitizer_flags.cc
@@ -18,15 +18,42 @@
namespace __sanitizer {
-CommonFlags common_flags_dont_use_directly;
+void SetCommonFlagDefaults() {
+ CommonFlags *f = common_flags();
+ f->symbolize = true;
+ f->external_symbolizer_path = "";
+ f->strip_path_prefix = "";
+ f->fast_unwind_on_fatal = false;
+ f->fast_unwind_on_malloc = true;
+ f->handle_ioctl = false;
+ f->malloc_context_size = 1;
+ f->log_path = "stderr";
+ f->verbosity = 0;
+ f->detect_leaks = false;
+ f->leak_check_at_exit = true;
+ f->allocator_may_return_null = false;
+ f->print_summary = true;
+}
void ParseCommonFlagsFromString(const char *str) {
CommonFlags *f = common_flags();
- ParseFlag(str, &f->malloc_context_size, "malloc_context_size");
+ ParseFlag(str, &f->symbolize, "symbolize");
+ ParseFlag(str, &f->external_symbolizer_path, "external_symbolizer_path");
ParseFlag(str, &f->strip_path_prefix, "strip_path_prefix");
ParseFlag(str, &f->fast_unwind_on_fatal, "fast_unwind_on_fatal");
ParseFlag(str, &f->fast_unwind_on_malloc, "fast_unwind_on_malloc");
- ParseFlag(str, &f->symbolize, "symbolize");
+ ParseFlag(str, &f->handle_ioctl, "handle_ioctl");
+ ParseFlag(str, &f->malloc_context_size, "malloc_context_size");
+ ParseFlag(str, &f->log_path, "log_path");
+ ParseFlag(str, &f->verbosity, "verbosity");
+ ParseFlag(str, &f->detect_leaks, "detect_leaks");
+ ParseFlag(str, &f->leak_check_at_exit, "leak_check_at_exit");
+ ParseFlag(str, &f->allocator_may_return_null, "allocator_may_return_null");
+ ParseFlag(str, &f->print_summary, "print_summary");
+
+ // Do a sanity check for certain flags.
+ if (f->malloc_context_size < 1)
+ f->malloc_context_size = 1;
}
static bool GetFlagValue(const char *env, const char *name,
@@ -97,7 +124,7 @@ void ParseFlag(const char *env, int *flag, const char *name) {
int value_length;
if (!GetFlagValue(env, name, &value, &value_length))
return;
- *flag = internal_atoll(value);
+ *flag = static_cast<int>(internal_atoll(value));
}
static LowLevelAllocator allocator_for_flags;