summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/sanitizer_common
diff options
context:
space:
mode:
Diffstat (limited to 'compiler-rt/lib/sanitizer_common')
-rw-r--r--compiler-rt/lib/sanitizer_common/sanitizer_common.cc6
-rw-r--r--compiler-rt/lib/sanitizer_common/sanitizer_flags.cc2
-rw-r--r--compiler-rt/lib/sanitizer_common/sanitizer_flags.h2
3 files changed, 10 insertions, 0 deletions
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_common.cc b/compiler-rt/lib/sanitizer_common/sanitizer_common.cc
index 7f896f9bd89..9c331a8e426 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_common.cc
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_common.cc
@@ -166,6 +166,8 @@ void PrintModuleAndOffset(const char *module, uptr offset) {
}
void ReportErrorSummary(const char *error_message) {
+ if (!common_flags()->print_summary)
+ return;
InternalScopedBuffer<char> buff(kMaxSummaryLength);
internal_snprintf(buff.data(), buff.size(),
"SUMMARY: %s: %s", SanitizerToolName, error_message);
@@ -174,6 +176,8 @@ void ReportErrorSummary(const char *error_message) {
void ReportErrorSummary(const char *error_type, const char *file,
int line, const char *function) {
+ if (!common_flags()->print_summary)
+ return;
InternalScopedBuffer<char> buff(kMaxSummaryLength);
internal_snprintf(
buff.data(), buff.size(), "%s %s:%d %s", error_type,
@@ -183,6 +187,8 @@ void ReportErrorSummary(const char *error_type, const char *file,
}
void ReportErrorSummary(const char *error_type, StackTrace *stack) {
+ if (!common_flags()->print_summary)
+ return;
AddressInfo ai;
#if !SANITIZER_GO
if (stack->size > 0 && Symbolizer::Get()->IsAvailable()) {
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_flags.cc b/compiler-rt/lib/sanitizer_common/sanitizer_flags.cc
index ba23ea04bc2..924ed4bc014 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_flags.cc
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_flags.cc
@@ -32,6 +32,7 @@ void SetCommonFlagDefaults() {
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) {
@@ -48,6 +49,7 @@ void ParseCommonFlagsFromString(const char *str) {
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)
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_flags.h b/compiler-rt/lib/sanitizer_common/sanitizer_flags.h
index b8a6b15d8bb..9461dff8033 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_flags.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_flags.h
@@ -51,6 +51,8 @@ struct CommonFlags {
bool leak_check_at_exit;
// If false, the allocator will crash instead of returning 0 on out-of-memory.
bool allocator_may_return_null;
+ // If false, disable printing error summaries in addition to error reports.
+ bool print_summary;
};
inline CommonFlags *common_flags() {
OpenPOWER on IntegriCloud