[compiler-rt] 9e06e77 - [rtsan] Add stats summary even when halt_on_error=true (#110165)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 7 14:26:12 PDT 2024
Author: Chris Apple
Date: 2024-10-07T14:26:09-07:00
New Revision: 9e06e772a1bcfe0b33be9b01bbd9549a305313d7
URL: https://github.com/llvm/llvm-project/commit/9e06e772a1bcfe0b33be9b01bbd9549a305313d7
DIFF: https://github.com/llvm/llvm-project/commit/9e06e772a1bcfe0b33be9b01bbd9549a305313d7.diff
LOG: [rtsan] Add stats summary even when halt_on_error=true (#110165)
Added:
Modified:
compiler-rt/lib/rtsan/rtsan.cpp
compiler-rt/test/rtsan/exit_stats.cpp
Removed:
################################################################################
diff --git a/compiler-rt/lib/rtsan/rtsan.cpp b/compiler-rt/lib/rtsan/rtsan.cpp
index f9741b4fe3509d..9f4a9a5701636f 100644
--- a/compiler-rt/lib/rtsan/rtsan.cpp
+++ b/compiler-rt/lib/rtsan/rtsan.cpp
@@ -75,8 +75,11 @@ static auto OnViolationAction(DiagnosticsInfo info) {
handle.inc_use_count_unsafe();
}
- if (flags().halt_on_error)
+ if (flags().halt_on_error) {
+ if (flags().print_stats_on_exit)
+ PrintStatisticsSummary();
Die();
+ }
};
}
diff --git a/compiler-rt/test/rtsan/exit_stats.cpp b/compiler-rt/test/rtsan/exit_stats.cpp
index 4341fbb0f9cf21..d4d19ace778ba5 100644
--- a/compiler-rt/test/rtsan/exit_stats.cpp
+++ b/compiler-rt/test/rtsan/exit_stats.cpp
@@ -1,5 +1,6 @@
// RUN: %clangxx -fsanitize=realtime %s -o %t
-// RUN: env RTSAN_OPTIONS="halt_on_error=false,print_stats_on_exit=true" %run %t 2>&1 | FileCheck %s
+// RUN: %env_rtsan_opts="halt_on_error=false,print_stats_on_exit=true" %run %t 2>&1 | FileCheck %s
+// RUN: %env_rtsan_opts="halt_on_error=true,print_stats_on_exit=true" not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-HALT
// UNSUPPORTED: ios
@@ -22,3 +23,7 @@ int main() {
// CHECK: RealtimeSanitizer exit stats:
// CHECK-NEXT: Total error count: 10
// CHECK-NEXT: Unique error count: 1
+
+// CHECK-HALT: RealtimeSanitizer exit stats:
+// CHECK-HALT-NEXT: Total error count: 1
+// CHECK-HALT-NEXT: Unique error count: 1
More information about the llvm-commits
mailing list